Author Topic: Op2mapper V3.1  (Read 5738 times)

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Op2mapper V3.1
« on: April 04, 2010, 03:28:20 AM »
So some of you may be curious about this project that I have started working on, very sparingly (not a lot of free time at the moment!) but it is progressing:

I have started some work on a new version of the mapper, OP2Mapper v3.1. (Yes, I know that the next version would logically be "OP2Mapper 3.0" but I did start some work on such a project, written in C++). v3.1 is being written in C# and I plan to include the following features and changes (some of them are a large departure from the previous version:

New Features I hope to include
1. Actual mission editing support. I know OP2Mapper v2 includes a unit editor, and you can force it to generate some (rather unreadable) C++ code. However, there is really no graphical mission editor yet released for OP2. By graphical mission editor, I mean being able to create a more-or-less fully functional mission without having to edit code.

I invision this as the following. After you have a working map, you plop structures down for each player, and edit some generic mission properties (for example setting the name of the mission, techtree, etc). You can then switch into a script editor mode where you basically have a list of conditions and can add/remove conditions. For each condition you can associate one or more actions. (I suppose the analogous OP2 mission construct would be a Trigger, however some of these conditions might not be real conditions, for example "initialize game" or similar would correspond to the code within InitProc, or there might be "fake conditions" that can be called from within other actions, as a type of subroutine support).

If you have ever used the "triggers" interface in the Starcraft map editor you should have a decent idea of how this script editing might work (but the UI will not be identical).

I want to add other support, for example specifying points or rectangles on the map that would be associated with certain script functions (for example the SetRect for a FightGroup could be specified directly on the map. Think "location layer" in the starcraft map editor).

After all this is specified I want to be able to generate well commented, human readable C++ code (this would allow a mission designer to create a "draft" in the map editor and then modify it accordingly if they want to add more advanced things, for example some of the unusual code that missions such as the Survivor maps use). That being said, I would like to have proper support to directly compile a DLL from the editor (so someone who wants nothing to do with writing code won't have to touch it at all or even know how to compile a project, beyond the expectation that a C++ compiler is installed and usable).

2. Proper terrain editing support like would be expected in other games' map editors. I know this is a difficult proposition for OP2 (given the transitions between different colored types of tiles are not simple) but I want to have something that works at least somewhat in a usable fashion (probably via scanning the dynamix-created map files and making a list of tile adjacencies, weighting them by how often they are used and using this information to determine which tiles should be put next to each other). This includes cell types (for example if you put a crater onto the map, it sets it to an impassable type, and sets the cell type properly for the other types of terrain). This includes attributes like lava possible, so if you have the dark black terrain (recent lava flow) it sets this accordingly.

I know that this would be a loss of a feature (tile-by-tile editing) but from a usability standpoint tile-by-tile editing shouldn't be supported (or doing other weird things like changing celltypes to nonsensical values, for example making the middle of a cliff passable) as some of these kind of things go against the normal expectations of a player.

3. Cross platform support. I am writing the editor in C# as this is able to run on multiple platforms (.net on windows, mono on linux and mac os x). I will do testing on linux with Mono to insure that the editor runs properly there.

4. Maintainability. VB6 is horribly outdated, and if you have taken a look at the code for the project, it's a wretched mess. I hope to solve that here.

Features that will likely not exist (or at least not right away)
1. Tile by tile editing / direct cell type editing. With a proper terrain tool I can't think of a great use for this beyond creating confusing maps, for example passable cliffs as mentioned.

2. Copy/paste. This would be a bit difficult to implement with the map having additional layers such as units, locations/rectangles, etc. and most other map editors don't have this feature anyway. (Again, if the terrain tool works as advertised this probably won't be that necessary)

