Transferring money to planet

Where we find trouble with the latest release... and shoot it.

Post Reply
Rincewind
Posts: 65
Joined: Thu Nov 03, 2016 05:16 UTC

Transferring money to planet

Post by Rincewind » Mon Nov 07, 2016 05:40 UTC

In the latest game I'm playing on 0.663


- transferring larger sums of money to planet let's say I have

3,412,123,001

I try to transfer 3212123001 (leave 200 mill on planet) usually just transfers 2bill to planet, and leaves me with the rest.

I haven't really looked deep into when it is caused and if there's any other edge-cases, but it's happened to me way too many times in this game.

http://bnt.wyesoft.com/universe1/settings.php

thekabal
Posts: 100
Joined: Sat Apr 19, 2014 22:32 UTC

Re: Transferring money to planet

Post by thekabal » Sun Nov 13, 2016 23:50 UTC

Rincewind wrote:I try to transfer 3212123001 (leave 200 mill on planet) usually just transfers 2bill to planet, and leaves me with the rest.
Sounds like an int limit on a variable, since those are (on a 32-bit machine) somewhere around 2 billion. That is one of the main benefits I'm finding with using static variable types - it makes very clear where those bugs are occurring.

Most of the "math" portions of the game are further down the road for fixes, only because they are so complex to track down. If you could clarify which transfer method you are using, I can look further for it.

Rincewind
Posts: 65
Joined: Thu Nov 03, 2016 05:16 UTC

Re: Transferring money to planet

Post by Rincewind » Mon Nov 14, 2016 00:37 UTC

It sure does sound like that is the case! Thanks for clearing it up.

BTW, I was just using a planet transfer, ticked 'To planet' box, typed my exact amount I had on ship -200 million, which when over 2.14billion always results in this error I guess.

I wonder how it works.. if I type in a number which doesn't fit in a 32bit int, why does PHP assume it's 32bit int and limits the transfer?

Shouldn't it know it's a large int? Does PHP even have something like that? :D

Thanks anyway. Let me know if you need more information.

User avatar
TheMightyDude
Site Admin
Posts: 311
Joined: Thu Apr 17, 2014 09:15 UTC

Re: Transferring money to planet

Post by TheMightyDude » Mon Nov 14, 2016 06:36 UTC

Rincewind wrote:It sure does sound like that is the case! Thanks for clearing it up.

BTW, I was just using a planet transfer, ticked 'To planet' box, typed my exact amount I had on ship -200 million, which when over 2.14billion always results in this error I guess.

I wonder how it works.. if I type in a number which doesn't fit in a 32bit int, why does PHP assume it's 32bit int and limits the transfer?

Shouldn't it know it's a large int? Does PHP even have something like that? :D

Thanks anyway. Let me know if you need more information.
Possibly, but MySQL returns everything as a string, so it becomes an issue.

To have it correct things we would need to typecast everything.
TheMightyDude::Blacknova Development.
Development Blog YouTube Dev Channel Twitter Twitch

Rincewind
Posts: 65
Joined: Thu Nov 03, 2016 05:16 UTC

Re: Transferring money to planet

Post by Rincewind » Mon Nov 14, 2016 23:44 UTC

Thanks for explanation guys, it really makes sense. I never noticed it was the int limit since I was mostly transferring large sums to planet so never really saw how much it took from my account, but when I tried to withdraw 3b the other day I saw it took like 2,214,xxx,xxx whatever it is.. :D

Hope you can come up with a workaround for the re-coded version :)

User avatar
TheMightyDude
Site Admin
Posts: 311
Joined: Thu Apr 17, 2014 09:15 UTC

Re: Transferring money to planet

Post by TheMightyDude » Tue Nov 15, 2016 09:27 UTC

Rincewind wrote:Thanks for explanation guys, it really makes sense. I never noticed it was the int limit since I was mostly transferring large sums to planet so never really saw how much it took from my account, but when I tried to withdraw 3b the other day I saw it took like 2,214,xxx,xxx whatever it is.. :D

Hope you can come up with a workaround for the re-coded version :)
I am "hoping" to reduce the cost of everything, I was thinking the other day about the economy, had a chat with a few friends how they would do it and most of us chose the following:
The database still stores the currency in the database as a Signed INT, however it displays it an Copper, Silver, Gold and maybe Platinum.
So if it had 116G 38S 91C that would store in the database as 1,173,891, so it would stay the same in the database but its displayed the new way if you get me.

So a player would in theory be able to have a currency of 2,147,483,647 stored in the database but display as 214P 748G 36S 47C.
So the following:
100 Copper = 1 Silver
100 Silver = 1 Gold
1000 Gold = 1 Platinum

But I plan to make the game not be able to get that high.

Basically a BIG INT is just so over the top, +18,446,744,073,709,551,615 come on.

So that's what I am "thinking" of doing.
TheMightyDude::Blacknova Development.
Development Blog YouTube Dev Channel Twitter Twitch

Surfdude
Posts: 17
Joined: Wed Jan 25, 2017 02:09 UTC

Re: Transferring money to planet

Post by Surfdude » Wed Jan 25, 2017 06:41 UTC

That sounds like also a possible new direction to go with the game. If you are able to think about it.

Perhaps by breaking up the credits into different types with different values we could also look at perhaps 3-4 tiers for the ships. The fighters in the higher level ships could have more punch and so on at each tier.

Just a thought...plus it would be awesome to incorporate new ship designs.

I was skimming through one of the scripts today while trying to figure out how to load a blacknova game and thought that someone who knows what they are doing could do it fairly easy with a little work.

Thank-you for your time,

Ed

Post Reply