Jump to content

Experimentation Woes


Recommended Posts

So, I'm new here and all that, yadda yadda yadda.

I've been working on modifying Dune 2 to fit my own personal tastes - messing with the tech tree, changing what costs what and how fast it builds, changing where the IX Units are built from, and so on and so forth. I've noticed a few oddities, however.

1) If I try to edit Scenario.PAK directly to accommodate a Starport in lower tech levels, the game fails to go past the Bene Gesserit screens.

2) If the build time is set to 1, some funky things happen with structure costs - half of the cost gets lopped off (I haven't tried this out with Build Time 0 or 2 yet). Similarly, a Sonic Tank at Build Time 10 with cost 600 only deducts 500 when all is said and done. So far, using (tech+1)^2 build times combined with (tech)*100 build costs alleviates the cost oddness, but it does generate balance issues on early stages.

3) Changing structure sizes also produces weird graphical results - while functionality is never impaired, it's a little hard to distinguish a silo from a house of ix from an outpost when they all look like half-built structures. Likewise, changing the upgraded concrete from 2x2 to 3x3 produced weird results when trying to place the concrete - most of the time, the bottom level of concrete wouldn't place (and don't even bother changing regular concrete from 1x1 - it doesn't have the same adaptability that upgraded concrete has)

The specifics of the modifications I'm making are as follows:

This is to my personal tastes and preferences: I am changing the tech tree to better suit what I think makes sense. Some examples are requiring a Spice Silo before you can build Harvesters, as well as the chain of Windtrap -> Refinery -> Light -> Heavy -> Hi Tech -> Starport (Outpost has been removed from the Vehicle Factory chain, but Starport still requires it)

Sonic Tanks and Deviators are now built from Light Factory instead of Heavy Factory in order to increase the number of Launchers and Siege Tanks built by the AI on higher levels (in theory, at least)

Concrete is Fast and Cheap - 1x1 Concrete and 2x2 Concrete both cost 3 credits, with build times of 1 and 4 respectively; Similar speed and cost changes have been made to Wall, Turret, and Rocket Turret, but walls now consume 1 power per tile, and Standard Turret power use has been raised to 20.

Structure sizes will be changed based on function. All support structures would become 1x1 (except Refinery, which will probably have to stay at least 2x2 tall, and may even become 3x3), Barracks, WOR, and Light Factory will become 1x2; Heavy Factory will become 1x3; Hi Tech will become 2x2; and Palace, Construction Yard, Starport, and Repair Facility will all become/remain 3x3 structures. This will only happen once I learn how to adjust graphic size correctly, but I will modify the scenarios to accomidate the new sizes once I figure out how to change the CHOAM sections without breaking the file.

Ornithopter-using enemies will become much more deadly due to increased vision ranges of Outpost and Starport - Outpost now has vision 25, and Starport now has vision 250.

Miscellaneous unit changes: All units except for Devastator have full CPU outside of screen; Turret and Rocket Turret now have full CPU outside of screen (so no parking a Launcher or Sonic Tank outside of turret range and just filling the CPU Rebuild Queue with Turrets); Thopters are now controllable, and have Area Guard as a command option; Devastator speed decreased to 5, Health increased to 1000, now has rotating turret, turning speed increased to 2, is no longer picked up for repairs, move command replaced with Hunt, Guard replaced with Area Guard; Sonic Tank range decreased to 5, now fires twice, now sounds like a Worm attacking; Deviator no longer fires twice, but firing rate now matches Devastator and can now target air units.

Construction Yard can now be built from the Construction Yard; it requires a Palace to have been built, but it's cheaper and faster than building an MCV.

Snce the mod is based around my personal preferences and likely won't have many major overhauls to the actual scenarios, I'm not planning on publicly releasing it - though I may mail it to you if you really want to see what I like to play against. The only major change I would make to the scenarios at this point beyond Starport adjustments is replacing all Human Construction Yards with MCV's.

The main reason I'm posting this is to get my approved post, but also to see if I can get some advice on how to do most of what I want to do with this; the Modding Tools thread is very out of date, and a lot of the links I found while trying to do this myself were dead links - some led to the forum without leading to a topic, while others lead to a webpage that I couldn't make heads or tails of.

Link to post
Share on other sites

1) If I try to edit Scenario.PAK directly to accommodate a Starport in lower tech levels, the game fails to go past the Bene Gesserit screens.

I sincerely hope you mean unpacking it, editing the missions, and repacking it, rather than "dropping Scenario.PAK into notepad and editing it directly". Because, .pak file archives seriously don't work that way.

