Author Topic: Stopping The Flow Of Lava  (Read 5386 times)

Offline TheKingBoar

  • Newbie
  • *
  • Posts: 5
Stopping The Flow Of Lava
« on: June 09, 2009, 08:51:19 PM »
Is it possible to stop the lava eruptions in the colony games? I've heard that it's possible to switch the eruptions to non-spreading blight, but wouldn't this just take the same area as the lava flow and render it useless? So that is my question: how do I turn off the lava eruptions? I tried editing the maps in the OP2Mapper by placing impassible terrain around the volcanoes, but that doesn't work. So how is this done?

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Stopping The Flow Of Lava
« Reply #1 on: June 09, 2009, 10:05:40 PM »
You have to edit the DLL files to remove the eruption. Either that, or edit the DLL files to change the lava flow area.

I'm sure this must have been done about half a dozen times by now, but I can't think of any files that are posted. If you wanted to do it yourself, it can be done with OllyDbg. Just have to change the first byte of the SetEruption function to a ret, or similarly edit or nop out some code.

Or you can try searching to see if someone posted one of these edits.
 

Offline TheKingBoar

  • Newbie
  • *
  • Posts: 5
Stopping The Flow Of Lava
« Reply #2 on: June 10, 2009, 12:36:26 AM »
I tried using OllyDbg earlier, but I'm not sure what to do from there. I'm not a programmer, so its possibly I'm just missing something, but here's my problem. I can't find the SetEruption function once I open the maps DLL in OllyDbg. My method so far has been to open it, then press CTRL-N as one of your earlier guides says, and then type in SetEruption. This doesn't bring up anything in that window. Also, what is a ret?

I've been scouring the forums to see if someone else has done this, but so far I can't find anything, hence this thread.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Stopping The Flow Of Lava
« Reply #3 on: June 10, 2009, 10:18:01 AM »
http://forum.outpostuniverse.net/index.php?showtopic=4314

I would like to take this opportunity to once again state that anybody who uses this patch is an evil Blight hater.  Also, you can't play multiplayer with this patch as it will desync.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline TheKingBoar

  • Newbie
  • *
  • Posts: 5
Stopping The Flow Of Lava
« Reply #4 on: June 10, 2009, 11:24:15 AM »
Quote
http://forum.outpostuniverse.net/index.php?showtopic=4314

I would like to take this opportunity to once again state that anybody who uses this patch is an evil Blight hater.  Also, you can't play multiplayer with this patch as it will desync.
Crap, that looks like exactly the thing I'm looking for, but the link is dead! I don't really want so much to remove the blight, but I'll tolerate that just for the lava. Does anyone still have that file?

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Stopping The Flow Of Lava
« Reply #5 on: June 10, 2009, 11:38:11 AM »
Nope, never downloaded it.

Look, all you REALLY need to is is open the map you want in OP2 Mapper 2 and edit the map's celltypes.  Replace all the S1/S2's with M1/M2's and the lava won't be able to spread (unless they decided to set lava possibility by tile type, in which case just replace all the black/dark gray terrain with orange or white/light gray terrain).  You don't even need to change all of it; just put a small box around the volcano and the lava will be trapped forever.  It's a crude fix, but it works (I think).  Just keep a backup of the original map somewhere.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline TheKingBoar

  • Newbie
  • *
  • Posts: 5
Stopping The Flow Of Lava
« Reply #6 on: June 10, 2009, 11:44:22 AM »
I actually tried that method too - I surrounded the volcano with impassible terrain, and that didn't work. The lava just flowed right over it. I'll try the M1/M2 replacements though too, maybe it's coded to flow over impassible terrain, but I doubt it, as that's the cell type for the rocks and cracks that it can't flow over.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Stopping The Flow Of Lava
« Reply #7 on: June 10, 2009, 11:47:51 AM »
Then it could be you need to replace the actual terrain, not the celltype.  I forget which method Dynamix used, or if they even stuck to one single method for all missions.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Kayedon

  • Sr. Member
  • ****
  • Posts: 378
Stopping The Flow Of Lava
« Reply #8 on: June 10, 2009, 11:51:24 AM »
It's Dynamix we're talking about. Think about it.
"Trust me, I'm crazy."

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Stopping The Flow Of Lava
« Reply #9 on: June 10, 2009, 12:13:56 PM »
Wasn't lava spread hard coded in the .dll?
"Nothing from nowhere, I'm no one at all"

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Stopping The Flow Of Lava
« Reply #10 on: June 10, 2009, 10:36:10 PM »
Yeah, it's hardcoded into the .dll file. It can be set in the .map files, but it never is. Even if it was, they force the bLavaPossible bit on for the lava flow area. Editing the map would only let you expand the region, not shrink it.