3. Tile Mapping / terrain editor. About the only use I can see for this are custom tilesets (I will probably have some kind of way to specify this information for custom tilesets so they can be edited in the mapper but it definitely won't be in an easily accessible GUI interface, imho these tools have the potential to do more harm than good, for example if required mappings are deleted.

4. Editing of VOLs/CLMs. At least not right away, but this feature was broken in OP2Mapper 2 and causes it to crash half the time. There are other (better) tools written to deal with these files already.

5. Opening multiple map files at once. It complicates the design of the program a fair bit and the workaround here is to open multiple instances of the mapper.

If you have any questions / comments / whatever, I'm open to suggestions. I just figured I would let people know that I have hopes to create a program like this to make mission editing easy to do without requiring coding (though I do not have a lot of free time so this will be a very slow moving project).

-- BlackBox

Offline AmIMeYet

  • Full Member
  • ***
  • Posts: 128
Op2mapper V3.1
« Reply #1 on: April 04, 2010, 05:09:17 AM »
Sounds great, BlackBox!
Quote
4. Editing of VOLs/CLMs. At least not right away, [...]"
Would be great if you could include that feature later. Used that feature on the previous mapper a lot myself.. could really be useful to streamline the whole development process, IMHO

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Op2mapper V3.1
« Reply #2 on: April 04, 2010, 09:30:42 AM »
Quote
I know that this would be a loss of a feature (tile-by-tile editing) but from a usability standpoint tile-by-tile editing shouldn't be supported (or doing other weird things like changing celltypes to nonsensical values, for example making the middle of a cliff passable) as some of these kind of things go against the normal expectations of a player.
Why not have an "Advanced" option that allows you to modify certain settings?  I could see things like "disable auto-terrain" and "modify default celltypes" being useful for some of the weirder maps.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline CK9

  • Administrator
  • Hero Member
  • *****
  • Posts: 6226
    • http://www.outpost2.net/~ck9
Op2mapper V3.1
« Reply #3 on: April 04, 2010, 12:07:31 PM »
For a map I'm making, I need to go against the norm of terrain types.  So I have to agree with bomber's idea of having a toggle for the setting.
CK9 in outpost
Iamck in runescape (yes, I still play...sometimes...)
srentiln in minecraft (I like legos, and I like computer games...it was only a matter of time...) and youtube...
xdarkinsidex on deviantart

yup, I have too many screen names

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Op2mapper V3.1
« Reply #4 on: April 04, 2010, 02:58:50 PM »
Nice to see you working on a new mapper. But tbh I don't believe that it'll be ready within the next few years. I still remember how long 3.0 took you. Thanks for posting the news, though.

Your lists of ideas looks already quite complete. Here are some more thoughts:

- a mere terrain editing mode may conflict with the loading of maps that don't obey terrain rules.

- copy/paste can still be an important feature if you want to clone parts of a map (for example give several players identical terrain at their starting locations)

- I don't see how allowing multiple open maps at a time would be difficult if each map was represented by a separate object. You can put all terrain data and all mappings into a map class and put the actual tilesets (wellXXXX.bmp) into another class (name it TileSets). Drawing of tiles can then be done by the TileSets class. You will most likely want to handle tiles via unambiguous ids (those could consist of the name of the tileset file and the tile's index inside that file). Using those ids copying tiles between maps with different mappings will be easy.

- the copy action should copy all available data of the selected area to clipboard. When pasting the user should be asked which parts of the copied data (tiles, celltypes, units) shall be pasted.

- I mentioned selection already. A visible selection would be nice, as in paint or maybe as in more advanced image editing programs.

- I'd appreciate a plugin system that allows everybody to write custom tools for terrain/tile editing. If you don't want that, it should at least be easily possible to hardcode new edit tools that were not part of the original design.

- please make a better gui. I don't like how I have to move child windows after loading a map in mapper2. Part of that would be to shrink the minimap if it wouldn't fit into a certain spot in the gui.

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Op2mapper V3.1
« Reply #5 on: April 04, 2010, 04:44:11 PM »
Quote
But tbh I don't believe that it'll be ready within the next few years. I still remember how long 3.0 took you.

I didn't have a lot of free time then, and I recall I was working on several different projects. In addition I am using a higher level language this time, this should speed development along (don't have to sit there chasing memory leaks cause I forgot a delete somewhere, or null/bad pointer dereferences, etc). I ha

Quote
- a mere terrain editing mode may conflict with the loading of maps that don't obey terrain rules.

This is true; though I can't really think of many examples of maps that use the OP2 tileset that don't obey the rules. As for other tilesets like greenworld, I want to have some kind of data file that the mapper can read to understand how to generate terrains for these tilesets (or perhaps I am understanding your question wrong?)

Quote
- copy/paste can still be an important feature if you want to clone parts of a map (for example give several players identical terrain at their starting locations)

This is true, I didn't think about that. That is a good justification for the copy/paste feature.

Quote
- I don't see how allowing multiple open maps at a time would be difficult if each map was represented by a separate object. You can put all terrain data and all mappings into a map class and put the actual tilesets (wellXXXX.bmp) into another class (name it TileSets). Drawing of tiles can then be done by the TileSets class. You will most likely want to handle tiles via unambiguous ids (those could consist of the name of the tileset file and the tile's index inside that file). Using those ids copying tiles between maps with different mappings will be easy.

It was more the UI design than anything that I didn't think about. And now that I think about it, it probably wouldn't be that hard to design it this way. I'll get to the changed UI design in a minute.

Quote
- the copy action should copy all available data of the selected area to clipboard. When pasting the user should be asked which parts of the copied data (tiles, celltypes, units) shall be pasted.

- I mentioned selection already. A visible selection would be nice, as in paint or maybe as in more advanced image editing programs.

Agreed, I would like to implement some better selection system for copy and paste than exists in OP2Mapper 2.

Quote
- I'd appreciate a plugin system that allows everybody to write custom tools for terrain/tile editing. If you don't want that, it should at least be easily possible to hardcode new edit tools that were not part of the original design.

