Rcon sql command doesn't really work

Game mode: Online private
Type of issue: Bug
Server type: PvE-Conflict
Region: Asia


I use rcon sql command to update the health of my buildings every minute to make sure admin buildings doesn’t be destroyed by any means
Here is what I send through rcon
‘sql “update buildable_health set health_percentage=1 where object_id in (select b.object_id from buildings b where buildable_health.object_id=b.object_id and b.owner_id=2041);”’
And I use the below sql command to check my buildings
“select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”

The RCON sql command works after it’s been submitted correctly and the second sql command got nothing, but sometimes the old buildable_health.health_percentage values come back. It looks like it doesn’t really write back to the db, and the old value stored somewhere will be read and written into db later on.


Please provide a step-by-step process of how the bug can be reproduced. The more details you provide us with the easier it will be for us to find and fix the bug:

  1. Using RCON sql command to update my buildings’ health(my guild id is 2041)
    ‘sql “update buildable_health set health_percentage=1 where object_id in (select b.object_id from buildings b where buildable_health.object_id=b.object_id and b.owner_id=2041);”’
  2. Read back the health_percentage from database
    “select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”
  3. The old health_percentage values come back after awhile.

Here is what it looks like
BTW, I mount the windows samba folder to linux, so that I can use command line easily to check it.

[email protected] ~/docker/conan % sudo sqlite3 server2/Saved/game.db “select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”
1958|2041|1958|13950|2|16003|0.892665386199951
1958|2041|1958|13950|0|900491|0.892665445804596
1958|2041|1958|13950|1|18030|0.892665505409241
1958|2041|1958|14143|0|900491|0.921425223350525
1958|2041|1958|14143|1|18030|0.921425461769104
1958|2041|1958|14143|2|16003|0.921425461769104
1958|2041|1958|2167|0|11108|0.954086363315582
1958|2041|1958|2167|1|16003|0.954089403152466
1958|2041|1958|13949|2|16003|0.976187944412231
1958|2041|1958|13949|0|900491|0.976188600063324
[email protected] ~/docker/conan % sudo sqlite3 server2/Saved/game.db “select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”
[email protected] ~/docker/conan % sudo sqlite3 server2/Saved/game.db “select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”
[email protected] ~/docker/conan % sudo sqlite3 server2/Saved/game.db “select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”
1958|2041|1958|13950|0|900491|0.891369462013245
1958|2041|1958|13950|1|18030|0.891369462013245
1958|2041|1958|13950|2|16003|0.891369462013245
1958|2041|1958|14143|0|900491|0.913487613201141
1958|2041|1958|14143|1|18030|0.913487613201141
1958|2041|1958|14143|2|16003|0.913487613201141
1958|2041|1958|2167|0|11108|0.948284804821014
1958|2041|1958|2167|1|16003|0.948288261890411
1958|2041|1958|13949|2|16003|0.976033568382263
1958|2041|1958|13949|0|900491|0.976034283638
[email protected] ~/docker/conan % sudo sqlite3 server2/Saved/game.db “select * from buildings b join buildable_health on b.object_id=buildable_health.object_id where buildable_health.object_id=b.object_id and b.owner_id=2041 and buildable_health.health_percentage <> 1 order by buildable_health.health_percentage ASC limit 10;”
1958|2041|1958|13950|0|900491|0.879460036754608
1958|2041|1958|13950|2|16003|0.879460036754608
1958|2041|1958|13950|1|18030|0.879460155963898
1958|2041|1958|14143|1|18030|0.902846932411194
1958|2041|1958|14143|0|900491|0.902847170829773
1958|2041|1958|14143|2|16003|0.902847349643707
1958|2041|1958|2167|0|11108|0.939952790737152
1958|2041|1958|2167|1|16003|0.939956784248352
1958|2041|1958|13949|2|16003|0.97504585981369
1958|2041|1958|13949|0|900491|0.975046515464783

The rcon sql command is working. But the database state of buildings and placeables, including their health, is just used for loading. And the game will write changes from the current state in memory into the database.
Changing the database state does not affect the state of your building.
This is the case for almost everything saved in the database. The game doesn’t go back and read what is in the database during runtime for the majority of things saved in the database.

Here’s an “example” for whoever reads this that didn’t understand what I meant with the above statement:

Think of it as a guy who is playing with lego, and every time he does a change to his lego building he writes down in a notebook what the building looks like. Because when he is done playing, he’s gonna scrap the building but wants to be able to put it back to the same state the next time he wants to play with his legos.
Then you come in and do changes to his notebook. Not the actual lego building itself.
The problem is that the guy playing with lego is going to write down a version of his building one last time before he tears down the building (the buildings save on shutdown).
So your notebook changes never actually do anything.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.