CSM icon indicating copy to clipboard operation
CSM copied to clipboard

Syncing creation and destruction of citizens

Open Treholt3103 opened this issue 6 years ago • 9 comments

I Tried syncing the upgrading of buildings, but the process seems bound to the education level of the citizens.

Citizens are created with a random id, and we should be able to sync the creation of them like we are syncing buildings, roads ect. and since they don't constantly have to sync but only on creation, destruction (and building upgrade) it should not be a massive resource hog.

however since both server and clients are creating citizens, i think we have to remove the citizen creation on the client side, else they will be created in double rate, and possible we are gonna have a problem with the removal of citizens where they are removed faster than in the original game, but hopefully that wont be a problem.

Treholt3103 avatar Dec 20 '18 14:12 Treholt3103

I also noticed this problem and I wanted to fix it, but I found there is no api for changing the population

Dywane avatar Jan 06 '19 13:01 Dywane

It should be posible to do using Harmoni

Treholt3103 avatar Jan 06 '19 13:01 Treholt3103

Emmm.. what is “Harmoni”?

Dywane avatar Jan 06 '19 13:01 Dywane

Oh, it is Harmony

Dywane avatar Jan 06 '19 13:01 Dywane

Ahh yes sorry mobile devise keyboard ;)

Treholt3103 avatar Jan 06 '19 14:01 Treholt3103

Hey there. Just wondering what the easiest course of action is to fix the money sync issue. Is syncing citizens going to be harder than a periodic sync on money? I'm guessing as well that there isn't a simple way to sync population... it wouldn't be possible to sync citizens without having generated buildings sync'd too, would it?

tangles-0 avatar Jun 11 '21 15:06 tangles-0

I've started a new branch to try and add citizen sync. I'm not very experience in this game so help is greatly appreciated.

My current attempt at implementing this will be to ignore changes to citizens performed by client's and broadcast only the ones the host has. Then on the client side add everything that comes from network. How am I doing this? no clue yet, looking into it :P

But please do provide feedback if u think this is the right approach or not.

joaogl avatar Jul 02 '21 09:07 joaogl

I think the approach should work like that. The only problem I see is that the amount of packets could be too much for performance reasons. It would be nice if you could test how often these methods get called in a large city for example. Then we can decide if this is the way to go. An alternative would be to synchronize the RNG seeds, as most parts of the game are based on some kind of seeded randomness.

kaenganxt avatar Jul 02 '21 20:07 kaenganxt

have been using this for couple games, this is so amazing project and made this game a lot more fun playing with friends.

and this is the only major issue that I observed. hope this can be fixed.

ibigbug avatar Apr 21 '22 10:04 ibigbug