yvsarkisyan / keeperfx

Automatically exported from code.google.com/p/keeperfx
0 stars 0 forks source link

[Coding question]How to distinguish whether user is in menu/in game/in possession mode, etc #559

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To make features like advanced mouse control, possession mode key binding, etc, 
I need to distinguish which state is user currently in, do you have recommended 
flag in your mind that I can use without creating myself?

Original issue reported on code.google.com by HeMeng86@gmail.com on 8 Apr 2015 at 1:51

GoogleCodeExporter commented 9 years ago
Things like that are supposed to be handled in "get_inputs()" function, in 
there you have several sub-functions for various player modes, including 
possession (get_creature_control_action_inputs()) and dungeon view 
(get_dungeon_control_action_inputs()).

Just make sure you're using packets for every action - otherwase your changes 
will damage network synchronization.

Packets are used to exchange information between players in network game, so 
all inputs are first reflected in Packet struct, and then after reading this 
struct again are used to make change to Dungeon, Player or other game 
structures.

Changes to game structures cannot be done without the use of Packets, unless 
they're for computer players (which are using game_action() instead, as they 
are making the same decisions on all hosts and don't need synchronization).

Original comment by mefistotelis on 9 Apr 2015 at 5:25

GoogleCodeExporter commented 9 years ago
I see, thanks for answering

but by

"Just make sure you're using packets for every action - otherwase your changes 
will damage network synchronization."

Does this include the case involving only one player like rotating camera? I 
was planning to skip using packet to percisely control how many degrees to 
rotate by mouse drag, to make it feel more 'responsive'

Original comment by HeMeng86@gmail.com on 10 Apr 2015 at 3:19

GoogleCodeExporter commented 9 years ago
Mouse position is transferred within packets to some extent, but I'm not sure 
whether it goes there in form of coordinates.

I remember making changes to transfer coordinates in form of position on the 
in-game map, so that the screen coords (which are unreliable to interpret by 
another machine) will not be used.

But I'm not sure if the coords were completely removed.

I guess the best would be to do the changes, and test locally whether it causes 
desync. You may run two KeeperFX'es locally in windowed mode to simulate 
network.

Original comment by mefistotelis on 10 Apr 2015 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by HeMeng86@gmail.com on 28 Apr 2015 at 4:45