Jump to content

Is it possible to alter land elevation in 0 AD? or add land passing penalties?


AnnoCrat
 Share

Recommended Posts

Hi, 

I am a great age of empires 2 modder and was modding in 0 AD recently, 0 AD is a awesome game, but I got some modding questions;

> Is it possible to alter the land during gameplay? making it straight or make elevations or pits

> Is it possible to make units move slower in sand terrain or shallow water? or add damage penalty for passing lava terrain?

 

Maybe I missed some things, please let me know, 

 

thx

Link to comment
Share on other sites

5 minutes ago, AnnoCrat said:

Hi, 

I am a great age of empires 2 modder and was modding in 0 AD recently, 0 AD is a awesome game, but I got some modding questions;

> Is it possible to alter the land during gameplay? making it straight or make elevations or pits

> Is it possible to make units move slower in sand terrain or shallow water? or add damage penalty for passing lava terrain?

 

Maybe I missed some things, please let me know, 

 

thx

Hello and welcome to the forums.

Unfortunately it is currently not possible to change the terrain at game time. The terrain is not serialized so if you did that you'd get out of sync pretty quick because the computed paths would be different.

The only implementation that exists is outdated. See 

https://trac.wildfiregames.com/ticket/2264

And 

 

About your second question it is possible with a little bit of modding. You have to create entities with Auras. Please note that any abuse of such auras will have a performance hit. The idea is to place said entities in the places you want to slow down. Their range will do the rest.

Link to comment
Share on other sites

No, that's not possible currently, but it is a viable and not so hard to implement feature.

The terrain data (elevation and textures) are currently determined by the map and then there is no code to modify it in any way.

Serializing the terrain (i.e. storing in savegames) is described in #2147 and one of the necessities.

But there is also the simulation interface needed. There must be a TerrainManager system component that can be called from for example by building placement (terrain flattening or bridge-building in the Foundation or Repairable component or Commands processing), a triggerscript (for example simulating a vulcano) or maybe even a catapult hitting the ground (Attack component).

While at it I'd also take the EnvironmentManager.

Link to comment
Share on other sites

Quote

About your second question it is possible with a little bit of modding. You have to create entities with Auras. Please note that any abuse of such auras will have a performance hit. The idea is to place said entities in the places you want to slow down. Their range will do the rest

wow good idea, "Environmental" ranged aura's 

this seems a fair solution, but it requires quite some effort in placement

 

About the terrain changing items, once its implemented into the game, it will add lots of new possibility in 0 AD, also I noticed that it would look more realistic if terrain was flattened below foundations of (new) buildings. 

Please let me know if anyone might be smart enough to be able to implement this, I would be really grateful

 

Link to comment
Share on other sites

About some auras being slow, take a look at the relic auras, some of them are tremendously slow, especially those changing vision range #5099, it gets worse with the distance.

Terrian flattening also has problem, consider the "Flying Wonder" in #3913. So we need to take some precautions before doing so. But the feature is certainly interesting, bridge building, road building, digging ditches, I want that somehow.

Link to comment
Share on other sites

@elexis  @Annocrat

LordGood had roads in Ponies Ascendant for faster movement, and I also used his work to implement roads in my mod the-age-of-0-ad. We use aura for for faster movement of Troops.

That makes 0 A.D. more of a City-Building game, and is very cool. I just hope that the auras don't lag, which I don't believe.

  • Like 1
Link to comment
Share on other sites

Well, the aura's thing is one of the best features ive ever seen in any rts/city building game

@elexis this is a sea of possibilities, not just digging ditches, its also possible to do crazy stuff like let a volcano rise, land erode etc, besides units being able to change the terrain, you could also let triggers do this, but thats a step further, anyways please let me know if some terrain change feature will happen.

PS: do you know the game Populous: The Beginning? it's also a game where land changing plays vital roles, terrain also plays vital roles in warlords battlecry, where height difference plays a role in how much damage projectiles make.

This game's terrain and camera view are truly amazing, that's why I hoped more could be done with it :)

Also I made a special 26 color palette for importing terrains heightmaps to 0Ad, so you get cool terrains, and not crazy steep high mountains :)

Link to comment
Share on other sites

4 minutes ago, AnnoCrat said:

Also I made a special 26 color palette for importing terrains heightmaps to 0Ad, so you get cool terrains, and not crazy steep high mountains :)

Please share I'm sure other people can make use of it. That's the nice thing about open source. Everyone can contribute.

4 minutes ago, AnnoCrat said:

This game's terrain and camera view are truly amazing, that's why I hoped more could be done with it :)

There will an isometric view too :)

Link to comment
Share on other sites

1 minute ago, AnnoCrat said:

https://trac.wildfiregames.com/attachment/ticket/21/21.2.patch

I'm taking a look at this code, maybe its a good start, atleast its something :)

edit: how to install the .patch file?

You need to get the source code. See trac.wildfiregames.com on how to get started. You also need to get familiar with at least SVN.

Link to comment
Share on other sites

4 minutes ago, AnnoCrat said:

please let me know if some terrain change feature will happen

"I would like to see it happen" is all I can say. If someone works on anything it's always a surprise for everyone. Even started patches are often discontinued.

9 minutes ago, AnnoCrat said:

Also I made a special 26 color palette for importing terrains heightmaps to 0Ad, so you get cool terrains, and not crazy steep high mountains :) 

Heightmaps can be imported already in atlas and mapscripts already, what are the 26 special colors for?

