can i save data to es in game logic thread.
applyChange and read data in jme main update thread?
The âgame logic threadâ is the âjme main update threadâ. They are one and the same.
no, i make a new thread run game logic
what es are you using? Zay-es for example is thread-safe
Then - again - for what seems like a continous cycle - youâre doing it wrong. You are on your own because you refuse to follow the rules. You make your own rules, you fix your own problems. I canât iterate this enough. I have no idea why you are so stubborn.
i am make a Frame synchronization rts game! the game logic only run 10 time per secondďźand the jme main update run 60 time per s!
float time = 0;
float maxTime = 1.0f / 10.0f; // your desired update rate.
public void update(float tpf) {
time += tpf;
if (time < maxTime) {
return;
}
// do something.
time = 0;
}
Itâs as simple as that. Now my update logic runs at whatever rate I want it to.
Zay-ES is thread safe. Game logic can update components. View can see them after applyChanges(). Everything is safe assuming the components follow the âdata onlyâ rules and are immutable.