Jump to content
  • 0

Updating database


Khaikaa

Question

 Hi,

 

 I'm testing modifying character's swithes and variables using SQLite Studio, and I have some question about the update of the server database.

 

 When a character changes one of his switches value(for example) through an event, the change is automatic, so from that momment the game recognices its new switch value. But, if I open the server database, it has the previous value. But, if I restart the server, now the database shows the new value. ¿When does the database really update?

 

 If I overwrite the switch value on the database, the character swithc won't update. But, I do this when de server is off, the switch's value will be the new one. Is it necesary to shut down the server everytime you want to change a character switch or variable value?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1
3 hours ago, Khaikaa said:

 Hi,

 

 I'm testing modifying character's swithes and variables using SQLite Studio, and I have some question about the update of the server database.

 

 When a character changes one of his switches value(for example) through an event, the change is automatic, so from that momment the game recognices its new switch value. But, if I open the server database, it has the previous value. But, if I restart the server, now the database shows the new value. ¿When does the database really update?

 

 If I overwrite the switch value on the database, the character swithc won't update. But, I do this when de server is off, the switch's value will be the new one. Is it necesary to shut down the server everytime you want to change a character switch or variable value?

The server saves characters on a timed interval. I believe 15 minutes (don't quote me on this) or when the character disconnects from the game. The timed save feature is to minimise rollback if the server crashes.

Link to comment
Share on other sites

  • 1

Modifications to the .db(3) do not get applied in-game on a running server unless it is written to query them.

 

When the server is started, it pulls the information it needs from the database and holds it in memory. This value is read and modified by the game engine from memory until it is time to save (automatic saves or saves on logout) when it is written back to the database.

 

This is why your changes only take effect when you make them while the server is off. Changes you make while it is running are just overwritten.

 

If you are trying to do something like add items to a character's inventory from a web shop, you would have to do so directly from ingame (modifying the values in memory) or add the DB edits to a queue that gets processed while the character or server is offline.

Link to comment
Share on other sites

  • 0
1 hour ago, Kibbelz said:

The server saves characters on a timed interval. I believe 15 minutes (don't quote me on this) or when the character disconnects from the game. The timed save feature is to minimise rollback if the server crashes.

 Well, I waited 40 minutes but nothing worked, even disconnecting the character and relogin it, all modifications on the database I make only apply if I do them when the server is off. I though it was weird, but well, if it's the only way... at least it works!

 

 Good luck and thank you!

Link to comment
Share on other sites

  • 0

Well, yeah. The server stores these values in its own memory so it doesn't constantly need to check the database. So as long as a character is logged in you can't change any of these values from outside the game itself.

(I also think SQLite does some funny business with memory caching before flushing to the disk as well, so even if you log out it might take a while for the actual data to be written to the disk and loaded back in cleanly from the disk?)

Link to comment
Share on other sites

×
×
  • Create New...