2) If the build time is set to 1, some funky things happen with structure costs - half of the cost gets lopped off (I haven't tried this out with Build Time 0 or 2 yet). Similarly, a Sonic Tank at Build Time 10 with cost 600 only deducts 500 when all is said and done. So far, using (tech+1)^2 build times combined with (tech)*100 build costs alleviates the cost oddness, but it does generate balance issues on early stages.

First of all, I assume you're using my Dune II Editor?

Secondly, these seem like issues the Opendune guys might have answers for - after all, they got the source code.

3) Changing structure sizes also produces weird graphical results - while functionality is never impaired, it's a little hard to distinguish a silo from a house of ix from an outpost when they all look like half-built structures. Likewise, changing the upgraded concrete from 2x2 to 3x3 produced weird results when trying to place the concrete - most of the time, the bottom level of concrete wouldn't place (and don't even bother changing regular concrete from 1x1 - it doesn't have the same adaptability that upgraded concrete has)

That's related to how many frames the building has. In my editor you can see the animation scripts it tries to execute. If there are not enough frames defined for the structure, it's obvious it'll act weird and use frames it's not supposed to use. You need to edit the graphics themselves, and the accompanying frame definitions file (and probably the animation scripts in the exe, something my editor doesn't allow editing for at the moment) to get all of that acting correctly. There is an editor available for editing the tilesets, thought it's not really easy to do.

And are you really surprised that concrete slabs are full of odd exceptional behaviour that doesn't act like it should if you start messing with it? They're a building with special properties that make it act distinctly NOT like a building, after all.

  • Upvote 1
Link to post
Share on other sites

Ehehe, I was trying to edit scenario.pak with notepad, yes. I'll have to remember that it doesn't work that way in the future. I'll have to look for a nice lightweight unpacker then.

I am using the Dune Editor that you made, yes; I'll check out OpenDune and see if they can tell me why build time messes with build cost so much.

Graphics are usually the last thing I'd mess with, but just so I've got it ready which editor is the one for editing the tilesets? Like I said before, the useful tools thread and useful threads thread seem to be out of date and full of dead links.

As for Concrete, basic concrete behaves like the other buildings more than advanced concrete does; you can't place it at all if there's any overlap with anything no matter what size it's set to. But yeah, that was surprising to find out the hard way.

Link to post
Share on other sites

The List of Dune II Editing Tools has quite some apps for packing and unpacking the .PAK files. As for directly editing it, the .pak has a header with the start address and length of each file inside the pak archive. So with every character you add to the data of a mission file by editing the .pak directly, the files after that get moved down in absolute positioning, meaning their start start addresses in the header, and the length of the one you edited, are no longer correct. So, not a good idea ;)

As for the graphics... building graphics are a combination of 2 files, plus the dimensions set in the exe (plus the animation scripts set in the exe, though you can perfectly edit the rest without touching the animation scripts, if you keep the same number of animation frames).

To edit the graphics themselves, you need the "Dune 2 Tile Editor (Beta)" by ArrakisResearchCo. The link is in the List of Dune II Editing Tools. Note that the direct download link there is broken, but if you click the second link, going to the site itself, the download link on that page works fine. This editor edits the ICON.ICN file, which contains the actual Dune II terrain and building graphics.

To change the foundations, though, you'll have to somehow edit the icon.map file. Information about that file can be found here. I also remember discussing it somewhere in the thread about my editor. I once planned to write an editor for it, but I never really got started on that project. Maybe now I made an ini dump function in my editor, I could use that to read the dimensions... hmm.

~~~

Well anyway. For what you're trying to do, you probably don't need to edit the graphics at all, right? You just want to take, for example, just the 2 rightmost tiles for the refinery. So, using some pak editor, extract icon.map into the game folder. This file has the advantage that you don't need to put it back into the .pak to make it work. Just leave it in the game folder.

So, let's get started. First, a bit of terminology:

Tile: graphics for one cell on the map, found in icon.icn

Frame: a complete set of tiles to form one image for a building ingame.

Tileset: A collection of frames that make up all animation frames of a single building.

"icon.map" has nothing but a long row of numbers, each number being 2 bytes long. The values are big-endian (most significant byte last); this means a value "4C01" in the file actually means 014C, or "332". The first 28 (0-27) are the index tables, telling where each tileset starts. After that come the tilesets themselves. Tilesets are just a row of indexes in the graphics file icon.icn, telling the game for each structure which tiles to use. Do note that icon.map and icon.icn together still don't contain the complete data, since you also need the information from the exe that says how many tiles each frame is. This can only be done by deriving it from the building dimensions configured in the exe. Then there's the number of frames, which can be seen in how many are used in the scripts. Though since some have unused frames, it's safer to just derive that from the information in the icon.map as seen with the default foundations.

As an example, let's take the refinery. All information we got on the refinery:

-it has a 2x3 foundation

-The highest animation frame referenced in the exe is 9. since indexes start at 0, that means it has 10 (used) frames.

