Release for Servers
This new release is a major release for server owners. We had problems with crashes -- between other things --, and so we did an overhaul of the way things were done.
There are two major changes:
- The database system was completely changed. No more using SQL, instead text files in a folder named "serverdb".
- Battles are in a separate process, a "battle server". Essentially means no crashes and hot updates.
There also are smaller changes, which we will discuss later. For example a script function to calculate performance and help you make your scripts faster!
And steps taken to ensure better bug care for the future. Let's make stability a strong point of PO.
We're going back to what it was 3 years ago, using no SQL, just text files :)
This makes things go a ton faster. SQL is really not good for fast read / writes. Even though there was a system in place that made those read/writes asynchronous, it wouldn't work in all cases (e.g. scripts).
And now database is easily human readable/editable.
But there's a catch. Before updating the server, make sure to export your database in SQL Config. Then create a folder "serverdb" and move the exported files there.
Otherwise, you won't have your database transferred over!
Battle Server change
Battles are now in a separate process. This means anything makes the battle server crash, server stays up. Battles get tied, battle server gets restarted, and server carries on. A
battleConnectionLost event is triggered.
You can also use this feature to update your battle server while the server is running. Though regular server owners probably won't see a benefit from it unless they're familiar with git and compilation, it means we can update the battle engine on the main server without restarting it.
To load/unload usage stats and battle logs plugin, you know have to use script functions, or edit the
config_battleServer file yourself.
The scripts function are:
Names for usage stats and battle logs are 'Usage Statistics' and 'Battle Logs'.
Battle Server is started automatically when one is not running already. (Aka no battle server on start up, or battle server crash).
For now they give PO a lot of stability and the ability for savvy people to update the battle engine with the server still running, but in the future on battle server may be used by servers connecting to it other machines, guaranteeing them to always have the most up-to-date battle engine. Who knows!
Some new scripting functions were added.
The first one shows the total time taken by script event (and file write/read functions) since the server started, as well as server uptime, while the second one resets those counters.
If you have a scripting mess on your hand, it can point you to where to look in order to reduce lag.
More, more stability
Automated builds were added. Automated tests were added.
Each time a change is made in the code of PO, those tests are run, with a big warning if they fail. I think you can thank shancat for that.
Those tests are quite complex. From testing basic things, to simulating a server connecting to the battle server or a client connecting to a server, sending data, and expecting results :)
From now on, when an issue is found or a bug solved, most of the time a test will be added to make sure that it will never happen without us knowing. It'll help make new releases bug free and avoid facing same problems as we did before. And it should warn us of any obvious bugs.
That's it! Those server troubles have really bogged me down for two weeks, leading me to take drastic measures (and what's here is not all that changed!). But that paid off.
As I'm writing this, after releasing with those changes, server has been up for 1 day 2 hours, with no sign it's going down any time soon. I can rest in peace.