Author Topic: Map editor development  (Read 22419 times)

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Map editor development
« on: 1 March 2010, 08:46:17 »
For discussion of and testing improvements to the map editor.

The 'mega-zombiepirate' map editor can be downloaded here,

https://sourceforge.net/projects/glestae/files/map_editor/1.5/map_editor.7z/download

Has,
 * titi's changes to make 8 player maps,
 * zombiepirate's gradient brush
 * Keyboard commands (see 'cheat sheet' below)
 * undo/redo
 * from 1.5-beta3 includes a toolbar (with buttons on it!) thanks andy0101.

Want to make an 8 player map ?
When starting a new map, the player count defaults to 4, you also need to 'Reset Players' if you want to make an eight player map.

Cheat Sheet:
Code: [Select]
Ctrl + O : Open File
Ctrl + S : Save File
Shft + Ctrl + S : Save as
Ctrl + Z : Undo
Ctrl + Y : Redo

H : Switch to Height Brush
G : Switch to Gradient Brush
S : Switch to Surface Brush
O : Switch to Object Brush
R : Switch to Resource Brush
L : Switch to StartLocation Brush

Alt + [1-9] : Sets the Brush Radius

With Height or Gradient Brush activated,
[0-5] : Sets Brush height
Ctrl + [1-5] : Sets brush height (negative)

With Surface Brush activated,
[1-5] : Sets Surface Selected

With Object Brush active,
[1-0] : Sets Object Number (from 1-10)
- : Sets Object = 0 (erase)

With Resource Brush active,
[1-5] : Sets Resource Number
0 : Sets Resource = 0 (erase)

With Start Location Brush active,
[1-8] : Sets Start Location index.
« Last Edit: 2 April 2010, 02:56:22 by silnarm »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

zombiepirate

  • Guest
Re: map_editor development
« Reply #1 on: 1 March 2010, 09:02:48 »
A few notes about the Undo/Redo features as well. They're complete as far as terrain/object/surface/resources are concerned but player locations and resets haven't been implemented yet (though it is a quick fix so it should go in soon), player locations get recorded as a blank undo point and resets don't get recorded at all.

If you reset and try to undo, it will revert the last backup point for the object that was placed. ie. if you are editing resources and you reset and undo, your resources will come back but nothing else will unless you undo all the way back to the beginning and then redo up until the point before the reset.

If you are moving players around and then want to undo something that you did before moving players you will need to undo as many times as you moved the players.

EDIT: Quick patch to fix a rather obvious bug that I somehow never noticed.  :-[
Code: [Select]
Index: source/map_editor/map.cpp
===================================================================
--- source/map_editor/map.cpp (revision 499)
+++ source/map_editor/map.cpp (working copy)
@@ -349,7 +349,7 @@
 
 void Map::setObject(int x, int y, int object) {
  cells[x][y].object = object;
- cells[x][y].resource = 0;
+ if (object != 0) cells[x][y].resource = 0;
 }
 
 void Map::changeResource(int x, int y, int resource, int radius) {
@@ -371,7 +371,7 @@
 
 void Map::setResource(int x, int y, int resource) {
  cells[x][y].resource = resource;
- cells[x][y].object = 0;
+ if (resource != 0) cells[x][y].object = 0;
 }
 
 void Map::changeStartLocation(int x, int y, int faction) {
« Last Edit: 1 March 2010, 09:24:52 by zombiepirate »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: map_editor development
« Reply #2 on: 1 March 2010, 10:33:12 »
Download has been updated, same link.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: map_editor development
« Reply #3 on: 1 March 2010, 12:57:31 »
silnarm also made the  megaglest3.2.4-2-beta4 editor for 8 players here included in the linux/windows binaries of this version:
https://sourceforge.net/projects/megaglest/files/
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Trappin

  • Ornithopter
  • *****
  • Posts: 447
    • View Profile
    • MegaGlest Map Compendium
Re: map_editor development
« Reply #4 on: 1 March 2010, 16:47:43 »
When, during the course of map design, should one choose to use the gradient tool and not the original brush?

Comparing the two brushes when making hills with 4 height/gradient and 5 radius setting. The differences between the two brushes are very subtle and those slight differences in tool character probably won't be noticed by people playing a game on the map - but - we have a new tool and someone will find an interesting use for it.

Everything else is just peachy.

« Last Edit: 1 March 2010, 23:04:55 by Trappin »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: map_editor development
« Reply #5 on: 1 March 2010, 22:33:58 »
I found the linux editor flickering bug, its fixed now in megaglest!!! ( But megaglest sadly has no undo redo patch included yet! )

This was the problem:
http://old.nabble.com/OpenGL,-wxWidgets-and-Ubuntu-7.10-td16047290.html

I added WX_GL_DOUBLEBUFFER to the call .....

Code: [Select]
//gl canvas
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER};
glCanvas = new GlCanvas(this,args);

Code: [Select]
// =====================================================
// class GlCanvas
// =====================================================

GlCanvas::GlCanvas(MainWindow * mainWindow, int* args):
wxGLCanvas(mainWindow, -1, wxDefaultPosition,wxDefaultSize,0,wxT("GLCanvas"),args)
{
this->mainWindow = mainWindow;
}

update:
I reuploaded megaglest3.2.4-2-beta4_i386_linux_bin.tar.bz2 which contains a fixed editor now .
( I know I shouldn't do such a change/upload without a version change, but well, I did it, its only the editor :P )

How to use it:
Look at the included readme!
Put the editor and the startscript into your glest installation.
Start the editor with the included script  "start_editor".
 
If you get in trouble with missing openal version libs, try this:
Code: [Select]
ln -s /usr/lib/libopenal.so.1 <PathToGlestInstallation>/lib/libopenal.so.0as mentioned here: https://forum.megaglest.org/index.php?topic=4254.msg24188#msg24188

« Last Edit: 1 March 2010, 23:50:24 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

zombiepirate

  • Guest
Re: map_editor development
« Reply #6 on: 2 March 2010, 03:20:59 »
I just committed a few map editor undo/redo fixes to the GAE svn.

* Resets are now backed up.
* Another bug in the object/resource undo is fixed.
* Player location changes don't create a blank undo point. Player location changes are not handled by "undo" since moving the player position can't create permanent damage to the rest of the map.

I have also noticed a few issues with some undo points disappearing when undoing and redoing between different changes. So just remember the undo button is mostly stable, but, once you press it you might not be able to redo it.

When, during the course of map design, should one choose to use the gradient tool and not the original brush?

You would use the gradient tool when you're making more drastic changes in terrain and want smoother transitions between heights. ie. changing terrain from 15 to 5 in a single stroke... If you are looking for it the changes are noticeable in game. But, you are still right, most people probably wouldn't notice a difference.
« Last Edit: 2 March 2010, 04:02:30 by zombiepirate »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #7 on: 2 March 2010, 21:54:52 »
For the colors in the menu....

Here from the official class reference of wxWidget 2.8:

wxMenuItem::SetTextColour
void SetTextColour(const wxColour& colour)
Sets the text colour associated with the menu item (Windows only).

I think we have to wait with the colors in the menus... there is a wxWidget version 2.9 but its only a development version, nothing stable :/.
So we have to wait for wxWidget 3.0 .....
« Last Edit: 2 March 2010, 21:58:18 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #8 on: 2 March 2010, 22:54:41 »
Can I add my changes to the GAE editor too?
By this megaglest and GAE would have nearly the same source.

what i changed:
- The above mentioned linux flickering bug
- some strings in the menus, making it more easy to understand whats going on ....
- colors for the starting points.

can I check in this in 0.2.x?


Some more questions about the GAE editor code in general:

Why is map->getMaxPlayers() renamed to map->getMaxFactions()  in GAE ???
Why "Factions"? in my opinion this is wrong!

If you ask me, i would change it back! Factions ( in the meaning of glest ) have nothing to do with these starting points!

what is this include good for ( in several files ):
#include "pch.h"
I only get compile errors in megaglest!?

whats the matter with this:
GAE-sytle:
Conversion::strToInt(simpleDialog.getValue("Height"))

glest/megaglest style:
strToInt(simpleDialog.getValue("Height"))

I get compile errors in megaglest whith these "Conversion::"
Why is it needed?
« Last Edit: 2 March 2010, 23:13:53 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: Map editor development
« Reply #9 on: 3 March 2010, 00:17:06 »
can I check in this in 0.2.x?
Yes, i think you can. It's just the map editor and zombiepirate also added some features. There's no freeze for the tools. Can you confirm also flickering of the g3d_viewer and if yes check if the same fix works there too?

what is this include good for ( in several files ):
#include "pch.h"
I only get compile errors in megaglest!?
It's the precompiled header for windows, more specific Visual Studio. Should do nothing on Linux.

whats the matter with this:
GAE-sytle:
Conversion::strToInt(simpleDialog.getValue("Height"))

glest/megaglest style:
strToInt(simpleDialog.getValue("Height"))

I get compile errors in megaglest whith these "Conversion::"
Why is it needed?
The utility functions just got grouped in a class. They are still static, just nicer accessable.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #10 on: 3 March 2010, 00:31:38 »

Yes, i think you can. It's just the map editor and zombiepirate also added some features. There's no freeze for the tools. Can you confirm also flickering of the g3d_viewer and if yes check if the same fix works there too?
I never compiled or used it, but I will look for it.

Quote
....
It's the precompiled header for windows, more specific Visual Studio. Should do nothing on Linux.
But it does something, it doesn't compile in megaglest :/
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: Map editor development
« Reply #11 on: 3 March 2010, 00:49:51 »
I just commented all includes and it works. It's not really used on linux cause of:
Code: [Select]
#ifdef USE_PCH
It's not defined in the jam buildsystem, so pch.h is completly empty (after precompiler).

zombiepirate

  • Guest
Re: Map editor development
« Reply #12 on: 3 March 2010, 02:28:01 »

Some more questions about the GAE editor code in general:

Why is map->getMaxPlayers() renamed to map->getMaxFactions()  in GAE ???
Why "Factions"? in my opinion this is wrong!

If you ask me, i would change it back! Factions ( in the meaning of glest ) have nothing to do with these starting points!


It was changed at rev 212 for this reason...
Quote from: daniel_santos at 09/18/09 23:53:23
* Renamed "players" to "factions" everywhere because of the concept (being
introduced in the network branch) that a single player may control more than
one faction.

How are "players" and "factions" used in the rest of the code in both megaglest and GAE? Consistency between the editor and game code should matter a lot more than a small difference between the megaglest and GAE editor code.

EDIT: Is it actually possible for a single player to control more than one faction?
« Last Edit: 3 March 2010, 05:25:02 by zombiepirate »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #13 on: 3 March 2010, 10:43:06 »
Quote
* Renamed "players" to "factions" everywhere because of the concept (being
introduced in the network branch) that a single player may control more than
one faction.

But its still wrong , because a faction in the meaning of glest is one "faction" of a techtree! This has nothing to do with what the player controls or the startpoints in the editor! I still think player is the right word. Even in the glest GUI this is called Player everywhere, its never called faction!  
I think "Faction" just confuses people who want to get familar with the code
« Last Edit: 3 March 2010, 10:46:21 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Map editor development
« Reply #14 on: 3 March 2010, 12:08:06 »
New map editor for windows, merges the rest of the stuff from the megaglest editor + a couple of undo/redo fixes from zombiepirate. Same link.
https://sourceforge.net/projects/glestae/files/glestae_snapshots/map_editor/map_editor_win32.7z/download

It was changed at rev 212 for this reason...

I think I'm with Daniel idea on this one. Its already 'Faction' (as in 'player') throughout most of the code, faction and player are used interchangeably.

Quote
EDIT: Is it actually possible for a single player to control more than one faction?
Not currently, no.

But its still wrong , because a faction in the meaning of glest is one "faction" of a techtree!
Incorrect, what you described as Faction above is in the code 'FactionType'.

I like the idea of one player being able to control multiple factions, and multiple players being able to control one faction, or of course, multiple players being able to control multiple factions.

I'm in support of 'Player' being replaced by Faction in this sense (and as I mentioned, they are already used interchangeably). So thats how it will be, in GAE anyway ;)

Glest Advanced Engine - Code Monkey

Timeline | Downloads

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #15 on: 3 March 2010, 13:33:56 »
No FactionType is not a faction, its something that can hold a faction description!
The Object Faction ( in the code ) is some kind of instance of this FactionType which also contains a Control Type ( Human or CPU ) a starting point and so on. The "Count" of these objects is game setup dependend and the maximum possible faction number is limited by the map. By this MaxFactionCount might be ok, because its the maximum Factions which can play on this map. But its still confusing for me because its called "Player" everywhere else outside the code and thats not very intuitive in my opinion. Whatever if everyone thinks its a good idea I will use it too.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

zombiepirate

  • Guest
Re: Map editor development
« Reply #16 on: 4 March 2010, 01:09:18 »
Naming convention aside, is there another goal for the next step in development of the editor?

https://forum.megaglest.org/index.php?topic=3958.msg22840#msg22840
This post was the only real list of legit feature requests I found. The things that most stick out are tileset loading, 3d map rendering and a LUA editor.

Trappin

  • Ornithopter
  • *****
  • Posts: 447
    • View Profile
    • MegaGlest Map Compendium
Re: Map editor development
« Reply #17 on: 4 March 2010, 03:50:02 »
The new megamaps (5-8 player locations) crash unpatched Glest and GAE clients. If these new maps get mixed in with standard maps people will be crashing the various Glest client builds 2.x.x to 3.2.2 when scrolling the map selection menu during new game setup.

Is it possible to use an extension for 5-8 player maps other than .gbm?

« Last Edit: 4 March 2010, 04:19:21 by Trappin »

zombiepirate

  • Guest
Re: Map editor development
« Reply #18 on: 4 March 2010, 05:06:21 »
If a file extension rename is in order maybe the map format itself could be expanded as well to support future Megaglest/GAE features? Many of the feature requests in the old map editor topic would require a new map format. The current map file loader in Megaglest/GAE could easily be expanded to support a new format even if no new features are supported in the game itself.

hailstone

  • GAE Team
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Map editor development
« Reply #19 on: 4 March 2010, 10:10:03 »
It would be good to use the version in the map header but I don't think vanilla Glest checks it.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Map editor development
« Reply #20 on: 4 March 2010, 10:55:22 »
Some more changes are in, all 'nice' stuff, to make life easier.
https://sourceforge.net/projects/glestae/files/glestae_snapshots/map_editor/map_editor_win32.7z/download

map_editor 1.5 Cheat Sheet:
Code: [Select]
Ctrl + O : Open File
Ctrl + S : Save File
Shft + Ctrl + S : Save as
Ctrl + Z : Undo
Ctrl + Y : Redo

H : Switch to Height Brush
G : Switch to Gradient Brush
S : Switch to Surface Brush
O : Switch to Object Brush
R : Switch to Resource Brush
L : Switch to StartLocation Brush

Alt + [1-9] : Sets the Brush Radius

With Height or Gradient Brush activated,
[0-5] : Sets Brush height
Ctrl + [1-5] : Sets brush height (negative)

With Surface Brush activated,
[1-5] : Sets Surface Selected

With Object Brush active,
[1-0] : Sets Object Number (from 1-10)
- : Sets Object = 0 (erase)

With Resource Brush active,
[1-5] : Sets Resource Number
0 : Sets Resource = 0 (erase)

With Start Location Brush active,
[1-8] : Sets Start Location index.

I also added a status bar, which tells you what brush type, 'value' and radius is currently set.



Is it possible to use an extension for 5-8 player maps other than .gbm?

Good idea, a new map format would ultimately be nice, but for now I think maybe we should make the editor use .gbm8 or somesuch for maps with 5-8 player slots.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #21 on: 4 March 2010, 12:27:02 »
I thought this would be a good idea too, but normal glest crashes even if you rename a 4 player map to gbm8 :/
Due to this fact I wouldnt change anything now!
We must quickly bring stable 8 player versions and the people have to use them  ;D

Nevertheless, maybe a naming convention (.gbm8) can help a bit but I think It will not have a big effect :/

( By the way, its a cool looking map, where can we download it? )
« Last Edit: 4 March 2010, 12:37:12 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Map editor development
« Reply #22 on: 4 March 2010, 12:46:25 »
I thought this would be a good idea too, but normal glest crashes even if you rename a 4 player map to gbm8 :/
Discovered this soon after posting earlier  :-X

the gbm still matches somehow, .mgm works fine though :) Mega Maps

Quote
Nevertheless, maybe a naming convention (.gbm8) can help a bit but I think It will not have a big effect :/

I've just about finished changing what needs changing in megaglest to handle *.mgm, with your OK, I'll commit soon and build a new beta? (and update the map_editor of course...)

Quote
( By the way, its a cool looking map, where can we download it? )

Will post you a link in another topic soon... ;)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Map editor development
« Reply #23 on: 4 March 2010, 13:07:50 »
oh mgm works ? thats good!
Checkin is ok, but please don't make another beta yet, this will confuse everyone! We already have big problem with the non harvesting units ( I think in windows7 only? ) and I want to verify whats that all about!

We still have no fullpackage/installer to get more feedback, thats very sad :( . Hopefully its there very soon!

« Last Edit: 9 March 2010, 09:36:11 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Gabbe

  • Guest
Re: Map editor development
« Reply #24 on: 4 March 2010, 13:22:37 »
When i tried to make player 5- the whole thing stopped working, or correctly, it did not answer