How to add custom terrains

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Tom01
Posts: 4
Joined: September 11th, 2019, 1:18 am

How to add custom terrains

Post by Tom01 »

I'm currently making a custom map and would like to use terrains from a campaign I liked.

In the map editor, I am told that the terrains I want to use are non-core and will not work without extra care. Is there a way to use a set of terrains globally?

I am just creating a custom map to then set up a local game. I currently have both a terrain.cfg and a terrain_graphics.cfg file.
User avatar
Pentarctagon
Project Manager
Posts: 4574
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to add custom terrains

Post by Pentarctagon »

Moved to the WML Workshop.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Pilauli
Posts: 110
Joined: August 18th, 2020, 12:56 pm

Re: How to add custom terrains

Post by Pilauli »

Okay, I've tested some things, and it looks like you can use any terrain that you include in an #ifdef MULTIPLAYER section in any multiplayer game. (I'm not sure whether that's only required for the host, or whether it's required for everyone playing, but if you are playing a local game, then it won't matter, because everyone will be on the same computer anyway, right?)

The logical extension of this is to simply create a folder which contains a _main.cfg file, and make the _main.cfg file be almost empty except for notes that say "in multiplayer games, make sure you load up this terrain". All it should need is something like this:

Code: Select all

#ifdef MULTIPLAYER

# Let's include terrain from an unfinished add-on I made...
[binary_path]
    path=data/add-ons/Papermap/
[/binary_path]
{~add-ons/Papermap/utils/terrain.cfg}

# And the terrain from UtBS that you can't usually use in multiplayer games...
[binary_path]
    path=data/campaigns/Under_the_Burning_Suns/
[/binary_path]
{campaigns/Under_the_Burning_Suns/utils/terrain.cfg}
{campaigns/Under_the_Burning_Suns/utils/terrain_graphics.cfg}
#endif
Adapt that to the campaign(s) that you actually want to use terrain from and see if it works.
User avatar
MoonyDragon
Posts: 98
Joined: November 29th, 2017, 5:46 pm

Re: How to add custom terrains

Post by MoonyDragon »

Here is my step-by-step answer to almost the same question a while ago.
Default L0 Era - Level 1 leaders with level 0 recruits!
User avatar
Celtic_Minstrel
Developer
Posts: 1741
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How to add custom terrains

Post by Celtic_Minstrel »

Pilauli wrote: October 19th, 2020, 9:31 pm(I'm not sure whether that's only required for the host, or whether it's required for everyone playing,
Just to clear this up: terrain needs to be accessible to everyone playing the game. Otherwise how would the remote computers know how to draw those custom terrains, or what gameplay properties they have?

Of course, with a local hotseat game, there are no remote computers involved, so you don't need to worry about this if that's all you want to support.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
Post Reply