Jump to content

Recommended Posts

Posted

Hello people,

I tried to dissasemble Dune2.exe to get its map seed generator.

I converted about 1000 ASM lines to Pascal, then MrFlibble, posted C++ code which already does most things (see his posts below). So I took the C++ code and FINISHED IT.

My modifications:

* Generating spice fields

* Fixed tiles converting via "ICON.MAP"

Usage:

SEED2MAP.exe <seed> <name>

The generator creates map using <seed>, prints the map on standard output and then creates binary file <name> with indexes of tiles in the file "icon.icn".

Source code included.

This means now we have FULL map generator which is exactly same as in Dune2.

No more "seed revealing" or "savegame map extracting", this code generates whole map from one seed number.

ENJOY!

Dune2MapGen.zip

  • Upvote 2
Posted

wasnt able to get it working :(

JPEXS Dune II Map generator BETA 1

Runtime error 002 at 0000:0041.

no matter what parameters i tried, also tried under dosbox/winxp with same error (running win2k8 here)

there should be enough talent around these forums to rewrite dune2 exactly by now ;)

Posted

This error looks like file "mem.bin" is not found.

Make sure you have file "mem.bin" in directory you are running the program from.

In "mem.bin" there is some data from original EXE used for map generating.

Posted

I did a little modification now - you can download BETA1a (updated link in first post).

Please let me know if it still does not work.

I am running in in WinXP Prof. no matter it's in DOSBox or not.

Posted

I tried to dissasemble Dune2.exe to get its map seed generator.

I was partially successfull.

I can create map from seed number. My generated map is currently array[64x64] of hexa (0-F)

Are you aware C++ code for that exists already?

Posted

Yes, there is code already. But AFAIK that is ASM taken from the Amiga version and could not generate spice fields and such. I'll check this one out, see if it is any different.

Hey Stefan,

Long time no see!

Yes, unfortunately spice fields were still missing. It'd be nice if that could be solved.

Posted

Are you aware C++ code for that exists already?

I do not know about any C++ code for it.

Does exist code for generating whole map including spice fields? I think not.

As I said: I have parsed only first 700 lines of ASM code of generating map.

Whole method for generating map has about 2200 lines.

In the remaining 1500 ASM lines, there is surely generation of spice fields, so maybe sometime in the future I will finish it.

Posted

Does exist code for generating whole map including spice fields? I think not.

I think only the spice fields are missing.

Posted

I think only the spice fields are missing.

Yes, I remember testing that one, the map is 100% accurate except for the spice. From what I could find out, the spice is then imposed on the map, and wherever there is clear sand in the area where spice is positioned, there will be spice sand, and if other terrain types occur (dunes, rock), they get converted into spice dunes. But I'm not 100% sure about that.

Posted

"all we need" is probably me to finish the rest of code to produce spice fields:-).

I am working on it, so stay tuned ;-).

I think I can then create some program to convert the map to image, it will be the easiest part.

Posted

OK, for anyone interested, here's the old seed map generator (with source). I think Olaf wrote it, but then again, I might be wrong about it :)

Are you referring to the "fields" keyword where fields of spice are 'generated' on the given cells?

No, I was referring to the spice fields that are generated from the seed number along with other terrain. Those are missing from the maps. BTW, the difference between the two types of spice fields is in that the additional ones placed by the "Field=" method seem to never have spice dunes, only spice sand. If a part of the additional spice filed comes on some terrain other than sand, this terrain is not altered. By contrast, as I posted above, the "innate" spice fields on the map convert any originally non-sand terrain into spice dunes.

Wasn't the current map generator also missing dunes?

AFAIK not, the dunes are there (if you meant regular dunes and not spice dunes, that is :))

dune2_seed_generator.zip

Posted

OK, for anyone interested, here's the old seed map generator (with source).

Wow, thank you very much for posting this!

It's nice commented code. Finally I know names of methods which I was programming :-).

Accordingly to this source, my generator in version Beta1a finishes after method "spreadMatrix". After releasing Beta1a, I wrote "balanceMap" and "createRegions"... This means I am currently somewhere before "scanRegions". And there should be some function to add spice.

I will try to parse it...

Posted

I tested it very quick; the text output is not the same as the .map data, is that correct?

It looked like a Dunedit / D2TM / etc compatible format. So i was pretty excited :)

edit: Looks like it is not, I've checked the code, and saw this:


void printMap(struct cell map[64][64])
{
  short x, y;

  for (y = 0; y < 64; y++)
  {
      for (x = 0; x < 64; x++)
      {
switch (map[y][x].w)
{
case 0:
putchar('.'); break;
case 2:
putchar(':'); break;
case 4:
putchar('@'); break;
case 6:
putchar('*'); break;
case 8:
putchar('-'); break;
case 9:
putchar('+'); break;
}
      }
      putchar('n');
  }
}

I was wondering if anyone could tell me what the numbers in the switch are, ie is 0 sand?

Posted

Method printMap prints map on the screen. Constants near 'case' are defined at the top of "SEED.C" file. (#define SAND 0, define DUNES 2,...)

The second commandline parameter is name of file for map with tiles.

The output file is binary - 64x64 raw data. Each byte is index of tile image from icons.icn.

(See http://www.junkyard.dk/icon_map.asp)

Posted

Method printMap prints map on the screen. Constants near 'case' are defined at the top of "SEED.C" file. (#define SAND 0, define DUNES 2,...)

Ah, did not see that (i really did a quick check), thanks!

BTW, the Doon Lunacy/Dune Legacy team seem to have implemented the map generator in their project quite some time ago Smiley The latest release of Dune Legacy does not require "extracted" maps to run.

Is that including spice? I thought it was without it.

Posted

Is that including spice? I thought it was without it.

I meant they wrote their own seed map generator that works: spice, spice dunes and everything are where they should be, and all missions are playable without the need for a seed map pack.

Their seed generator code should be found in the Dune Legacy source.

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.