src/proto2/Network.hh
author terom
Mon, 24 Nov 2008 17:14:29 +0000
changeset 96 4a801210096c
parent 89 825c4613e087
child 107 505bfa531496
permissions -rw-r--r--
fix movement physics+network code to some degree, jumping is now buggy?
#ifndef NETWORK_HH
#define NETWORK_HH

#include "NetworkConfig.hh"
#include "GameState.hh"

#include <ClanLib/network.h>

const int32_t COORDINATE_MAX = 1 << 30;

class NetworkCore {
    protected:
        GameState &state;

        CL_SlotContainer slots;

        // constructor
        NetworkCore (GameState &state) : state(state) { }




};

enum NetworkChannel {
    /*
     * Core channel used for NetworkSession
     */
    NETCHAN_CORE            = 0x01,
};

enum NetworkMessage {
    NETMSG_PACKET_INVALID   = 0x00,

    /*
     * You have joined the game:
     *
     *  Vector      initial_position
     */
    NETMSG_SERVER_HELLO = 0x0100,

    /*
     * New client has connected to server:
     *  
     *  Vector      initial_position
     */
    NETMSG_PLAYER_JOIN  = 0x0101,

    /*
     * Client has left server:
     *
     */
    NETMSG_PLAYER_QUIT  = 0x0102,

    /*
     * Client has moved
     *
     *  uint16_t    PlayerInput_Move
     */
    NETMSG_CLIENT_MOVE  = 0x0201,
    
    /*
     * Initial player info
     *
     *  Vector      initial_position
     */
    NETMSG_PLAYER_INFO  = 0x0300,

    /*
     * Player position update
     *
     * Vector   position
     * Vector   velocity
     */
    NETMSG_PLAYER_POSITION  = 0x0301,
};

#endif