Author Topic: Bug building common ore smelter without using convec  (Read 7641 times)

Offline djshaw

  • Newbie
  • *
  • Posts: 2
Bug building common ore smelter without using convec
« on: November 20, 2017, 07:10:32 PM »
Hey!

I'm a big outpost 2 player, but I really only play colony games. I found a bug yesterday. I was playing Colony Builder, Plymouth 2. I set a convec to build a common ore smelter, but decided to change the location at the last minute. Construction started, but the convec didn't go into construction mode--and it still had a common ore smelter in it. Effectively, I got two smelters for the price of one. I presume there's a bug the requires frame accurate input to begin construction, then provide a move command to the convec.

I've attached a screenshot of a building under construction without a convec. I've attached my save game files. The game is saved as 'bug' (I'm not sure which SGAME file it is, so I'm attaching all of them).

I'd love to find a way to reliably reproduce this issue. It would change the game so much and open it up to speed running, beating plymouth space ship builder (on normal or hard), or plymouth cold war (on normal or hard).

If anyone is able to better explain what happened, if anyone has a reliable way to reproduce the bug, or if anyone has any thoughts, I'd love to hear from you!

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: Bug building common ore smelter without using convec
« Reply #1 on: November 20, 2017, 07:12:18 PM »
Yeah, we've known about this for years, but you need frame-perfect timing to pull it off, so nobody has ever bothered to fix it I think.
"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 Spikerocks101

  • Hero Member
  • *****
  • Posts: 711
Re: Bug building common ore smelter without using convec
« Reply #2 on: November 21, 2017, 10:28:34 AM »
IDK... sounds like some intense hacking to me. At least you got an extra smelter instead of a vortex appearing directly above you.
I AM YOUR PET ROCK!!!!!!

Offline djshaw

  • Newbie
  • *
  • Posts: 2
Re: Bug building common ore smelter without using convec
« Reply #3 on: November 21, 2017, 05:26:59 PM »
Yeah, we've known about this for years, but you need frame-perfect timing to pull it off, so nobody has ever bothered to fix it I think.

I had no idea. Is there any more information on it? Is there a list of bugs somewhere?

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Bug building common ore smelter without using convec
« Reply #4 on: November 22, 2017, 04:30:00 AM »
I actually didn't know about this. Thanks for posting about it. Loved that you included details and saved game files.

I might consider taking a look into this. If so, the saved game files could provide a bit of info on the exact timing requirements to make this happen.

Offline Crow!

  • Jr. Member
  • **
  • Posts: 74
Re: Bug building common ore smelter without using convec
« Reply #5 on: June 27, 2018, 01:08:29 AM »
I've been having fun with this myself.  My gaming background lately is that of a speedrunner, so I'm looking into where and when this is useful to a campaign speedrun.

I made a video demonstrating how to set up the duplication reliably, along with my guesses as to how it works: https://youtu.be/8XDVYVoCYtg

I did some more exploration afterward.  It turns out that duplicating a guard post acts very differently from all the other structure kits: the weapon turret somehow gets deployed and removed from the structure kit, leaving you with a turretless guard post in your inventory.  Trying to build that guard post will crash the game once it is complete.

Recycling a turretless guard post yields 125 common metals, suggesting that the turret base cost is 250, which checks out with the community development docs.
Speedruns, my FFIV game randomizer, and more can be found at my twitch page:
https://twitch.tv/iicrowii

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Bug building common ore smelter without using convec
« Reply #6 on: June 28, 2018, 04:08:56 AM »
Crow!,

Welcome to the forums! Thanks for posting about the bug and showing how to reproduce it.

I think this could really throw a multiplayer game. Especially being able to surround a mining beacon with 3 smelters for the cost of 1 and skipping the time lapse in moving the convec back and forth from the structure factory. You could also spam build Spaceports for Plymouth for missile launching. Spam building Tokamaks and Agridomes to a lesser degree might also be helpful.

Oddly, this could almost make the GORF worth it in multiplayer scenarios. Build a free expensive kit and then return the kit for recycling at the structure factory. Or store the kit until you need it again.

Probably means it should get patched though...

-Brett

Offline Crow!

  • Jr. Member
  • **
  • Posts: 74
