Transferring money to planet

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

User avatar

Posts: 64

Joined: Thu Nov 03, 2016 6:16 am

Post Mon Nov 07, 2016 6:40 am

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
User avatar

Posts: 74

Joined: Sat Apr 19, 2014 11:32 pm

Post Mon Nov 14, 2016 12:50 am

Re: Transferring money to planet

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.
User avatar

Posts: 64

Joined: Thu Nov 03, 2016 6:16 am

Post Mon Nov 14, 2016 1:37 am

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? :D

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

Site Admin

Posts: 151

Joined: Thu Apr 17, 2014 10:15 am

Post Mon Nov 14, 2016 7:36 am

Re: Transferring money to planet

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
User avatar

Posts: 64

Joined: Thu Nov 03, 2016 6:16 am

Post Tue Nov 15, 2016 12:44 am

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.. :D

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

Site Admin

Posts: 151

Joined: Thu Apr 17, 2014 10:15 am

Post Tue Nov 15, 2016 10:27 am

Re: Transferring money to planet

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
User avatar

Posts: 16

Joined: Wed Jan 25, 2017 3:09 am

Post Wed Jan 25, 2017 7:41 am

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

Return to Troubleshooting



Who is online

Users browsing this forum: No registered users and 1 guest