Jump to content

How would you implement the D2 seed map generator?


Recommended Posts

Posted

I've heard that Dune 2's seed generator has been reverse engineered. My searching between Calculus and frantic programming sessions hasn't turned up any useful info other than DuneMaps and OpenDune both using them. Are there any relevant topics about how this was done and how to implement them? Thanks in advance.

  • Upvote 1
Posted

Well, I found a thread about the actual map generator here

http://forum.dune2k.com/smf.php?showtopic=20344

As the first post says, it already outputs as indexes of the terrain & buildings graphics file, so all you need to do is make it get those images from the icon.icn file.

Info on icon.icn can be found here

Full overview of the tiles:

http://www.dune2.dk/icon_map.asp

Editor for icon.icn, which undoubtedly contains source code to open the graphics:

http://www.dune2.dk/d2te/

The research behind the format seems to be in here:

http://forum.dune2k.com/index.php?/topic/19099-dune-2-format80-decompression/

  • Upvote 1
Posted

Both were done through reverse engineering and rewriting of the disassembly back into C code, many man hours spent... lol

however,

http://dunemaps.svn.sourceforge.net/viewvc/dunemaps/head/src/dune/engine/mapGenerator.cpp?revision=15&view=markup

is the file you want to start with, altho it wont work by itself as it relies on other classes to obtain some of the original resources (outta the original exe)

if you removed the generateToTiles function it will output the terrain type instead of dune2 icons

  • Upvote 1
Posted

So what's the project you're working on (if it ain't no secret, that is ;))?

There's still an chance something could go horribly wrong with it, so I'm keeping it secret from the main CnC community. So note that this is sort of an open secret. Essentially, I want to create a zlib Westwood-style RTS engine. To test it out, I'm making "mods" for the engine. CnC, RA, D2, and hopefully Dune 2k (as you know, it's formats are pure craziness). Funnily enough, the format Seed2Map outputs is Index-NullByte. TD's format is InternalIndex-Frame. Essentially, I chopped up the Desert theater into files named "0_0.png" to "255_0.png". Instead of creating a new format, I can just name the first image "0_0.png" and so on. Theoretically, I could also convert the Dune desert into a CnC theater and make it so I can play horribly butchered versions of Dune 2 missions in CnC, but that's a little silly.

The main problems I've run into is that no one knows the formulas for where weapons hit (essential for TD game balance; I assume not so much for RA, since we'd actually have information on those numbers if it were in that game), no one knows how to open r16 files (I now have them extracted thanks to total commander and gaup, search the forums for "german uncensor howto"), I don't know what all the Dune 2000 buildings/units look like or what images go to what (can someone help me with that? I'll upload the images), I keep programming myself into the ground, Dune 2000 makes no sense, and I keep making simple screwups. By Dune 2000 makes no sense, I mean 1.) stupid formats compared to RA, and 2.) it looks like this on my copy of Windows 7. Note that it is in compatibility mode for Windows 95.

Dune 2000 graphics are here. Use Irfanview if you lack something to view TGA files.

  • Upvote 1
Posted

Sounds like a big project. Hope you'll get something running soon (and something to show :)). So what is the plan? Do you start with one game / mod and expand later on? What is the first mod you want to get working?

Btw, I did take alook at the d2k graphics. Nice! But I did not find any unit with all facing directions? Is that hidden somewhere else?

  • Upvote 1
Posted

Sounds like a big project. Hope you'll get something running soon (and something to show :)). So what is the plan? Do you start with one game / mod and expand later on? What is the first mod you want to get working?

Btw, I did take alook at the d2k graphics. Nice! But I did not find any unit with all facing directions? Is that hidden somewhere else?

I'm using Game Maker, so I've got it running. GM is pretty good for Rapid Application Development. It only shows CnC's units and overlays at the moment, though. I'm probably going to require the graphics to be pre-remapped and make a program that remaps the graphics automatically. Because I really do not want to have to write unit/building/infantry/aircraft/naval remap code (also, it'd make the maps slower to load). I haven't even got movement yet...

Right now, I'm mainly focusing on CnC and Dune 2. CnC because it's my favorite game, and Dune 2 because the formats are similar enough (I expect reading scen[side][num].ini files will be extremely easy with the exception of team types and any other ini key that uses arbitrary text rather than numbers). I'm probably going to make my version of Dune 2 (TD and RA focus on being as close as possible, D2 will admittedly be less spot-on) have a tilesize of 64x64 and use Dune 2000 tiles to make the equivalent Dune 2 tiles (unless Dune 2000's tiles are a lot different than CnC's, in which case 1 tile would work).

As far as Dune 2k goes, I'm going to try and get it running (I'm running Windows 7). When I finish that, I'll see if the units actually have more than 1 frame of animation.

