Switching from int32 to int64

Do you need help playing, have ideas for the game or just want to talk about what's going on in the game? This is the place.

Post Reply
Posts: 64
Joined: Thu Nov 03, 2016 5:16 am

Switching from int32 to int64

Post by Rincewind » Sun Jan 15, 2017 4:21 am

The guys at WyeSoft are running a quite successful game, with some improvements, too.

http://forums.wyesoft.com/viewtopic.php ... 322e1c2535

In this post the Admin is saying he'd like to look into converting all ints to int64 so the score can be larger as well as planetary transfer amounts.

How hard is it? Do you have any branch with that change already done? I remember you mentioned you did it once.


User avatar
Site Admin
Posts: 247
Joined: Thu Apr 17, 2014 9:15 am

Re: Switching from int32 to int64 (bad idea)

Post by TheMightyDude » Sun Jan 15, 2017 8:24 am

Changing to BIGINT (Int64) won't solve or fix anything, it just causes more issues and adds more fuel to the fire.

We found that out the hard way, oh and the players will never be happy with what ever you do.

A BIGINT [signed] (Int64) will give you -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
A BINGINT [unsigned] (UInt64) will give you 0 to 18,446,744,073,709,551,615

Yes it will increase the score, yes it will increase the transfer amounts, but you will still hit the maximum value where you will loose credits etc.

Example using BIGINT [unsigned] (UInt64):
Say you have 18,446,744,073,709,551,615 on your planet and you already have say 18,000,000,000,000,000,000 on your ship.
You try and transfer the whole 18,446,744,073,709,551,615 from your planet to your ship.
It will remove the whole value from your planet setting it to 0.
You will hit the maximum value for UInt64 where it will cap at 18,446,744,073,709,551,615.

That means you have just lost 18,000,000,000,000,000,000 in your transfer.

It is worse when you use BIGINT [signed] (Int64), Example:
Say you have 9,223,372,036,854,775,807 on your planet and you already have 9,000,000,000,000,000,000 on your ship.
Once again you try and transfer the whole 9,223,372,036,854,775,807 from the planet to your ship.
It removes the whole value from the planet like before setting it to 0.
You will overflow your value into the minus range about ‭-223,372,036,854,775,809‬.

The issue is the code needs to have loads of checks put in to stop taking too much resulting in it overflowing to a minus value or loosing a set value due to capping.

So increasing the type of value to either an Int64 or UInt64 your not fixing anything.

So lets say it was set to UInt64 allowing for values of 0 to 18,446,744,073,709,551,615 and say you add in loads of code to do all the checks, players will never be happy with that value, they will want higher values.

The issue in the game is its economy its way to high than it should be and this is the cause of the high values, the next issue in the game is the players by wanting bigger numbers.

Look how most of the World of Warcraft players moaned when blizzard did that stat squish.

In my opinion, it should stay as INT [signed] (Int32) giving you -2,147,483,648 to 2,147,483,647 and just lower the economy a huge amount.

So just do the following:
  1. Keep it set as INT(20) [signed] (Int32)
  2. Lower the entire Economy in the game, yes it might be hard to do, but it needs it.
  3. Add a lower cap of the maximum value.
  4. Add in the checks to make sure you only transfer up to the set cap.
  5. Use the negative side of the value to detect the overflow flip.
That's what I think needs doing and is also what I will be doing in the re-code / new version.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

Posts: 64
Joined: Thu Nov 03, 2016 5:16 am

Re: Switching from int32 to int64

Post by Rincewind » Tue Jan 17, 2017 2:36 am

Thanks heaps for the explanation and insight.

I was hoping it would be easier to implement a workaround which would at least make the game a bit more enjoyable in the later stages.

The admin of WyeSoft has a similar idea to recoding the whole game - so just a thought - maybe you two could collaborate :) I'm willing to do at least the testing :P


Post Reply