Game development with Board Game Arena Studio
- Posts: 26
- Joined: 24 September 2019, 02:30
So I understand that BGA uses transactions and the API indicates that changes are not applied "until your request ends normally." My question is when exactly is this "ends normally"?
I have a game state that after the last player of a turn plays their card I go through a series of routines and determine the player order for the next game state. I put the upcoming turn order into the player table and then the routine transitions the gameState to the next state.
The next game state is a game state type of "game". At this point the the logic needs to pull the next player from my turn order and start the next turn. When I try to do a SELECT statement on the player table nothing gets return in my request. I am guessing it's because my changes have not yet been finalized to the database, but nothing has errored and I moved to the next state just fine.
So at what point do the changes actually get finalized into the database?
- Posts: 112
- Joined: 01 September 2017, 17:25
From my experience, the database is updated in your session until you finishes your routine. Therefore, when you do your changes, the info is in the database and when an exception is thrown they are reversed.
It works like in Oracle database with commit & rollbacks.
Hope it is clear
- Posts: 207
- Joined: 22 September 2015, 23:42
I would say in your case the changes should have been written to the DB, unless there was an error or exception in the previous state. If I remember correctly I had a problem with information not stored, and this might have been caused by using a "break" to stop a loop. At least it worked after removing this.
You can check the database and see what is written there.