Re: Bug building common ore smelter without using convec
« Reply #7 on: June 28, 2018, 10:41:49 AM »
So far, the biggest applications in a speed run appear to be on mission 2 (most of your time is supposed to be spent replacing the structure kits you deploy) and cloning Tokamaks to place directly in the line of fire for enemy attacks.  When the tokamak explodes, it's as if an EMP missile went off.

I'm finding it to be less useful on most missions than I originally expected, because there are already a lot of things that demand attention; spending 10 seconds or so getting the clone to work often comes at a cost elsewhere.
Speedruns, my FFIV game randomizer, and more can be found at my twitch page:
https://twitch.tv/iicrowii

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Bug building common ore smelter without using convec
« Reply #8 on: June 28, 2018, 05:45:49 PM »
Crow!,

How do you know what the current fastest run is for beating Outpost 2? Is it maintained somewhere? And how do you prove your time, does it have to be captured in a video or something?

I wonder how many others in the Outpost community would be interested in speed runs?

Thanks for the quick shout out to Outpost Universe in your video.

Brett

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Bug building common ore smelter without using convec
« Reply #9 on: June 29, 2018, 05:04:27 AM »
Huh, thanks for the video and the details. Well done.

The difference in behaviour for turrets is particularly interesting. Seems like it clears the weapon field, but not the base kit field.

Offline Crow!

  • Jr. Member
  • **
  • Posts: 74
Re: Bug building common ore smelter without using convec
« Reply #10 on: July 01, 2018, 02:51:24 PM »
@Vagabond: I have not yet found any existing speedruns of Outpost 2.  I'm working on the route from scratch.  If you do know of any other runs, I would be interested in seeing it.  These days, most games use speedrun.com as a leaderboard, but that site does not yet have an Outpost 2 page.  The older speeddemosarchive.com site does not have a page for OP2, either.

In my experience, speed runs are a great way to get replay value out of single player games, and figuring out what I want to do has been fun for OP2 so far.  So, I do recommend it for anyone looking for an excuse to play OP2 again.

Anyway, I'm on vacation right now, but you can expect me to start trying runs within a week or two on my Twitch page.
Speedruns, my FFIV game randomizer, and more can be found at my twitch page:
https://twitch.tv/iicrowii

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Bug building common ore smelter without using convec
« Reply #11 on: July 10, 2018, 08:51:31 AM »
I spent a little bit of time looking into this with OllyDbg. I didn't find the exact source of the bug, but thought I'd at least leave a small note that relates to this.

I set a hardware breakpoint to see where the cargo is cleared after deploying a building. It is done here:
Code: [Select]
0043ADA0 SUB ESP,0A8                  ;  Function: void Unit.ProcessForGameCycle()
...
0043BB2D MOV BYTE PTR DS:[ESI+22],0A  ;  Unit.action = 0x0A  [moObjFroze]
0043BB31 MOV WORD PTR DS:[ESI+24],0   ;  Unit.cargoOrWeapon = 0  [mapNone]

I didn't see any surrounding code that looked like it created a new building. Not surprising considering this seems to be a timing bug, so that's likely done elsewhere in the code.

Offline Crow!

  • Jr. Member
  • **
  • Posts: 74
Re: Bug building common ore smelter without using convec
« Reply #12 on: July 11, 2018, 01:53:32 PM »
Did you hit that breakpoint when you lost control of the ConVec as it started deploying, or when you regained control after the structure was complete?
Speedruns, my FFIV game randomizer, and more can be found at my twitch page:
https://twitch.tv/iicrowii

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Bug building common ore smelter without using convec
« Reply #13 on: July 22, 2018, 06:42:46 AM »
The breakpoint fired right after deploying the building. The building was not complete.

I also noticed the code sets unit.timer = 1 if the instant build cheat is active. I guess technically that's not quite instant. I wonder if the delay of 1 tick is needed for it to function correctly.


I spent a bit more time analysing the code today, though not much insight to report. The building construction code is quite long, so a bit slow to analyse, though thankfully not overly difficult. It seems to mix convec, robo miner, and geo con concerns together. The deploy code seems to be in one case of a large switch statement for all possible unit actions. The function containing all of this is quite massive. It could probably take a couple of days of concerted effort to document just the building deploy code.

I think if I were to look further into this, I should be trying to set more breakpoints so as to narrow down the search to a more specific section of code. In particular, where does it modify the base building type versus the weapon type for a turret, and where is the code that actually creates the building itself.