Cheating on My Colony for Fun and Profit? pt.1 - Finishing your Buildings
This post was last modified over a year ago and as such, information in it may be outdated (or the post may be outright broken).
Hey G33ks,So I play the game called My Colony
.
I do love it, however, I have the tendency to get in some resource problems.
Due to this, I have decided to see if I could cheat.
However, because I couldn't find any guides online, I have decided to do my own research.
I do, however, not use this cheated save as my main.
I backed up the original before proceeding.
This part is focusing on Finishing buildings, not on getting more resources, people or making the United Earth
(who still owes me tax money) or my colony like me more.Disclaimer
This post is intended for educational use only.
I am in no way or shape responsible for any damages done!
Please make sure you made adequate preperations before proceeding.
Again, I do not endorse cheating!In case you're wondering why I did this?
Just for fun, and to show you that having a game that can switch between offline and online mode with the click of a button is a bad idea unless you have a decent protection build in. This post is intended for educational use only.
I am in no way or shape responsible for any damages done!
Please make sure you made adequate preperations before proceeding.
Reading Parts list
Because this is a multi-part research, here are the links to all parts:
Getting the Save
Of course, it all started with fetching the save. In my case, this was rather simple as I played on PC (with Chrome/Vivaldi). All I had to do was go to theHang on tight while we're loading this image!
<code>main menu</code>
Hang on tight while we're loading this image!
<code>Game Data</code>
Hang on tight while we're loading this image!
<code>Backup Game File</code>
Hang on tight while we're loading this image!
<code>select the world</code>
Hentaii!
, don't ask).
I saved the world as hentaii-.mcz
. Learning how the save works
So I hoped that the save worked like pretty much every way of saving I've seen so far: Just a little XML file with all the data. I generally don't like XML, but for editing saves, it would be a lot easier :)Unfortunately, this was not the case. Fortunately, it wasn't very difficult to figure out how it works. Because I want to save space (and resources), I decided not to show the save-file here, instead, I dropped it in this Gist (proceeding at own risk!).If you had the guts to view it, then you may have figured it out already. But for those who don't: the save file is encoded in Base64! Running the file through a base64decoder showed me that it was simply JSON, but encoded with Base64. Base64 does offer a bit of compression, but except for that, I didn't really see a reason to use it. I think using Gzip would be a better choice? (or maybe both together? I don't know, I'm not really into that stuff) Anyways, now that we have the JSON we need, I could continue!Editting the save
Because I've worked with JSON in the past, and PHP is my favourite language, I decided to make a little script in PHP. It consists 2 parts, which are slapped together in the same file:- The uploady thingy
- The edittor
{
"builings":[
{
"acceptsWorkers":6,
"availableHomes":0,
"bedsAvailable":0,
"colGenCounter":0,
"colGenMax":0,
"colGenPercentage":0,
"constructionCounter":13000,
"constructionPercentage":0.99540581929556,
"constructionProgress":{
"Ore":0,
"Steel":0,
"Gold":0,
"Microchip":60
},,
"constructionQueue":null,
"constructionTotal":13060,
"consumptionCounter":0,
"dX":12,
"dY":45,
"def":"Gold Synthesis Lab",
"generateAmount":1,
"generateCounter":0,
"generatePercentage":0,
"generateTime":1000,
"generates":"Atmosphere",
"howManyWorking":0,
"id":5591,
"isUnderConstruction":true,
"jobsAvailable":0,
"lowPowerMode":false,
"name":"Gold Synthesis Lab #5591",
"noConsumptionMode":false,
"occupiesTiles":null,
"openForEntertainment":false,
"openForTourism":false,
"owner":0,
"patients":{},,
"patrons":{},,
"tourists":{},,
"requiresWorkers":true,
"residents":{},,
"smeltCounter":0,
"someoneWorking":false,
"workerCheckCounter":0,
"workers":{},,
"x":12,
"y":45,
"deactivated":false,
"miniDef":null,
"openForMedical":false
},
]
},
Now that I had this information, I could get started with the first editing part! Finishing all buildings
Because I had to wait for a tonne of buildings to complete, I decided to tackle that first. So, I created my PHP script, added an upload form, parsed the JSON in a nice array and checked if it displayed all my buildings.Now I had finished the basis, I could try to make the game think my buildings are complete! This was the part I actually got confused. Looking at the JSON in the save-file it said"isUnderConstruction":true
, so I thought: it's as simple as flipping that to false
and it would be complete right?
So, I headed over to Hang on tight while we're loading this image!
<code>main menu</code>
Hang on tight while we're loading this image!
<code>Game Data</code>
SHA256
-hashes, I figured that wasn't the problem.
After a little while, I noticed something:
The constructionCounter
, constructionPercentage
, constructionProgress
and the constructionTotal
weren't the same as a finished building.
So, I had to edit those as well!With that done, I could test it again, to see if it worked!
And...What could be wrong then?
Well, after a little bit of troubleshooting, I realised that the JSON didn't get updated in the way that I wanted it.
And after some more troubleshooting, I figured out that the script didn't exactly loop through all the buildings... odd...Then, it struck me... a big facepalm moment.
Instead of looping through all the buildings, I actually looped through the regular save file stuff (like the world name
, world creation date
etc.)...
Why didn't I realise it earlier lol...Well, I patched it up, and count worked properly this time, JSON looked great as well.
Let's give it another shot.Again, I headed over to Hang on tight while we're loading this image!
<code>main menu</code>
Hang on tight while we're loading this image!
<code>Game Data</code>
Hang on tight while we're loading this image!
ARE YOU KIDDING ME!?
{"isUnderConstruction":0,"constructionCounter":0,"constructionPercentage":0,"constructionProgress":null,"constructionTotal":0},
Yea, that should definitely not be there lol...
After a crap tonne of troubleshooting, I finally realised something:
It wasn't an issue with my code, it was an issue with contamination due to all the failed attempts I've made xDSo what I did was copy the backup, run that through the script (which I've added a few lines to, just for consistency, take the output, put that in the save file, import the save file in the game again,
And....Yes, I know I need more solar panels :-D
Unfortunately, it didn't work on the pavements, but ah well :-) I hope you guys like this little research thingy if you do, feel free to build upon it! I hope the game dev notices this, and implement a potential fix because this makes it really easy to create a big commonwealth in no time. I put pretty much a whole day in just this part. I will continue on the resources themselves, but until then, don't break the game too much <3[g33kout]
Comments
Leave a comment
Please login to leave comment!