Trade Wars 2117

If you have a new game running on your server, you can announce it in here.

User avatar
TheMightyDude
Site Admin
Posts: 244
Joined: Thu Apr 17, 2014 10:15 am

Re: Trade Wars 2117

Post by TheMightyDude » Wed May 24, 2017 5:02 pm

JokerAce wrote: Are decimals valid in the $sched_----- lines in the config.php?

For example:

$turns_per_tick = 1; // Update how many turns per tick
$sched_turns = .01; // New turns rate (also includes towing, xenobe)

I have been trying to slow the new turn rate because, if set to 1, turns virtually never run out, which defeats the daily turn concept so someone with nothing better to do could play 20 hours a day and be unstoppable.

There may be a better way to accomplish this anyhow, I have just been trying to experiment with the values here.
Erm, I don't think they are, turns is an integer not a float / fraction.

As for the turns, try setting it to 1 and change how oftern it calls sched_turns.php
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

User avatar
TheMightyDude
Site Admin
Posts: 244
Joined: Thu Apr 17, 2014 10:15 am

Re: Trade Wars 2117

Post by TheMightyDude » Wed May 24, 2017 5:04 pm

JokerAce wrote: That's great! That would be really helpful.
Well, there is still some really annoying bugs in it where it says its out of sync when its not, this is due to how scheduler works.

So looking into that now.

*** fixed the out of sync bug ***

Just need to wait another 15 or so mins to see if it works on all events due to sched_ranking gets called 30 mins.

Then another few mins to insert an error to test.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

JokerAce
Posts: 17
Joined: Thu Apr 27, 2017 6:01 am

Re: Trade Wars 2117

Post by JokerAce » Wed May 24, 2017 5:20 pm

TheMightyDude wrote: There may be a better way to accomplish this anyhow, I have just been trying to experiment with the values here.
Erm, I don't think they are, turns is an integer not a float / fraction.

As for the turns, try setting it to 1 and change how oftern it calls sched_turns.php[/quote]

Okay, if I set the config like this:

Code: Select all

$sched_ticks                = 5;                                // Set this to how often (in minutes) you are running the scheduler script.
$turns_per_tick             = 1;                                // Update how many turns per tick
$sched_turns                = 1;                                // New turns rate (also includes towing, xenobe)
$sched_ports                = 1;                                // How often port production occurs
$sched_planets              = 1;                                // How often planet production occurs
$sched_igb                  = 1;                                // How often IGB interests are added
$sched_ranking              = 1;                               // How often rankings will be generated
$sched_news                 = 1;                               // How often news are generated
$sched_degrade              = 1;                                // How often sector fighters degrade when unsupported by a planet
$sched_apocalypse           = 1;                               // How often apocalypse events will occur
$sched_thegovernor          = 1;                                // How often the governor will run, cleaning up out-of-bound values
The turns regenerate way too fast.

When you suggest changing how often it calls sched_turns, other than increasing the time between cron scheduler cycles (and then $sched_ticks), how could I accomplish that without going below a regular integer like (1)?

JokerAce
Posts: 17
Joined: Thu Apr 27, 2017 6:01 am

Re: Trade Wars 2117

Post by JokerAce » Wed May 24, 2017 5:23 pm

TheMightyDude wrote:
JokerAce wrote: That's great! That would be really helpful.
Well, there is still some really annoying bugs in it where it says its out of sync when its not, this is due to how scheduler works.

So looking into that now.

*** fixed the out of sync bug ***

Just need to wait another 15 or so mins to see if it works on all events due to sched_ranking gets called 30 mins.

Then another few mins to insert an error to test.
Okay, great. Thanks!

User avatar
TheMightyDude
Site Admin
Posts: 244
Joined: Thu Apr 17, 2014 10:15 am

Re: Trade Wars 2117

Post by TheMightyDude » Wed May 24, 2017 5:58 pm

JokerAce wrote: Okay, if I set the config like this:

Code: Select all

$sched_ticks                = 5;                                // Set this to how often (in minutes) you are running the scheduler script.
$turns_per_tick             = 1;                                // Update how many turns per tick
$sched_turns                = 1;                                // New turns rate (also includes towing, xenobe)
$sched_ports                = 1;                                // How often port production occurs
$sched_planets              = 1;                                // How often planet production occurs
$sched_igb                  = 1;                                // How often IGB interests are added
$sched_ranking              = 1;                               // How often rankings will be generated
$sched_news                 = 1;                               // How often news are generated
$sched_degrade              = 1;                                // How often sector fighters degrade when unsupported by a planet
$sched_apocalypse           = 1;                               // How often apocalypse events will occur
$sched_thegovernor          = 1;                                // How often the governor will run, cleaning up out-of-bound values
The turns regenerate way too fast.

