Thanks to the shoulder of Colyseus
Posts made by zgz682000
Hava a try and give me some advices and issues
My game has a unlimited size map, and every grid of the map is lazy initialized as soon as any player discover it. I cached the data of map grids in a Dictionary with keys such as "x,y". When the number of players comes to 200, as they discover more and more regions of the map, the memory of my game will increace to 1G in one hour, and be killed by system soon.
I have tried to cache the map data into redis asyncly, but it will increace the cpu and I/O pressure obviously, and brings me many async logic bugs. So my question is, do I have any other choise to cache the map data?
games are stateful. It's very useful conception. Thank you again！
Thank you so much for replying. I have no use-case, I am just considering this for curiosity. As I know, first of all, the amount of Node.js usable memory is very limited, so storing room state into database would help one server hosting more rooms; secondly, network service programming prefers maintaining no state data in memory, for the risk of losing when service down. Did I understand them correctly? Thank you so much for teaching！
I am very new for websocket battle server. I just wonder to know the usage of caching db (redis for example) . From documents and examples on colyseus website, I have read that the battle data and battle state may be stored in the server memory by room.state, and patched to the client every fps by colyseus mechanism. Can I store them to caching db and still patch them by the colysues mechanism ? And Is it necessary？ Thank you so much for teaching！