Transferring money to planet
Transferring money to planet
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
- 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
Re: Transferring money to planet
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.Rincewind wrote:I try to transfer 3212123001 (leave 200 mill on planet) usually just transfers 2bill to planet, and leaves me with the rest.
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.
Re: Transferring money to planet
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?
Thanks anyway. Let me know if you need more information.
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?
Thanks anyway. Let me know if you need more information.
- TheMightyDude
- Site Admin
- Posts: 311
- Joined: Thu Apr 17, 2014 09:15 UTC
Re: Transferring money to planet
Possibly, but MySQL returns everything as a string, so it becomes an issue.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?
Thanks anyway. Let me know if you need more information.
To have it correct things we would need to typecast everything.
Re: Transferring money to planet
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..
Hope you can come up with a workaround for the re-coded version
Hope you can come up with a workaround for the re-coded version
- TheMightyDude
- Site Admin
- Posts: 311
- Joined: Thu Apr 17, 2014 09:15 UTC
Re: Transferring money to planet
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: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..
Hope you can come up with a workaround for the re-coded version
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.
Re: Transferring money to planet
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
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