How to make custom terrains available in the map editor

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

How to make custom terrains available in the map editor

Post by zookeeper »

As of 1.5.0 and onwards, you can make the custom terrains in your UMC be available in the map editor. This means that you can more easily open and edit maps using custom terrains. All that is needed is for the UMC to include their terrain definitions for the editor as described below.

The editor now reads WML in the <userdata>/data/campaigns/ directory just like the main game does, so all you need to do is to make your terrain definitions and a custom editor group be encountered by the parser. The preferred way is to use an #ifdef EDITOR. Let's take UtBS for an example. It simply has this in its campaign file (data/campaigns/Under_the_Burning_Suns/_main.cfg):

Code: Select all

#ifdef EDITOR
[binary_path]
    path=data/campaigns/Under_the_Burning_Suns
[/binary_path]
[editor_group]
    id=utbs
    name= _ "Under the Burning Suns"
    icon="group_custom"
[/editor_group]
{campaigns/Under_the_Burning_Suns/utils/adjacent_custom.cfg}
{campaigns/Under_the_Burning_Suns/utils/terrain.cfg}
{campaigns/Under_the_Burning_Suns/utils/terrain_graphics.cfg}
#endif
[binary_path] is needed as usual for the custom images to be found and [editor_group] is needed because the custom terrains of UtBS should appear as their own editor group, instead of getting mixed in with the other ones. After that, one simply includes any terrain and terrain graphics WML that is needed. Here we could have just included the whole Under_the_Burning_Suns/utils/ directory (as is done inside the campaign #ifdef), but then all the macros irrelevant to the map editor would have gotten included when starting the map editor too.

Also, all the custom [terrain_type]s need to belong to this new editor group we just defined, like so:

Code: Select all

[terrain_type]
    symbol_image=dark_tile1
    id=DarkTiles
    name="Dark Tiles"
    #char=%
    string=Ryd
    aliasof=Rr
    editor_group=utbs # this is an UtBS terrain, so it belongs to its editor group
[/terrain_type]
Mainline campaigns in 1.5 having custom terrains (UtBS, DiD) already do this, so you should see editor groups for them in the editor.


EDIT:
Starting in 1.9 you will have three different group icons to choose from for your custom terrains to show up under in the editor. This should help make it easier to remember which little button to push, if you have multiple add-ons installed.
  • icon="group_custom" -- will give you a green icon
    icon="group_custom2" -- will give you a red icon
    icon="group_custom3" -- will give you a blue icon
-- eleazar

User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: How to make custom terrains available in the map editor

Post by Zachron »

So that means, I could now, theoretically create a cave terrain that consists of a crack with smoke coming out of it, and call it "Smoking Crack," then make it available in the map editor... Now I'm definitely getting 1.5.
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/

opensourcejunkie
Posts: 547
Joined: August 11th, 2008, 3:19 pm

Re: How to make custom terrains available in the map editor

Post by opensourcejunkie »

Zachron wrote:So that means, I could now, theoretically create a cave terrain that consists of a crack with smoke coming out of it, and call it "Smoking Crack," then make it available in the map editor... Now I'm definitely getting 1.5.
:-D

Yeah, 1.5 is sounding really great - I can't wait 'till it goes stable. This feature especially, 'cause it's been a bear editing the map text files :)

--OSJ
what if the Bible's claims about Christ depicted accurate, verifiable history? given some research, you might be surprised at the evidence...

User avatar
Mica
Posts: 577
Joined: December 4th, 2007, 5:18 pm

Re: How to make custom terrains available in the map editor

Post by Mica »

You can do something incredibly similar in 1.4 as well, but I'm not sure (haven't tried, or even tried to figure out if it could work) about multiplayer.
Mica says one who cheats, cheats himself.

You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: How to make custom terrains available in the map editor

Post by Mabuse »

to edit custom terrain in map-editor i just modify the core files in 1.4.x ;),

sure, not everybody does know how to edit the core files, and so not everybody can view your maps in the editor, but who cares anyway.

as long you know what goes where you wont have a problem



sure:
the feature is nice, but you can also edit custom terrain in map-editor in 1.4
Last edited by Mabuse on August 27th, 2008, 10:15 pm, edited 1 time in total.
The best bet is your own, good Taste.