As you guys here are Dune fans, I'd appreciate your ideas on Dune clones (or a link to relevant questions). Also, what are the main control schemes that should be supported?

Posted

There's still an chance something could go horribly wrong with it, so I'm keeping it secret from the main CnC community. So note that this is sort of an open secret. Essentially, I want to create a zlib Westwood-style RTS engine. To test it out, I'm making "mods" for the engine. CnC, RA, D2, and hopefully Dune 2k (as you know, it's formats are pure craziness). Funnily enough, the format Seed2Map outputs is Index-NullByte. TD's format is InternalIndex-Frame. Essentially, I chopped up the Desert theater into files named "0_0.png" to "255_0.png". Instead of creating a new format, I can just name the first image "0_0.png" and so on. Theoretically, I could also convert the Dune desert into a CnC theater and make it so I can play horribly butchered versions of Dune 2 missions in CnC, but that's a little silly.

Hmm... there's one big problem with that... namely, if you'd try actually putting that on C&C you'd see that terrain type rules are all stored in the exe in C&C95, and fixed for one tile across all theaters. also, in RA, the terrain types are somehow saved for each cell into the actual terrain file, but no one ever researched how that worked to the point of making a working converter that supports that.

Oh, also, you can't just make 0 to 255, since the game can only load the tiles that are actually linked to a file name :P

  • Upvote 1
Posted

That's great news. I abandoned GM somewhere version 6. Flickering, slow downs... Well I am not a programmer. Seems you know what you are doing. Good luck.

A question of a noob: Chopping the graphics to so many files doesn't slow down loading?

  • Upvote 1
Posted

Hmm... there's one big problem with that... namely, if you'd try actually putting that on C&C you'd see that terrain type rules are all stored in the exe in C&C95, and fixed for one tile across all theaters. also, in RA, the terrain types are somehow saved for each cell into the actual terrain file, but no one ever researched how that worked to the point of making a working converter that supports that.

Oh, also, you can't just make 0 to 255, since the game can only load the tiles that are actually linked to a file name :P

I could make a converter real easily by finding a tile/frame combo with the setting I want, putting the graphic there, and making a converter that takes a dune generated map and converts it to my new CnCMeetsDune tile format. The main problem would be that I have no clue how to edit .tmp files and Dune 2's theater is 16x16.

That's great news. I abandoned GM somewhere version 6. Flickering, slow downs... Well I am not a programmer. Seems you know what you are doing. Good luck.

Game Maker has always run well on all of my systems (even the one that literally burnt out). Of course, 6 broke after I installed 7, and 7's SoftWrap BS made it literally unusable. 8 doesn't suck, however, so I use 8 if I need to use an extension, and 5 otherwise.

Though I am planning on moving development to C++... Speed increases, less hacky methods for remaps, the fact I've already gotten some experience working on this thing from the GM version, etc...

A question of a noob: Chopping the graphics to so many files doesn't slow down loading?

It depends on the map. Worst case scenario, it has to load 4096 995 separate tiles. Best case, 16 tiles (Either the default blank map, for a 255_0 blanked map). It loads real maps much better than the test maps with every tile on them. I load only the tiles needed, so I can load up a blank map when testing other things.

  • Upvote 1
Posted

Has anyone ever made a tool of the type 'seed to png', actually?

I could make a Map2PNG tool, and hopefully GM has some sort of way to silently call a program in the background and wait until it's done. I'll try it out when I get the Dune 2 theater tiles together (which will probably be when I'm done trying to get VS6 SP6 to work on Windows 7. No VS6 products installed? BS!).

  • Upvote 1
Posted

Why on earth are you messing around with Visual Studio 6 when the latest is Visual Studio 10?

Half Life. Also, I'm trying to see if I can get 2008 working.

Oh, and here's Map2PNG.

353_Mini.png

Download

That was pretty fun to put together.

EDIT: Unfortunately, the book I'm using, "Programming a Strategy Game with DirectX 9", is designed to work with, well, DirectX. Anyone here ever used DirectX? Then you'll know how quickly the SDK changes. I don't feel like messing with it any more; I'm going to use the meat of the book, but change all of the DirectX stuff to either OpenGL or Allegro. Can someone suggest which one to use? These are the main points I'm looking at:

  • 3D Accelerated (That is, I can draw sprites on the screen as polygons and use 3D graphics cards to speed up the 2D scene)
  • Ease of use.
  • Who here could I ask for help with it?

  • Upvote 1
Posted

Awesome :D

[edit]

Hmm, its preview only shows a corner though. Ah well, it works :P

Half of my projects are literally just the last project I worked on, only reporpused. In this case, this went from CnC Remake -> CnC Map Editor -> Luftballon -> Desert Fox -> Map2PNG (and now -> Dune2CnC). As such, you can scroll the map using the arrow keys.

Speaking of Dune2CnC, how do I make CnC1 .tmp (or in this case, .jun) files?

Download - Note: This only converts the terrain (Including the Spice/Tiberium); later versions will hopefully convert infantry and bases. (Nyerguds, wasn't there a way to disable bibs with an ini flag, or am I going to need to hack the executable?)

353DuneTo_Mini.png

353CnC_Mini.png

Nyerguds, is there any problem with using up to the 255th frame of a .tem file?

  • Upvote 1
Posted

Well for your test previews, I advise using tile BA 04 for the sand. Much better effect ;)

Half of my projects are literally just the last project I worked on, only repurposed. In this case, this went from CnC Remake -> CnC Map Editor -> Luftballon -> Desert Fox -> Map2PNG (and now -> Dune2CnC). As such, you can scroll the map using the arrow keys.

Ahh, okay ;)