When you suggest changing how often it calls sched_turns, other than increasing the time between cron scheduler cycles (and then $sched_ticks), how could I accomplish that without going below a regular integer like (1)?
You have the game update every 5 mins, you cannot just change the sched values to 1 in the config file and hope it will change in game, you need to either recreate the universe (long winded way) or change them in the config and then change ticks_full in the database table scheduler for each sched you want to alter.

Also setting everything to 1 will cause unknown issues and possible load issues, so its best to keep them as they was before.
Like the ranking doesn't need to be updated every tick.

Anyhow setting turns per tick to 1 and $sched_turns to say 10 and also update the entry in the database.
So that will add 1 turn every 50 mins (I THINK).

How many turns did you want to add and how oftern ?
Remember the turns are an integer and not a fraction / float.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

User avatar
TheMightyDude
Site Admin
Posts: 244
Joined: Thu Apr 17, 2014 10:15 am

Re: Trade Wars 2117

Post by TheMightyDude » Wed May 24, 2017 6:50 pm

Man I hate this code :(
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

JokerAce
Posts: 17
Joined: Thu Apr 27, 2017 6:01 am

Re: Trade Wars 2117

Post by JokerAce » Wed May 24, 2017 10:12 pm

TheMightyDude wrote: You have the game update every 5 mins, you cannot just change the sched values to 1 in the config file and hope it will change in game, you need to either recreate the universe (long winded way) or change them in the config and then change ticks_full in the database table scheduler for each sched you want to alter.

Also setting everything to 1 will cause unknown issues and possible load issues, so its best to keep them as they was before.
Like the ranking doesn't need to be updated every tick.

Anyhow setting turns per tick to 1 and $sched_turns to say 10 and also update the entry in the database.
So that will add 1 turn every 50 mins (I THINK).

How many turns did you want to add and how oftern ?
Remember the turns are an integer and not a fraction / float.
Okay... That is exactly what I needed to know to fix my turn scheduling. Thank you!

One other question about turns and ticks though.... Is there a way to make it grant like 20 turns at once at hour intervals?

It's not critical but it would be nice.

JokerAce
Posts: 17
Joined: Thu Apr 27, 2017 6:01 am

Re: Trade Wars 2117

Post by JokerAce » Wed May 24, 2017 10:30 pm

TheMightyDude wrote:Man I hate this code :(

:)

It does pose a challenge. I'm a glutton for punishment. I have a thing for solving problems.

I ran into the upper limits of BIGINT in the database so I've been going through trying to covert the references to decimal instead (no actual decimals though).
It was working really well but then I found a bug that makes it so when a port is fully stocked on Energy, it rolls the selling price to a negative integer so the port pays you to buy it.

I have yet to go digging for that issue.

Another one I noticed, before the BIGINT changes, is that after combat, when you salvage a ship, you get XXXXXXXXX.X credits.
Which means that somewhere in the code it's allowing decimals into the calculation of the credits and paying the player with that decimal.
I'm guessing that BIGINT or decimal(64, 0) {or whatever you use, the X,0 makes it drop the everything after the decimal} will round that figure off when paying into the players ship credits, but I haven't looked yet so that could be causing other issues too.

Writing the game was a huge accomplishment so needing to debug here and there isn't too bad but, as I'm sure you know, it's always a challenge to understand what was done and why before you break stuff trying to fix other stuff.

Did you manage to perfect that cron schedule verification code that you were working on this morning?

User avatar
TheMightyDude
Site Admin
Posts: 244
Joined: Thu Apr 17, 2014 10:15 am

Re: Trade Wars 2117

Post by TheMightyDude » Wed May 24, 2017 10:45 pm

JokerAce wrote: Okay... That is exactly what I needed to know to fix my turn scheduling. Thank you!

One other question about turns and ticks though.... Is there a way to make it grant like 20 turns at once at hour intervals?

It's not critical but it would be nice.
I am watching TV at the moment, but I will look into it after.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

JokerAce
Posts: 17
Joined: Thu Apr 27, 2017 6:01 am

Re: Trade Wars 2117

Post by JokerAce » Wed May 24, 2017 10:53 pm

TheMightyDude wrote:
JokerAce wrote: Okay... That is exactly what I needed to know to fix my turn scheduling. Thank you!

One other question about turns and ticks though.... Is there a way to make it grant like 20 turns at once at hour intervals?

It's not critical but it would be nice.
I am watching TV at the moment, but I will look into it after.
Cool, thanks. No rush. Enjoy your program.

Post Reply