I agree, and this should be possible as you can load assemblies at runtime in .net. I do plan to make the editing tools more modular (as compared with OP2Mapper 2, if you take a look at the code there is a single function that is 7 pages long that handles mouse events on the map window).

Quote
- please make a better gui. I don't like how I have to move child windows after loading a map in mapper2. Part of that would be to shrink the minimap if it wouldn't fit into a certain spot in the gui.

I plan to do away with the child windows completely. The minimap and tool window will be bound to the map window itself (basically a window with a splitter bar in the middle, the left side would have the minimap and the tools). Since there are no child windows except this combined map window it should make designing the MDI interface much cleaner and easier.

Offline CK9

  • Administrator
  • Hero Member
  • *****
  • Posts: 6226
    • http://www.outpost2.net/~ck9
Op2mapper V3.1
« Reply #6 on: April 04, 2010, 04:57:38 PM »
I just thought of something:

how hard would it be to make the mapper-clipboard read from multiple running instances?  What I mean is: If I open the mapper twice to switch between maps faster, how hard would it be to make it so I can copy from one instance, and paste in the other?
CK9 in outpost
Iamck in runescape (yes, I still play...sometimes...)
srentiln in minecraft (I like legos, and I like computer games...it was only a matter of time...) and youtube...
xdarkinsidex on deviantart

yup, I have too many screen names

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Op2mapper V3.1
« Reply #7 on: April 04, 2010, 05:03:41 PM »
Quote
how hard would it be to make the mapper-clipboard read from multiple running instances?  What I mean is: If I open the mapper twice to switch between maps faster, how hard would it be to make it so I can copy from one instance, and paste in the other?
It shouldn't be too hard. I could just copy to the windows clipboard, the clipboard allows you to specify "custom" data formats (this allows programs to differentiate between different kinds of data, like graphics vs. text, if you ever copied a graphic to the clipboard and tried to paste into notepad you would see it doesn't work). The map editor could monitor the clipboard for the mapper specific format and handle the pasting appropriately.
« Last Edit: April 04, 2010, 05:04:07 PM by BlackBox »

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Op2mapper V3.1
« Reply #8 on: April 05, 2010, 09:06:06 AM »
Quote
I didn't have a lot of free time then, and I recall I was working on several different projects. In addition I am using a higher level language this time, this should speed development along (don't have to sit there chasing memory leaks cause I forgot a delete somewhere, or null/bad pointer dereferences, etc)
Just don't make me think it will be done within one year if it won't. You may take all the time for it that you need.

Quote
though I can't really think of many examples of maps that use the OP2 tileset that don't obey the rules.
Every map created by opu could have small, unnoticeable mistakes. And then, it is probably just me, I start most new maps by drawing the basic (cliff-) layout onto the blue using a single tile.

Quote
As for other tilesets like greenworld, I want to have some kind of data file that the mapper can read to understand how to generate terrains for these tilesets (or perhaps I am understanding your question wrong?)
I wasn't talking about custom tilesets. Your idea sounds good, though.

Quote
I plan to do away with the child windows completely. The minimap and tool window will be bound to the map window itself (basically a window with a splitter bar in the middle, the left side would have the minimap and the tools).
Sounds good.

Offline CK9

  • Administrator
  • Hero Member
  • *****
  • Posts: 6226
    • http://www.outpost2.net/~ck9
Op2mapper V3.1
« Reply #9 on: April 05, 2010, 09:26:26 AM »
Quote
... I start most new maps by drawing the basic (cliff-) layout onto the blue using a single tile.
Same here, only I don't stop with cliffs.  I mark out cliffs with rare rubble, and terrain transition with common rubble.  If I feel like deciding beforehand which terrain is which, I'll use rubble on different terrains to make the distinction.


Which goes to further your point of the possibility of errors on maps we make.
CK9 in outpost
Iamck in runescape (yes, I still play...sometimes...)
srentiln in minecraft (I like legos, and I like computer games...it was only a matter of time...) and youtube...
xdarkinsidex on deviantart

yup, I have too many screen names

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Op2mapper V3.1
« Reply #10 on: October 08, 2011, 06:36:38 PM »
Are you still working on this or going to work on this?

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Re: Op2mapper V3.1
« Reply #11 on: October 07, 2015, 01:45:03 PM »
Would be nice to get the source code to this. BlackBox posted a lot of his code but not this I believe.

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Op2mapper V3.1
« Reply #12 on: October 07, 2015, 02:28:10 PM »
We're necro'ing a lot of threads huh?

Oh well. I'm game. I'd like to help in the development of the code generator. For basic mission and common designs, it should be pretty straight forward to generate the code that's needed and then package the editor with a built-in compiler. Fine-tuning some of the code later would probably be appropriate especially for very specific things. But again, I've never programmed a mission before and never really looked into the OP2 API so I should probably be familiar with that and figure out what boiler plate code there is so it can be generated properly.