:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::

Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Mon Jul 13, 2020 11:32 am
All times are UTC + 0
 Forum index » Modding Central » C&C: Remastered Collection Editing Forums
I figured out how to add new map tiles to the game
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [15 Posts] View previous topic :: View next topic
Author Message
jonwil
Disk Thrower


Joined: 24 Jul 2005

PostPosted: Mon Jun 08, 2020 2:15 am    Post subject:  I figured out how to add new map tiles to the game Reply with quote

As you can see from the attached image, I figured out how to add new map tiles to the game.
Because the map editor currently has a hardcoded list of map tiles (and probably also wouldn't read data from mods anyway I suspect) I had to manually hex edit the .bin file for the map but otherwise its currently working.

What I did to add new map tiles to the game was:
1.Create art for the map tile (or in this case copy it from elsewhere Smile
2.Add a new entry to the theater xml file (TD_TERRAIN_DESERT.XML in my case) that points at the new map tile.
3.Add a new TemplateTypeClass definition to cdata.cpp with the appropriate data
4.Add the new tile to the end TemplateTypeClass::Pointers array in cdata.cpp
5.Add the new tile to the end of the TemplateType enum in defines.h
6.Place the TD_TERRAIN_DEFINITION.XML, map tile file and TiberianDawn.dll in the correct locations in a test mod
7.Grab a map and hex edit the .bin file so it points at the new tile
8.Go in-game, activate the mod then play skirmish on the map.
and 9.Watch as my new map tile appeared in game and worked correctly.

So the only remaining limitation is that you can't place your new tiles in the editor.

I DID however discover that it is 100% NOT possible to add a totally new theater to the game (even ignoring the editor).

Of course with map tile IDs being limited to a single byte in TD (it can only go from 0 to 255) you are limited in how many new map tiles you can add to the game (red alert upgraded that limit to 2 bytes)


template.png
 Description:
 Filesize:  263.28 KB
 Viewed:  680 Time(s)

template.png



Back to top
View user's profile Send private message
Banshee
Supreme Banshee


Joined: 15 Aug 2002
Location: Brazil

PostPosted: Mon Jun 08, 2020 3:25 am    Post subject: Reply with quote

The editor uses the existing DLL files, so it might be possible that we may need to add something in the source code to make it recognize the new terrain tiles.

At DEFINES.H, there are lists of TerrainType, SmudgeType, OverlayType, and TemplateType. I believe in this case it seems to be TemplateType, where you would need to add something.

Then, in CDATA.CPP, you need to add your template as a static TemplateTypeClass const, like the sample below:

Code:
static TemplateTypeClass const Slope25(
   TEMPLATE_SLOPE25,
   THEATERF_WINTER|THEATERF_DESERT|THEATERF_TEMPERATE,
   "S25",
   TXT_SLOPE,
   LAND_ROCK,
   2,2,
   LAND_ROCK,
   NULL
);



I don't know if anything else is required in terms of DLL file.

Back to top
View user's profile Send private message Visit poster's website Skype Account
jonwil
Disk Thrower


Joined: 24 Jul 2005

PostPosted: Mon Jun 08, 2020 4:28 am    Post subject: Reply with quote

Despite what the source code (and DLLIntefaceEditor.cpp in particular) would lead you to believe, the map editor for the remasters does not load either TiberianDawn.dll or RedAlert.dll at all. Its a .NET application so you can decompile it and poke around and if you look at MobiusEditor.TiberianDawn.TemplateTypes and MobiusEditor.RedAlert.TemplateTypes you can see exactly where its all hardcoded.

Back to top
View user's profile Send private message
jonwil
Disk Thrower


Joined: 24 Jul 2005

PostPosted: Mon Jun 08, 2020 6:22 am    Post subject: Reply with quote

Having studied the map editor internals a bit more, I see nothing that would prevent the map editor from being modified (either by Petroglyph or by some clever hacker who knows a lot more than I do about how to decompile and modify .NET applications) so that it would read all the data it needs (for buildings, infantry, overlays, smudges, templates, terrain and units) from a file (probably XML given that its used everywhere else) rather than being hardcoded.

I did try some VERY clever hex editing (the sort I wouldn't recommend anyone who doesn't know what they are doing try) on a copy of the map editor (since I didn't want to mess up the original exe) and was able to get it to display my new tile in-editor and place it on a map (and have the resulting map work in-game) so other than the hardcoded list of map tiles, there appears to be nothing standing in the way of being able to place new map tiles in the editor...

Back to top
View user's profile Send private message
Iran
Pyro Sniper


Joined: 23 Mar 2011

PostPosted: Mon Jun 08, 2020 7:01 am    Post subject: Reply with quote

You can decompile the complete code into a C# project by using dotPeek.

You can also enable the internal map editor.

Back to top
View user's profile Send private message
jonwil
Disk Thrower


Joined: 24 Jul 2005

PostPosted: Mon Jun 08, 2020 7:25 am    Post subject: Reply with quote

I have tried all kinds of .NET decompilers and none will decompile into something that I can then recompile. All of them produce errors when I try to recompile the output.

And its great that people are working on making the code compile standalone and turning on the internal map editor and stuff but this is the "C&C Remastered Collection Editing Forums" and not the "Original C&C Editing Forums" and those of us here need the remastered map editor (or a new editor written for the remasters and drawing using remaster graphics) rather than one written for the original game.

Back to top
View user's profile Send private message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Wed Jun 10, 2020 3:32 pm    Post subject: Re: I figured out how to add new map tiles to the game Reply with quote

jonwil wrote:
I DID however discover that it is 100% NOT possible to add a totally new theater to the game (even ignoring the editor).

Um. I pulled that off in C&C95 and it honestly wasn't hard at all...

In fact, Jungle theater should still be in the game. You just have to go over the tilesets and terrain items to make sure they are usable in the new theater, since all these things have an "ownership", just like stuff you can build in-game has house ownership flags.

So is the issue the GlyphX side then? What exactly doesn't work for a new theater?

jonwil wrote:
and those of us here need the remastered map editor (or a new editor written for the remasters and drawing using remaster graphics) rather than one written for the original game.

Why? The map format is 100% the same, and doesn't include graphics.
_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Banshee
Supreme Banshee


Joined: 15 Aug 2002
Location: Brazil

PostPosted: Wed Jun 10, 2020 7:13 pm    Post subject: Reply with quote

Quote:
Why? The map format is 100% the same, and doesn't include graphics.


I need a different map editor because the current one requires NET Framework 4.7.2 and I don't want to update my old version of Windows 10 because I don't trust the direction that Microsoft takes their operation system into, neither its automatic testing methods. I'm stuck to Net Framework 4.6.2 here.

Back to top
View user's profile Send private message Visit poster's website Skype Account
Blade
Cyborg Commando


Joined: 23 Dec 2003

PostPosted: Mon Jun 15, 2020 1:05 pm    Post subject: Reply with quote

I agree with Nyerguds, although it would be nice if there was an editor which used the remaster assets, its not a deal breaker since the formats are all still the same and mods will still need to produce low res assets to support that view in the remasters anyhow.

Back to top
View user's profile Send private message
Reaperrr
Commander


Joined: 26 Apr 2003
Location: Somewhere in Germany

PostPosted: Mon Jun 15, 2020 9:13 pm    Post subject: Reply with quote

Blade wrote:
and mods will still need to produce low res assets to support that view in the remasters anyhow.

Well, for Snow we can just use the 1.06c assets, and for something like Jungle I'd honestly just copy-paste Temperate and modify the terrain-specific palette until the result looks remotely acceptable.

Back to top
View user's profile Send private message Send e-mail
JackYsback
Medic


Joined: 06 Jun 2020
Location: Jausiers, Alps, France

PostPosted: Mon Jun 15, 2020 11:39 pm    Post subject: Reply with quote

So basically with copy/paste, i could change tilesets and make spice and other tilesets for dune mod ?
_________________

Back to top
View user's profile Send private message
Reaperrr
Commander


Joined: 26 Apr 2003
Location: Somewhere in Germany

PostPosted: Sun Jun 28, 2020 1:35 pm    Post subject: Re: I figured out how to add new map tiles to the game Reply with quote

Nyerguds wrote:

So is the issue the GlyphX side then? What exactly doesn't work for a new theater?

In my case I tried adding snow terrain to TD, but the remaster tileset completely falls back to temperate terrain, and ignores my snow tileset xmls.
Your snow.mix works flawlessly in legacy graphics mode, so the issue isn't on the dll side, I think (I triple-checked every possible place in the DLL code anyway).

I did list my TD_TERRAIN_SNOW.XML in TERRAINS.XML, and I also made sure the .DDS files work and are in the correct location by modifying TD_TERRAIN_WINTER.XML to load the snow files, which works fine, too.
For the record, my snow xml is just a renamed duplicate of the above modified winter xml, so it's not missing entries or anything of that sort. If the engine was loading it, it should work just as well as the winter one does.

But the GlyphX side still seems to ignore my added xml and just falls back to the TEMPERATE one. I scanned the entire CONFIG.MEG for winter entries to be sure I didn't forget anything, but found nothing else that would need changes at the xml side.
Currently at a loss here.

Back to top
View user's profile Send private message Send e-mail
jonwil
Disk Thrower


Joined: 24 Jul 2005

PostPosted: Mon Jun 29, 2020 7:09 am    Post subject: Reply with quote

If you look at the tileset XMLs, you can see a TilesetTypeClass entry with a name such as Common_Misc or RA_VFX or TD_Terrain_Desert.

The GlyphX engine (though some means I dont have any idea about) appears to have logic that determines (based on the game and the theater) exactly which of these tilesets to load.

Since the game has no knowledge of your new tileset (say, TD_Terrain_Snow or whatever you have called it) it wont load that tileset into the list of tilesets it uses when searching for a tile (template, terrain, overlay, building etc) to draw.

Back to top
View user's profile Send private message
Zealous666
Civilian


Joined: 05 Jul 2020

PostPosted: Sun Jul 05, 2020 11:14 am    Post subject: Re: I figured out how to add new map tiles to the game Reply with quote

Nyerguds wrote:
jonwil wrote:
I DID however discover that it is 100% NOT possible to add a totally new theater to the game (even ignoring the editor).

Um. I pulled that off in C&C95 and it honestly wasn't hard at all...

In fact, Jungle theater should still be in the game. You just have to go over the tilesets and terrain items to make sure they are usable in the new theater, since all these things have an "ownership", just like stuff you can build in-game has house ownership flags.


Came here to hijjack this a little bit. Struggle in adding a new theater in RA Remaster right now. Planning to port the TD Deserts to RA. For test-purposes im working witht he snow tilesets so I dont have to change the templates.

What I did so far:
- added THEATER_DESERT in Defines.H and the define THEATERF_DESERT
- enlarged all TEMPERATE/SNOW templates in CDATA.CPP with THEATERF_DESERT (and some in TDATA.CPP too)
- extraced the snow tilesets and moved em in the correction folder
- created RA_TERRAIN_DESERT.xml based on the snow variant
- linked it in TILESETS.XML
- changed the map information with "DESERT" in map file and JSON via notepad++
- and finally, the bummer, added following in the CONST.CPP: {"DESERT","DESERT","DES"},

While compiling is no issue, as long as the CONST.CPP entry is added, the map will crash on load. So I believe, I miss something the const.cpp is refering to. And without the const.cpp the map will load correctly but the map will fall-back to TEMPERATE since it cant find any DESERT stuff (cause the const isnt added).

Does anybody have a clue what I'm missing here?

Back to top
View user's profile Send private message
jonwil
Disk Thrower


Joined: 24 Jul 2005

PostPosted: Mon Jul 06, 2020 6:42 am    Post subject: Reply with quote

As has been said before, there are limitations in the GlyphX code that prevent adding new tilesets to the game.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [15 Posts] View previous topic :: View next topic
 Forum index » Modding Central » C&C: Remastered Collection Editing Forums
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.3942s ][ Queries: 13 (0.0362s) ][ Debug on ]