I just had a minor suggestion for your net-code optimisation, as I have had a similar issue you are facing with your game.
Currently I predict your model to be this for networking
clientside-lua <-> game <-> client-socket <-> server-socket <-> server lua
if this is so, each server tick waits for all objects and entities to finish updating.
The problem is if the objects updating takes longer than a server tick, the server starts to stutter. (you know this already; i know)
Couldn't you change the model of the game to use the lua yield statements in a co-routine to exit prematurely out of expensive AI code, so that you can send client updates of model positions and other network data, before all objects are finished updating.
This would mean that you could send entity states prematurely, this would also be chunking the update.
Thus you would potentially be saving a larger portion of time.
Also, I highly recommend using LuaJIT as it's a lot faster than standard Lua. (if you use FFI properly and wrap your userdata cleverly) updating to this alone would probably save you having to manually optimise.
Suggestion
Gordo
I just had a minor suggestion for your net-code optimisation, as I have had a similar issue you are facing with your game.
Currently I predict your model to be this for networking
clientside-lua <-> game <-> client-socket <-> server-socket <-> server lua
if this is so, each server tick waits for all objects and entities to finish updating.
The problem is if the objects updating takes longer than a server tick, the server starts to stutter. (you know this already; i know)
Couldn't you change the model of the game to use the lua yield statements in a co-routine to exit prematurely out of expensive AI code, so that you can send client updates of model positions and other network data, before all objects are finished updating.
This would mean that you could send entity states prematurely, this would also be chunking the update.
Thus you would potentially be saving a larger portion of time.
Also, I highly recommend using LuaJIT as it's a lot faster than standard Lua. (if you use FFI properly and wrap your userdata cleverly) updating to this alone would probably save you having to manually optimise.
Link to comment
Share on other sites
1 answer to this suggestion
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now