A "ret" is a return instruction. If you replace the first instruction of a function with a return, you've effectively gutted the function. The only problem is, ret sometimes takes a number of bytes to pop off the stack while returning. (It sometimes has to remove the function parameters). It might end up being "ret 4" or "ret 8" instead of just "ret". You generally just have to look down until you find the end of the function to see what it's supposed to be (or find a point of call, and count the push instructions, keeping in mind that each push instruction generally pushes 4 bytes onto the stack).


Did you open Outpost2.exe or the level dll with OllyDbg? Either can work, but you might get a different initial screen. It might be easier to work with the exe file. The name entry you're looking for is:
Quote
004782E0 | .text | Export | ?SetEruption@TethysGame@@SIXHHH@Z
Of course now that I've pasted that, you could just "GoTo" that address.

It should draw a black line along the left to highlight the extent of the function.(Plus there is also the INT3 instructions between each function tend to help highlight that). The last instruction is a "RET 4". Hit spacebar (on the first instruction, the "SHL EDX, 5") and overwrite the instruction with a "RET 4". You can then run the game in this modified state using F9. If you like the change, you can try saving it permanently to the file by right clicking on the modified line and choosing "Copy to Executable". Keep in mind that this is modifying the exe, not the dll, so your exe will become useless for multiplayer. I would suggest not copying changes to a file permanently unless it's to a colony game dll file.
 

Offline TheKingBoar

  • Newbie
  • *
  • Posts: 5
Stopping The Flow Of Lava
« Reply #11 on: June 10, 2009, 11:49:20 PM »
I was working on the DLL but switched to the EXE with your suggestion. I don't typically play online, so I don't mind if I render it moot for that. So far, it appears to be working. I'm not sure what time the lava normally starts in the Eden colony game, but it got to 600 marks without it so that seems like it works to me. Thanks for your help!

Also, as an aside, is it possible to play the Plymouth colony maps as Eden and vise versa? How would one go around that? Simply change the name from CPS1.dll to CES1.dll?

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Stopping The Flow Of Lava
« Reply #12 on: June 13, 2009, 12:18:43 AM »
Quote
Also, as an aside, is it possible to play the Plymouth colony maps as Eden and vise versa? How would one go around that? Simply change the name from CPS1.dll to CES1.dll?

Yes. See below. No.

Colony games are found by doing a folder search for c*.dll files, and then checking some of the exports to see that it really does have the right level exports to be a colony game. Similarly, prefixes are used to find other game types. The remainder of the name is arbitrary and mostly just used for organizational purposes. For instance, CES1.dll is "Colony, Eden Starship", and CPS1.dll is "Colony, Plymouth Starship".

To change what player you are for a given level, you'd need to edit the dll to change what each player is set as. There are two functions that control this: Player.GoEden() and Player.GoPlymouth(). If you want to change the colony you play as, then search the dll names table for GoEden or GoPlymouth, and change the call from one to the other. You will probably need to use the numeric address of the call to do this, so look both up, record the address after the call, and switch the two (or one).


If you have trouble getting the names table to display, make sure the code window is opened to some code from that module, and has the active focus. You can use the memory window to select the .text (code) section of a module, and right-click it to find an option to open it in the code window.


As for the other level types and their dll prefixes, this is from the Outpost 2 SDK project:
Code: [Select]
	Colony    	= -1, //0xFF	// c
AutoDemo    = -2, //0xFF // a
Tutorial    = -3, //0xFD // t

MultiLandRush   = -4, //0xFC // mu(x)
MultiSpaceRace   = -5, //0xFB // mf(x)
MultiResourceRace  = -6, //0xFA // mr(x)
MultiMidas    = -7, //0xF9 // mm(x)
MultiLastOneStanding = -8, //0xF8 // ml(x)
The "x" for multiplayer denotes the max number of players.
 

Offline Kamikaze088

  • Newbie
  • *
  • Posts: 35
Stopping The Flow Of Lava
« Reply #13 on: June 14, 2009, 08:49:08 PM »
I've successfully removed lava from many colonies games. I used the wisdom discussed here: http://forum.outpost2.net/index.php?showtopic=4447

... and for the blight haters, blight can be removed too, or any selected disaster. You don't need any fancy patch or download. You just gotta learn to edit a bit.
« Last Edit: June 14, 2009, 08:50:31 PM by Kamikaze088 »