18.05.06 okay, iam almost done rewriting the system so that every player only uses 1 entity of his own. sending positions is done via skills. ill explain the whole movement system in total once its clean and works good.

a very important thing i came across is that whenever you create entities in a network game you should have sleep(1); set as the first statement in the entities action. if you dont, you will get problems that some clients dont get this entity.

this is what happend to me when i was testing with 4 clients total. some just didnt get updates from others. very strange. a sleep(1) at the beginning of the entities action solved my problem.

i then tested the game with a friend again over the net. it worked good like bevore. i just measured that i have an average up and download of ~0.5 kb per second as host. for comparison if i host a wc3 game for 10 players i have like 5kb download and 5-10kb upload per second.
maybe i can stay below that with my game who knows yet.

my problem now still is the movement at the client. i sent the position to go to to the host. and the host then calculates in the entities server function the movement. so far this works like a charm.
then i sent data back with SEND_RATE in a skill only when the entity is moving at the host.
my problem still is to get a smooth movement out of this at the client. this is what iam working on right now. this code also needs to take into account dropped packets.

what i will do is move to the first received point, then keeping this direction but getting slower constantly until the next position comes in. then ill turn slowly to this new position and increase speed to normal.

i also realised that send_skill is a problem. because it sends to all clients or to the creator only. but for updating others players positions you have to send to all! thats where the problem is. its a waste of bandwith. imagine only 1 out of 10 players see a certain player of those 10. now all 9 others get this data too and cant even display him because of fog of war. so its a waste of bandwith.

the next problem is, that when you sent position updates to all players you enable them to cheat. only thing they would have to do is read the data they get and thus they know where the other players are. or even worse simply remove the fog of war.

thats why i suggested a send_skill_to statement in the future forum.

http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/655449/an/0/page/0#Post655449

please support this idea by posting there if you think its a good one. let me know if you have some possible workarounds in mind. thanks.

edit: i forgot. i think i found a problem? in locoweeds code if i can call it so. he sends the player number to all players once a new player joins in the function running at the server. this is fine so far the only problem is that newer players dont get the player numbers of those players already in the game. maybe iam totally wrong here but i solved this with a ent_next loop in the entities function at the server. so it loops through all entities, checks if this entity has a playernumber and then sends it to all clients. maybe iam totally wrong here and the newer players dont even need the playernumber skill from the ones already in the game. in my case they do because if for example you want to attack another player you have to let the server know wich one you want to attack therefore every client needs to know every other players unique playernumber skill.

Last edited by ulf; 05/18/06 12:04.