December 25, 2024, 09:07:56 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Wondering where all the forums have gone?

Join the community Discord server!

Pages: 1 ... 19 20 [21] 22 23 ... 77

Author Topic: Official PyGG2 Development thread  (Read 161428 times)

Madness9001

  • Seasoned Member
  • *****
  • Karma: 0
  • Offline Offline
  • Posts: 1453
Re: Porting GG2 to Python - PyGG2
« Reply #300 on: November 21, 2011, 11:34:38 am »

Also, we program like real hardcores, we program with this keyboard:

(click to show/hide)
Obvius stolen image form General Chatter
Uhh...You do know we double-posted?

We communicate quite a lot over skype, you know.
http://www.ganggarrison.com/forums/index.php?topic=22155.msg1009478;boardseen#new

Also no i don't know
« Last Edit: November 21, 2011, 11:42:08 am by Gentle Cherrytop »
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #301 on: November 21, 2011, 11:40:18 am »

After several hours of reading, thinking and arguing, Nightcracker and I managed to hammer out a networking system.

The whole thing resembles the Quake 3 Networking system a lot, which basically works like this:

The server sends a snapshot update at a constant rate, pumping all the data which doesn't have to be reliable, like player x/y, velocities, states (hp) and stuff.

When an event happens, the server immediately sends that event everywhere (asynchronously). It also appends that event to a player-specific event buffer.
In each update to a player, the whole event buffer that hasn't been acked yet gets sent before the snapshot.

When a client receives a packet, it updates a "last_received_packet" variable. This variable is sent in each input update the client sends (which is asynchronous too).
The server, when it gets that ack, deletes all the buffered events that were in that packet, and continues.

Stuff gets even more complicated though, because we want to use delta compression. This means we only send the difference between two packets, which means only sending the XOR of the new packet over the old one.
This means we also have to send the packet which the new packet is based on, and update this with incoming acks. This also means both clients and server have to buffer a certain number of packets.

Code: (Some Google Doc we use for writing thoughts down) [Select]
PyGG2 PROTOCOL CONCEPT


char = 1 byte - ascii, implementation defined
byte = 1 byte - integer, range [-128, 127]
ubyte = 1 byte - integer, range [0, 255]
short = 2 bytes − integer, range [-32768, 32767]
ushort = 2 bytes - integer, range [0, 65535]
int = 4 bytes −  integer, range [-2147483648, 2147483647]
uint = 4 bytes - integer, range [0, 4294967295]
long = 8 bytes  − integer, range [-9223372036854775808, 9223372036854775807]
ulong = 8 bytes - integer, range [0, 18446744073709551615]
float = 4 bytes - floating point, single precision
double = 8 bytes - floating point, double precision
bin[n] = n bytes - binary data



bit inputstate {
    bit left;
    bit right;
    bit up;
    bit mouseleft;
    bit mouseright;
}

struct snapshot_player_base {
    bin[1] inputstate;
    ushort aimdirection;
    uint x;
    uint y;
    short hspeed;
    short vspeed;
    ubyte hp;
}

All: afterburn, movestatus
Scout: doublejump
Pyro: no afterburn
Soldier: ---
Heavy: Sandvich
Demo: stickies (amount)
Medic: Ubercharge, ubercharge rate, healing ramp
Engie: Nuts&Bolts
Spy: ---
Sniper: Damage(?)


Methods

def send_complete_update {

[ACKED; Server-->Client]

for player in players:
{
       send: ServerPlayerJoin(player.name, buffer);
       send: ServerPlayerChangeclass(id, player.class, buffer);
       send: ServerPlayerChangeteam(id, player.team, buffer);
}

for player in players:

    send: stats[KILLS, DEATHS, HEALING, etc...]
    if player.character is alive,
    {
        send: player.input and aimdirection
        send: player.positions and velocities
        send: player.hp and weapon ammo
        send: is cloaked?
        send: weapon.readytoshoot
    }

    if player.sentry exists,

{
        send: original pointing direction
        send: positions
        send: built y/n?
        send: hp
    }


    ::Send Gamemode information::
}



Handshake

[ACKED; 2-Way]

> client hello
name; pass if any;

