Author Topic: Thoughts about the Map description Field / introducing cliffs (DONE!)  (Read 9830 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Silnarm posted the following in my    
"How to mark multiplayer maps" thread
:

Code: [Select]
struct MapFileHeader {
int32 version;
int32 maxPlayers;
int32 width;
int32 height;
int32 altFactor;
int32 waterLevel;
int8 title[128];
int8 author[128];
union {
int8 description[256];
struct {
int8 short_desc[128];
int32 magic; // 0x01020304 for meta
int8 meta[124];
};
};
};

I think this has much more potential than just meta info! One Idea I got are cliffs ( Its just an idea yet and not well thought out! )!  We just need to have a bit (or maybe a number) in the map header which indicates how the terrain should be smoothed in glest. For new maps using this, it means that hard "cliffs" are not "smoothed" while loading the map. Hard cliffs are big height differences of fields next to another. What is meant with "big" is either hard coded or described by a number which is in the map description too.

So this is just a rough idea yet. I did not thought about how to handle these cliffs ingame and so on, maybe one of you has an idea?
« Last Edit: 8 February 2011, 13:37:35 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Thoughts about the Map description Field
« Reply #1 on: 4 February 2011, 18:54:32 »
Support. Utilizing that metadata is a great idea. As long as cliffs are defaultly off, that will work great. How will cliffs look though?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Thoughts about the Map description Field
« Reply #2 on: 5 February 2011, 02:14:23 »
Will look like the following for example, of course using an extra cliff texture then specific for every tileset. For backwards compatibility the road texture is reused if no special texture for cliffs is defined in the tileset.

Another thing you see here are automatically added normal stones. These will be invisible blocker objects later, so noone can walk up or down cliffs ( thats the idea so far )! These blockers are added while loading the map in glest, they are not there in the editor.

« Last Edit: 5 February 2011, 02:20:13 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Conzar

  • Guest
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #3 on: 5 February 2011, 03:23:41 »
I've been recently working on adding cliffs too!  In the map editor, I've added a new object type (cliff).  Its non-walkable and is tileset specific.  The color of the object in the map editor is orange.

The xml for the object includes a new field called iscliff.  If this is set to true, then the object is considered a cliff in-game.

Thats as far as I have coded.  I think the way cliffs should work is the following:
* Land based units below a cliff should not have vision of on top of the cliff
* Land based units on top of the cliff, should have normal vision
* Projectile units on top of the cliff can attack units on the bottom of cliff
* Units on bottom of cliff cannot attack units on top of cliff unless they get vision from another source
* Flying units' vision will not be effected
* If a unit is ontop of the cliff or a flying unit has vision, then units of the same team below the cliff can attack up the cliff

The above is for vision specific events only.  If we want to get fancy, then we can give either a bonus for units attacking ontop of the cliff, or a debuf for units attacking below the cliff.

Anyways, seems like titi already has what I have coded, so maybe we can work on this together ... or if you already have this done, then I don't have to do anything :)

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #4 on: 5 February 2011, 06:13:22 »
Looking good but the stones on cliff look bad, you should use invisible objects (Pink in editor)

I like what you said Conzar hopefully Titi will do something like this.  :)

 :thumbup: :thumbup: :thumbup: :thumbup: :thumbup:
Get the Vbros': Packs 1, 2, 3, 4, and 5!

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #5 on: 5 February 2011, 06:26:09 »
Would this mean you can't use steep hills in the same map as cliffs?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #6 on: 5 February 2011, 06:38:23 »
Looks fantastic Titi! John did raise a good issue, though, to be honest, I've never seen such steep slopes before besides those that were meant to be as close to cliffs as previously possible.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #7 on: 5 February 2011, 09:34:25 »
@Eliminator: Of course this will be invisible blocking objects and they will only be set there where no other objects are already ( but it will replace non blocking objects eventually)
@John/Omega: Thats somehow right! When glest loads a map it will smoothen the terrain. The trick is that this terrain smoothing is not done when the height differences of two neighbored points is bigger than a given value. The one who creates the maps can set this height globally for his map. This will also mean he cannot really add the same steep things like before, without creating cliffs there. But the most important part is that this is still compatible with the former map format, thats why its done like its done.

Of course it is possible to do it in a complete different way, if you create a really new map format! But this was not what I had in mind (yet).
All in all I personally like my current idea because its so very simple and fully compatible with glest. Pathfinders will respect the cliffs, because they are surrounded with blocker object, we get a simple way for a new cliff texture and we don't have to change the map format.

@Conzar: didn't saw your cliffs yet, is there already something you can you show a screenshot?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Conzar

  • Guest
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #8 on: 5 February 2011, 09:55:01 »
@Conzar: didn't saw your cliffs yet, is there already something you can you show a screenshot?

I haven't yet added any graphics in the glest game yet.  I have added it in the editor though.  See the screenshot below.


The map format I think changes due to adding 1 more object.  I had to change several places in the code that differentiate between objects and resources (changed from 10 to 11).  In fact, I created a variable for this very reason (so that the numbers are defined in a meaningful way).

I haven't released the code yet, but if your interested, I can update the git repo with the branch I am working on, or create a patch.  Let me know.  Also, I like the way your cliffs work in game, I think that will work better then what I was planning on doing in game, but maybe you can use my map editor code?

MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #9 on: 5 February 2011, 13:30:04 »
I like the idea of having a cliff object. :thumbup: I think one more object won't be a problem for keeping maps kompatible. I also likethe idea of extra clifftextures. Let's see how we make this. ;)

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #10 on: 5 February 2011, 21:00:54 »
I think the way cliffs should work is the following:
* Land based units below a cliff should not have vision of on top of the cliff
* Land based units on top of the cliff, should have normal vision
* Projectile units on top of the cliff can attack units on the bottom of cliff
* Units on bottom of cliff cannot attack units on top of cliff unless they get vision from another source
* Flying units' vision will not be effected
* If a unit is ontop of the cliff or a flying unit has vision, then units of the same team below the cliff can attack up the cliff
-I have been wanting something like this to be implemented for years!

-which reminds me of a bug i forgot to report, (I will report it now) but its reverent to what you want to do, the glitch is that if a unit has an attack range greater than that of its vision it will still fire at units that come into attack range, weather or not he can see them.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #11 on: 5 February 2011, 21:09:47 »
the glitch is that if a unit has an attack range greater than that of its vision it will still fire at units that come into attack range, weather or not he can see them.
Well I want you to be able to attack farther than you can see just not automatically. Not sure if I should call this a request or bug...
either way it might be a problem for you Conzar.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #12 on: 6 February 2011, 00:08:24 »
The map format I think changes due to adding 1 more object.

This does indeed change the map format, and breaks all existing maps.

So you would need to bump the map version, and handle it specially in the engine. For such a small change, this seems a bit messy...  and in any case titi has achieved it without a new tileset object :thumbup:
Glest Advanced Engine - Code Monkey

Timeline | Downloads

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Thoughts about the Map description Field / introducing cliffs
« Reply #13 on: 6 February 2011, 02:17:02 »
I checked in now! Just first things, but already working:

- tilesets can have a 6th surface now for cliff texturing ( defined the normal way in tilesets ). If there is no 6th surface in a tileset, the third surface is used to texture cliffs to be stay compatible with old tilesets.
- currently you must enable cliffs by manually setting minCliffHeightDifference to 3.0f ( try 2.0f and 4.0f too ) in Map::smoothSurface(Tileset *tileset) in map.cpp ( The minCliffHeightDifference will be set in the map editor later. )

To see an effect you need a map with steep things in it :)
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: Thoughts about the Map description Field / introducing cliffs
« Reply #14 on: 8 February 2011, 13:27:09 »
OK cliffs are available now in svn!
I still need to talk to silnarm how to structure the map header to stay compatible.

You can try it by editing the advanced settings in the map editor. Set the clifflevel to 6 for example. then raise some steep cliffs in the editor.
The ground color will be yellow surrounded by dark object marks. This is a cliff. Save it and look at it in megaglest!

In the tileset you cann add one new texture for the cliffs now, just append it to the end of the existing textures. If no such texture exist in your tileset it just uses texture3 now.

!!! Warning!!! don't make real maps yet using this! I still have to talk to the GAE guys about the internal format. Maybe your work willl be lost! Its just for testing at the moment.
« Last Edit: 8 February 2011, 13:29:40 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
screenshots please! :)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
make one for us, so I know someone else tested it  ;)
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
good batting, but have pity on us browsing the forum from work

Screenshots pleeeease pleeeeeas please  :)

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
i will be testing it out, posting back here when i have a map working or not.
WiP Game developer.
I do danish translations.
"i break stuff"

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
I think we must allow bigger height differences soon :-D


Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Looks pretty good, though it definately suffers the flaws of our tile based maps (paths, cliffs, land edges, all caused horribly jagged edges). However, that has no small fix... It would need a large revamping and probably changes to how the maps work... Still, great job on the cliffs!
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
this is my current map header, as version I use 2 now. GAE, is it ok like this?

Code: [Select]
struct MapFileHeader {
int32 version;
  int32 maxFactions;
  int32 width;
  int32 height;
  int32 heightFactor;
  int32 waterLevel;
  int8 title[MAX_TITLE_LENGTH];
  int8 author[MAX_AUTHOR_LENGTH];
  union {
    int8 description[MAX_DESCRIPTION_LENGTH];
    struct {
       int8 short_desc[MAX_DESCRIPTION_LENGTH_VERSION2];
       int32 magic; // 0x01020304 for meta
       int32 cliffLevel;
       int8 meta[120];
    } version2;
  };
};
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Thoughts about the Map description Field / introducing cliffs (DONE!)
« Reply #22 on: 10 February 2011, 06:16:10 »
Airship and archer having a battle face to face.

Bug with selection when looking through cliff.

Archer higher than airship.

You can't really tell that its a cliff.

you can make stuff so close to cliff that it overhangs.

You can't really tell that its a cliff again.
Get the Vbros': Packs 1, 2, 3, 4, and 5!

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: Thoughts about the Map description Field / introducing cliffs (DONE!)
« Reply #23 on: 10 February 2011, 06:42:05 »
Excellent feedback.  A custom texture for the cliff faces - rather than reusing dirt - would improve the not-seeing-its-a-cliff issues?

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Thoughts about the Map description Field / introducing cliffs (DONE!)
« Reply #24 on: 10 February 2011, 09:18:54 »
Using a different texture for cliffs is already implemented! Just add a sixs texture to your tileset and its there.
Hopefully this will fix the "I cannot see the cliff" problem. Using dirt is just implemented as a fallback for old tilesets!

Regarding the "selection bug" I think we have to live with it. I see no real solution for this. If I try another render order there show up many more issues ...

For the airships: In general its fun isn't it? But the way flying units calculate their height has to be improved. They go up and down much too fast currently.
« Last Edit: 10 February 2011, 09:27:01 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

 

anything