-In icon.map, the refinery index (#21) says its frames start at 563. The next one, the Repair Facility, starts at 623. So there are 60 cells, which is indeed enough to build up exactly ten 3x2-tile frames.

-The real number of frames for all buildings, and their usages, can be seen here: http://xhp.xwis.net/...ne2_icons_2.png (image gracefully provided by Olaf Van Der Spek)

Now, to edit this, you need to look at what the 10 frames should contain. For the refinery, as you see, the frames are:

-1 frame of buildup

-1 frame of destroyed

-6 frames of Incoming harvester animation, of which the first 2 frames are used as normal Idle animation

-2 frames of harvester unload animation

If you don't plan on editing the graphics, and just want to use the 1x2 right side of it, this is fairly simple. You won't even need to edit the icon.icn file. You will, however, need to get your hands dirty with a hex editor to edit icon.map.

As you can see on the the icon.map decoding page, the range of the refinery frames is 563-622. These are indexes, however. If you keep in mind the fact that all values are 2 bytes, this means the refinery frames start at byte #1126, or in hexadecimal offset, 466h.

One problem I've noticed though, is that there is no reliable list of the tiles anywhere. I looked at the list of tiles at the icon.map decoding page, but it doesn't seem to match my own Dune II version. To get around this, I just took the data of all original frames and took the #3 and #6 values out of it.

Here are the original frames copied from offset 466h in the icon.map file, arranged on the 3x2 foundation:

frame 1:

- D200 0C01 0D01

- 1101 1201 1301

frame 2:

- DF00 E000 E100

- E800 E900 EA00

frame 3:

- 4C01 4D01 4E01

- 5101 5201 5301

frame 4:

- 4C01 4F01 4E01

- 5101 5201 5301

frame 5:

- 4C01 4D01 5001

- 5101 5201 5401

frame 6:

- 4C01 4F01 5001

- 5101 5201 5401

frame 7:

- 4C01 4D01 5501

- 5101 5201 5701

frame 8:

- 4C01 4F01 5501

- 5101 5201 5701

frame 9:

- 4C01 4D01 5601

- 5101 5201 5801

frame 10:

- 4C01 4F01 5601

- 5101 5201 5801

Now, if we just want to reduce the building to 1x2, using the rightmost frames, they become:

frame 1:

- 0D01

- 1301

frame 2:

- E100

- EA00

frame 3:

- 4E01

- 5301

frame 4:

- 4E01

- 5301

frame 5:

- 5001

- 5401

frame 6:

- 5001

- 5401

frame 7:

- 5501

- 5701

frame 8:

- 5501

- 5701

frame 9:

- 5601

- 5801

frame 10:

- 5601

- 5801

So, the final data ends up being:

0D01 1301 E100 EA00 4E01 5301 4E01 5301 5001 5401 5001 5401 5501 5701 5501 5701 5601 5801 5601 5801

(with a reliable list of tiles and/or the tile editor we could probably do a lot more here though)

Paste this data at offset 466h (overwriting the existing data... remember the .pak fiasco. Same applies here; don't do anything that requires editing and correcting the index table unless you're prepared to edit and correct the index table ;) ), save, and you're done. This will obviously not fill the entire space available for the Refinery frames (since it's only 2/3rd of the length), but that doesn't matter, since the game only takes what it needs for the configured foundation, and the next building's start index is read from the index table anyway.

Now, all you need to do is change the foundation in dune2.exe to 1x2 using my editor, start the game, build a refinery, and you're done. This process shouldn't be hard to repeat for the other buildings. They key is to copy the original data, determine which cell(s) to use, and removing all the others, just like I did above.

  • Upvote 1
Link to post
Share on other sites

For SCENARIO.PAK editing, WWPak is a nice and handy command line tool, but I just found out the download link is broken. You can use TCH's Windows PAK tool instead, it has roughly the same functionality.

Sonic Tanks and Deviators are now built from Light Factory instead of Heavy Factory in order to increase the number of Launchers and Siege Tanks built by the AI on higher levels (in theory, at least)

I'm not sure how exactly it is going to help, as there's a global limit for units that can be present on the map, regardless of where they had been built. However, IIRC there's some kind of priority value the AI bases it's production queue upon, with units that have a higher priority level being produced first (if there's enough credits).

Ornithopter-using enemies will become much more deadly due to increased vision ranges of Outpost and Starport - Outpost now has vision 25, and Starport now has vision 250.

A sight range of 250 tiles is way more than necessary, with the maximum map size of 64 by 64 tiles. Huge sight range doesn't seem to have negative side effects, but is still redundant.

That said, basically you have transformed the starport into an "instant reveal map" superweapon (kinda like the Allied GPS satellite in RA1).

The main reason I'm posting this is to get my approved post, but also to see if I can get some advice on how to do most of what I want to do with this; the Modding Tools thread is very out of date, and a lot of the links I found while trying to do this myself were dead links - some led to the forum without leading to a topic, while others lead to a webpage that I couldn't make heads or tails of.

I've been kind of very busy lately, and besides, many tools on the list have been included for historical purposes only. Stuff that is really used is Nyer's editor, XCC Mixer for viewing PAK archive contents and extracting them, whatever PAK packer is available for packing files back, and the tools that are used for graphics (Red Horizon for most stuff, some can be done with XCC Mixer too). For a nice scenario editor, there's TCH's one and another written by Segra (haven't been able to check it out yet though).

  • Upvote 1
Link to post
Share on other sites
  • 4 weeks later...

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