Link to comment
Share on other sites

3 minutes ago, stanislas69 said:

Please share I'm sure other people can make use of it. That's the nice thing about open source. Everyone can contribute.

Here is the palette:

This is a 26 color grayscale palette, it looks dark but it got the colors 0-0-0 til 25-25-25 in RGB values, this palette needs some instruction to be properly applied.

> Step 1: Make or get the terrain heightmap image

> Step 2: Open the image in a image editor with some palette editing functionality (I use the antique paint shop pro 5) 

> Step 3: Reduce the amount of colors in the heightmap image to 26 colors.

> Step 4: Load my palette, but choose to maintain indexes do not choose closest color or diffusion

> Step 5: if all is done right you got a very dark grayscale image, save it to the correct format (24 bit color) so it can be imported to the game

These dark colors prevent the engine from drawing insanely huge mountains, enjoy! :)

If someone want, I can upload a few of their heightmaps edited to this format and upload it back here if they think these instructions are too dificult 

darkest grayscale.pal

Link to comment
Share on other sites

So, elexis, you can't make this feature come to life? also the patch file seems only to be a single edited JS file, the patch only shows the lines that get added, but making the patch thing works seems a really long and complicated process, maybe you or someone else can send or upload the JS file in edited form? so I can just put the modded JS file into my mod and see how it works, from there I can try make other adjustments, I am not a hero at programming languages, but I am good at editing game data and xls and scripts

Link to comment
Share on other sites

1 hour ago, AnnoCrat said:

guess not then :mellow:

Hey, do not lose hope.

This is an open-source project things take longer here. We are currently in a tedious legal process, to comply with GDPR, to offer a better A23 release. Which means most of the dev is stopped for now. elexis is working really hard on it.

The feature might be for A24, if someone finds the time/motivation to do it. Nevertheless, it never being implemented probably means there is something more than a few lines of JavaScript code. Coding is fun and can be rewarding. A few devs here started from the bottom and now do awesome things, and it's never to late to start :) Nothing will beat motivation at getting things done. The best way to get something done is to do it yourself though :)

Sorry for the inconvenience.
 

  • Like 1
Link to comment
Share on other sites

Trying to do it myself is what I attempted, the patch file where was linked to, I have no idea how it install it without needing to install dozens of new programs, I hoped someone could post me the output javascript file with the added/edited codelines so that I could put the .JS in my mod folder and see the changes made by the script and try editing the script myself to see if I can improve it :)

Link to comment
Share on other sites

12 minutes ago, AnnoCrat said:

Trying to do it myself is what I attempted, the patch file where was linked to, I have no idea how it install it without needing to install dozens of new programs, I hoped someone could post me the output javascript file with the added/edited codelines so that I could put the .JS in my mod folder and see the changes made by the script and try editing the script myself to see if I can improve it :)

Simplest way to install a patch is to a apply it :)

If you don't know what patch / diff are they are text files that allows one to determine what has changed in a file. It will tell you what lines have been modified.

Another way of *installing* it is to modify the file the diff is based on manually. You can see the files name inside it ( It's a text file) A minus in front of the line means the line was removed. A plus means that a line was added.  

As you can see it also needs C++ changes. The Js changes alone are not enough. 

It touches

Foundation.JS

Terrain.cpp

Terrain.h

Ccmpterrain.cpp

IcmpTerrain.cpp

Icmpterrain.h

This means you also need a modified exe file...

Link to comment
Share on other sites

Sorry I missed the update.

A patch / diff file is really easy to apply, one can execute "patch -p0 < filename" on linux or click on "apply patch" in tortoise svn on windows.  But the patch linked above is 6 years old, that most likely doesn't apply anymore (and likely didn't implement something ready to use. From reading it it seems like it could work except for multiplayer and savegame loading).

On 7/22/2018 at 12:24 AM, AnnoCrat said:

So, elexis, you can't make this feature come to life?

Possibly, there may be technical bottlenecks and difficulties that are only seen during implementation phase; but possibly. The question is whether I will try to, then whether I can comes after that. You can assume there will be 2-6 weeks going down the drain when also implementing a fun map or similar interesting applications.The petra AI would also likely need some changes at which point we may consider involving our last AI dev again.

4 hours ago, stanislas69 said:

This means you also need a modified exe file...

Compiling will be the easy part however.

Link to comment
Share on other sites

wow okay, so because the file is very dated, its verfy unlikely that it will still work, also didnt see that other files were involved that were included in the sourcecode, well in this case, even installing the patch might cause the game to fail :(

some other question, at maps I saw the option for a round map or square map, is there a way to make a map squared?

Link to comment
Share on other sites

Square maps have several problems:

  • square maps of size X have area X², but circular maps of size X have the area X² * pi/ 4, i.e. square maps have 25% more size which yields unintended consequences like more lag and more cost to attack the enemy, more trade income
  • minimap is made for a circular maps
  • squaremaps have corners which are special locations that are hard to reach. that impacts the gameplay unless its a special case (like corsica vs sardinia or latium). On circular maps, the greatest distance between two points is X, on a square map SQRT(2) * X², i.e. 40% more walking distance, while still most of the relevant locations of gameplay are within the circular part

Don't know if there are remains of atlas square map support. But you could probably hack it by generating the latium map and then deleting the contents and work with the square thing.

About the 6 year old terrain flattening patch, that is not only outdated but also incomplete, because it lacks serialization. It's not a feature because the implementation wasn't finished, maybe yet.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...