Speaking of Dune2CnC, how do I make CnC1 .tmp (or in this case, .jun) files?

You'll need pcx2tmp for that, from the Mix Manager pack.

http://nyerguds.arsaneus-design.com/tools/old/mman351.zip

I can give you the overview on the original tiles' configurations, by the way...

http://nyerguds.arsaneus-design.com/cnc95upd/inirules/tilesets.ini

It seems none of the original tiles use beach as primary type though, which is a pity, since you could've used those as sand. Beach is passable but unbuildable. Though, not sure if tiberium can grow on it though :P

Download - Note: This only converts the terrain (Including the Spice/Tiberium); later versions will hopefully convert infantry and bases. (Nyerguds, wasn't there a way to disable bibs with an ini flag, or am I going to need to hack the executable?)

Sorry, I haven't gotten around to implementing the rules.ini system yet, and when I do, units are first anyway.

The easiest way to edit the exe is by using UGE:

http://nyerguds.arsaneus-design.com/tools/cnc95uge_beta.zip

Nyerguds, is there any problem with using up to the 255th frame of a .tem file?

Uh, I never really stress tested the tile numbers, but I don't think so. XCC Mixer overflows on tileset files with too many tiles though, and the current release version of the XCC Editor won't read tileset files beyond their original frames.

PS: Been looking through your folders there, and I couldn't help but notice this...

http://luftballon.cnc-comm.com/junk/Random.png

That last one is just the MCV's name; it's not an option. :P

Also, since MCV undeploy exists, "mobile construction yards" technically already exist in C&C1 anyway :P

  • Upvote 1
Posted

Well for your test previews, I advise using tile BA 04 for the sand. Much better effect ;)

I'm actually using the Jungle theater there, and XCC Editor defaults to Temprate.

You'll need pcx2tmp for that, from the Mix Manager pack.

http://nyerguds.arsaneus-design.com/tools/old/mman351.zip

Thanks.

I can give you the overview on the original tiles' configurations, by the way...

http://nyerguds.arsaneus-design.com/cnc95upd/inirules/tilesets.ini

I used that to create a list of things I could use for beach. Then I realized I only needed one tile for beach.

It seems none of the original tiles use beach as primary type though, which is a pity, since you could've used those as sand. Beach is passable but unbuildable. Though, not sure if tiberium can grow on it though :P

That might kill the mod right there.

Sorry, I haven't gotten around to implementing the rules.ini system yet, and when I do, units are first anyway.

The easiest way to edit the exe is by using UGE:

http://nyerguds.arsaneus-design.com/tools/cnc95uge_beta.zip

Uh, I never really stress tested the tile numbers, but I don't think so. XCC Mixer overflows on tileset files with too many tiles though, and the current release version of the XCC Editor won't read tileset files beyond their original frames.

Luckily, I don't have to worry about XCC Editor.

PS: Been looking through your folders there, and I couldn't help but notice this...

http://luftballon.cnc-comm.com/junk/Random.png

That last one is just the MCV's name; it's not an option. :P

Also, since MCV undeploy exists, "mobile construction yards" technically already exist in C&C1 anyway :P

Time%20Paradox.png

By stupid, I mean they should have checked to see if that mode was enabled, or else just set it to "Construction Yard". Unless they already check; I don't think I've ever actually used the ToolTips that pop up in TD. Everything was always labeled Civilian or Enemy Unit/Structure, and I didn't know about TrueNames back then.

Wait, the MCV's name? That would make a lot more sense, but... MCV = Mobile Construction Yard? ...

Logic? This! Is! Westwood!

  • Upvote 1
Posted

Sometimes I think that "Mobile Construction Yard" is kinda more logical. "Mobile Construction Vehicle" seems like a good candidate for the Department Of Redundancy Department :laugh:

BTW, in the old (official) demo of Dune 2, the full name for the Harvester unit (the one that appears on the production/CHOAM screen) is "Mobile Spice Harvester".

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.