HeladoDeBrownie / Nexus

creative sandbox game in early development
MIT License
3 stars 1 forks source link

avoid connecting to ourself over a socket #75

Closed HeladoDeBrownie closed 3 years ago

HeladoDeBrownie commented 3 years ago

using a socket to allow the host player to act the same as the others creates unnecessary indirection and duplication of resources/data. instead, co_server should always send all entity positions and movements regardless of where they came from. we can either track a last known position for every entity, or have Scene proactively call some function or provide a log of movements

HeladoDeBrownie commented 3 years ago

the logging way is very compelling especially if we consider other events such as editing of player sprites. this also would allow clients' local copies of the scene to completely determine what data needs to be sent instead of effectively doing position polling in co_client

HeladoDeBrownie commented 3 years ago

on an initial attempt, the logging way has a problem, which is that it's impractical to send every single change over the network, since they all would take a very long time to sort through. there probably needs to be a happy medium between the polling and the meticulous logging

HeladoDeBrownie commented 3 years ago

resolved by 75bc1ce809b832afd5f259df0f1f2de7b0fb0ee2 by sending the whole dang scene because it works