Jump to content

Welcome to FED2k Discussion
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

[Dune 2] Map generator


  • Please log in to reply
37 replies to this topic

#1
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts
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!

Attached Files



#2
segra

segra

    Desert Warrior

  • Members
  • PipPipPipPip
  • 172 posts
  • LocationAustralia
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 ;)

#3
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts
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.

#4
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts
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.

#5
XTF

XTF

    Mentat

  • Fedaykin
  • PipPipPipPipPip
  • 404 posts

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?

#6
stefanhendriks

stefanhendriks

    Naib

  • FED2k Staff
  • PipPipPipPipPipPipPipPip
  • 1,764 posts
  • LocationPurmerend
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.

#7
XTF

XTF

    Mentat

  • Fedaykin
  • PipPipPipPipPip
  • 404 posts

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.

#8
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts

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.

#9
XTF

XTF

    Mentat

  • Fedaykin
  • PipPipPipPipPip
  • 404 posts

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

I think only the spice fields are missing.

#10
MrFlibble

MrFlibble

    Shai Hulud

  • Forum Staff
  • PipPipPipPipPipPipPipPipPip
  • 3,824 posts
  • LocationRussia

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.

#11
stefanhendriks

stefanhendriks

    Naib

  • FED2k Staff
  • PipPipPipPipPipPipPipPip
  • 1,764 posts
  • LocationPurmerend
Are you referring to the "fields" keyword where fields of spice are 'generated' on the given cells?

#12
Nyerguds

Nyerguds

    Fedaykin

  • Fedaykin
  • PipPipPipPipPipPipPip
  • 1,275 posts
  • LocationFlanders (Belgium)
Wasn't the current map generator also missing dunes?

#13
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts
I've added some progress information to the first post.

#14
Nyerguds

Nyerguds

    Fedaykin

  • Fedaykin
  • PipPipPipPipPipPipPip
  • 1,275 posts
  • LocationFlanders (Belgium)
Pretty neat... now all we need is a program to use the Dune graphics to convert these txt files to images

#15
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts
"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.

#16
MrFlibble

MrFlibble

    Shai Hulud

  • Forum Staff
  • PipPipPipPipPipPipPipPipPip
  • 3,824 posts
  • LocationRussia
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 :))

Attached Files



#17
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts

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...

#18
XTF

XTF

    Mentat

  • Fedaykin
  • PipPipPipPipPip
  • 404 posts

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 :)

You're wrong. ;)
I do have a modified copy of that code at http://xccu.svn.sour...109&view=markup though.

#19
jpexs

jpexs

    Sand Flea

  • Members
  • Pip
  • 10 posts
It's finished now, see first post and enjoy ;-)

#20
XTF

XTF

    Mentat

  • Fedaykin
  • PipPipPipPipPip
  • 404 posts
That sounds great, thanks a lot!