User avatar
Mica
Posts: 577
Joined: December 4th, 2007, 5:18 pm

Re: How to make custom terrains available in the map editor

Post by Mica »

Actually they can, at least in single player as far as I know. Both IftU and my campaign TCoaDQ use custom terrains, and no one has to edit their core editor file.
Mica says one who cheats, cheats himself.

You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: How to make custom terrains available in the map editor

Post by Mabuse »

nope. :lol2:

simply nope.
i cant for example look at your dravinius2 map in the map-editor

it doesnt matter if single or multiplayer, the map-editor just loads the core-files, it doesnt matter what you have in the userdata/data/campaigns folder

in 1.4.

EDIT: same goes for IftU-Maps (of course). Maps with custom terrain cant be loaded in Editor
The best bet is your own, good Taste.

User avatar
Mica
Posts: 577
Joined: December 4th, 2007, 5:18 pm

Re: How to make custom terrains available in the map editor

Post by Mica »

I'm not talking about in editor - I'm talking about in game. On MP, if you use a custom terrain, from what I've seen, it just says "error" and you can't play.

You can at least play our maps ;)

Besides, why do you need to look in the map editor? :P
Mica says one who cheats, cheats himself.

You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: How to make custom terrains available in the map editor

Post by Mabuse »

??

:!: The subject of this Thread is to make terrain available in the map Editor. :!:

also all the comments before you wrote
You can do something incredibly similar in 1.4 as well,
were all directed about editing maps in editor.


and in multiplayer it works the same way as in singleplayer. sure you can play maps with custom terrain in multiplayer. everybody need to have the files though.

its the same with units, you can also have custom units in multiplayer ;)


and why somone would like to have custom terrain in editor:
to edit maps with custom terrain in editor :P
The best bet is your own, good Taste.

User avatar
Mica
Posts: 577
Joined: December 4th, 2007, 5:18 pm

Re: How to make custom terrains available in the map editor

Post by Mica »

But I was trying to host the map, and it said Error under the map preview. ;) So I couldn't even get in game.

Yes I know, I was talking about the map editor then as well, because either way you have to edit the editor.cfg file.

but anyways, I was just saying you could add in custom terrain to 1.4 as well at first. :P
Mica says one who cheats, cheats himself.

You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: How to make custom terrains available in the map editor

Post by Mabuse »

Mica wrote:But I was trying to host the map, and it said Error under the map preview. ;) So I couldn't even get in game.
then i have a hot tip for you:
you must load the files if mutiplayer is defined
Mica wrote: Yes I know, I was talking about the map editor then as well, because either way you have to edit the editor.cfg file.
editor.cfg ?
what is this for i file, i dont know it

i just know editor-groups, but that has also nothing to do with the terrain itself, it just defines the groups which are shown in the editor.

and no, you dont have to edit it. :)

EDIT:
ah, i have found editor.cfg. this file has even less to do with terrain than editor-groups (which, at least defines the groups under which the terrain is shown).
there is also no need to edit this file.
Mica wrote: but anyways, I was just saying you could add in custom terrain to 1.4 as well at first. :P
nope you didnt. :P
maybe in this thread, but that you can edit custom terrin in 1.4 was quite known anyway ;)
The best bet is your own, good Taste.

User avatar
Mica
Posts: 577
Joined: December 4th, 2007, 5:18 pm

Re: How to make custom terrains available in the map editor

Post by Mica »

Not really known, many people don't know how, and don't/didn't know you could do it.

At first I was just saying that you can do it in 1.4.

By editor.cfg, I meant main.cfg. Sorry, I was mixed up. ;)
Mica says one who cheats, cheats himself.

You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: How to make custom terrains available in the map editor

Post by AI »

You can make it show up in the editor by including the needed parts wrapped in #ifdef EDITOR.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: How to make custom terrains available in the map editor

Post by Mabuse »

...in 1.5
The best bet is your own, good Taste.

User avatar
Ken_Oh
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: How to make custom terrains available in the map editor

Post by Ken_Oh »

FYI, I tried this and I didn't get it to work until I added @ to the paths, i.e. {campaigns/campaign_name/utils/terrain.cfg} into {@campaigns/campaign_name/utils/terrain.cfg}.

I still don't know what @ means.

Post Reply