> server hi
if pass = incorrect: notify incorrect pass and kick
if numplayers >= maxplayers: notify server full and kick
send: servername; numOfPlayers; mapName, version

send_complete_update()





Snapshot_update

[NOT_ACKED; Server-->Client]

Send all player positions and speed.

for player in players {

if player is alive,

{

    send: player.input and aimdirection

    send: player.positions and velocities

    send: player.hp and ammo

    send: cloaked(y/n)?
    {
}


Packet pre- and suffixes:

server -> client

ushort sequence;
ushort delta_sequence;
ushort last_acked_sequence;


client -> server

ushort sequence;
ushort ack_sequence;

« Last Edit: November 21, 2011, 12:33:46 pm by Orpheon »
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Porting GG2 to Python - PyGG2
« Reply #302 on: November 21, 2011, 04:18:40 pm »

Today I realized something:

Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #303 on: November 21, 2011, 04:19:58 pm »

Does anyone know any good real-time code collab editing software?
« Last Edit: November 21, 2011, 04:20:33 pm by Orpheon »
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: Porting GG2 to Python - PyGG2
« Reply #304 on: November 21, 2011, 04:27:32 pm »

Today I realized something:


HOW DID YOYU DO THATAT?!?!?!?
Logged

Madness9001

  • Seasoned Member
  • *****
  • Karma: 0
  • Offline Offline
  • Posts: 1453
Re: Porting GG2 to Python - PyGG2
« Reply #305 on: November 21, 2011, 04:28:03 pm »

Today I realized something:

(click to show/hide)
HOW DID YOYU DO THATAT?!?!?!?
Doing my job
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Porting GG2 to Python - PyGG2
« Reply #306 on: November 21, 2011, 04:49:48 pm »

Do what?
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: Porting GG2 to Python - PyGG2
« Reply #307 on: November 21, 2011, 04:56:39 pm »

the file browser
Logged

MedO

  • Owns this place
  • *****
  • Karma: 151
  • Offline Offline
  • Posts: 1754
Re: Porting GG2 to Python - PyGG2
« Reply #308 on: November 21, 2011, 05:32:19 pm »

You know Notepad++ has a file browser like that? (Extensions->Light Explorer)
Also, that's why I use vertical tabs in my web browser.
« Last Edit: November 21, 2011, 05:32:28 pm by MedO »
Logged
Quote from: Alfred North Whitehead
It is the business of the future to be dangerous; and it is among the merits of science that it equips the future for its duties.

Quote from: John Carmack
[...] if you have a large enough codebase, any class of error that is syntactically legal probably exists there.

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #309 on: November 22, 2011, 08:42:20 am »

We found an IDE.

« Last Edit: November 22, 2011, 08:45:36 am by Orpheon »
Logged

notajf

  • Guest
Re: Porting GG2 to Python - PyGG2
« Reply #310 on: November 22, 2011, 01:24:47 pm »

We found an IDE.


I've already tried Komodo Edit

I didn't like the slow startup
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #311 on: November 22, 2011, 01:25:49 pm »

We found an IDE.


I've already tried Komodo Edit

I didn't like the slow startup
Slow startup? You mean the 3 seconds?
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: Porting GG2 to Python - PyGG2
« Reply #312 on: November 22, 2011, 03:39:11 pm »

We found an IDE.


I've already tried Komodo Edit

I didn't like the slow startup
>visual studio


 :hehe:
Logged

notajf

  • Guest
Re: Porting GG2 to Python - PyGG2
« Reply #313 on: November 22, 2011, 03:53:51 pm »

We found an IDE.


I've already tried Komodo Edit

I didn't like the slow startup
>visual studio


 :hehe:
even VS starts faster =/
Logged

Flaw

  • Junior Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 109
Re: Porting GG2 to Python - PyGG2
« Reply #314 on: November 24, 2011, 12:35:04 pm »

I am partially alive. I'll occasionally be checking this thread to see if game structure has reached a ready point, and then start working on gameplay mechanics (rounds, autoguns, ammo, etc) and some generic stuff (health HUD, player list, etc).
Logged
Pages: 1 ... 19 20 [21] 22 23 ... 77
 

Page created in 0.025 seconds with 36 queries.