Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network #14

Open
zzorn opened this issue May 19, 2010 · 1 comment
Open

Network #14

zzorn opened this issue May 19, 2010 · 1 comment
Labels

Comments

@zzorn
Copy link
Owner

zzorn commented May 19, 2010

Structural logic

To be later defined more accurately
class Ship
{
int id;
int health;
Vector3 position;
Quaternion rotation;
Vector3 velocity;
Vector3 forceVector;
}

Network logic

enum GamePacketType {Connect, Disconnect, Ship, Asteroid}

struct GamePacket
{
GamePacketType type;
Stream dataStream;
}

enum EntityEventType {Spawn, State, Remove}

GamePacketType Ship
{
int id;
EntityEventType type;

switch(type)
{
    case EntityEventType.State:
        ships[id].health;
        ships[id].position;
        ships[id].rotation;
        ships[id].velocity;
        ships[id].forceVector;
    break;
    case EntityEventType.Spawn:
        ships[id] = new Ship();
        ships[id].position;
        ships[id].rotation;
    break;
    case EntityEventType.Remove:
        destroy ships[id];
    break;
}

}

GamePacketType Asteroid
{

}

@paranox
Copy link
Collaborator

paranox commented May 20, 2010

Network code enables synchronizing of player ships if network session were initialized and updates were called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants