December 25, 2024, 09:58:51 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 ... 56 57 [58] 59 60 ... 77

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

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #855 on: July 10, 2012, 12:00:44 pm »

I can only see your IP and only if someone reports the post
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Official PyGG2 Development thread
« Reply #856 on: July 10, 2012, 12:03:02 pm »

I can only see your IP and only if someone reports the post

So why did you report me?  :hehe:
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #857 on: July 10, 2012, 12:06:51 pm »

I didn't
also that's only in some weird boards where I have moderator privilages regardless of being a moderator and I'm not sure that this is one of them
« Last Edit: July 10, 2012, 12:07:31 pm by Chartreuse »
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

ajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #858 on: July 10, 2012, 12:12:35 pm »

I didn't
also that's only in some weird boards where I have moderator privilages regardless of being a moderator and I'm not sure that this is one of them
aren't you like some community bullshit or were
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #859 on: July 10, 2012, 12:29:09 pm »

no mrfredman demoted me
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12206
Re: Official PyGG2 Development thread
« Reply #860 on: July 10, 2012, 05:54:13 pm »

Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #862 on: July 11, 2012, 02:45:12 am »

Gang Garrison 2 ALPHA JAVA REMAEK EDITION!!111.avi

are you guys even trying
We built the engine before anything else. Graphical Schnickschnack comes later.
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #863 on: July 13, 2012, 02:24:03 pm »

Code: [Select]
def Server_Snapshot_Update(client, networker, game, event):
    # Copy the current game state, and replace it with everything the server knows
    packet_time = round(struct.unpack_from(">f", event.bytestr)[0], 3)
    event.bytestr= event.bytestr[4:]

    if len(game.old_states) > 0:

        tmp = game.old_states
        tmp.sort(key=lambda x: x.time)
        #if tmp != game.old_states:
        #    print([s.time for s in game.old_states])

        old_state_times = [old_state.time for old_state in game.old_states]
        if max(old_state_times) > packet_time:
            if packet_time in old_state_times:
                # The packet time miraculously is equal one of the stored states
                state = game.old_states[old_state_times.index(packet_time)]
            else:
                # it isn't, we gotta interpolate between the two nearest
                sorted_times = old_state_times
                sorted_times.sort(key=lambda state_time: abs(state_time - packet_time))

                state_1 = game.old_states[old_state_times.index(sorted_times[0])]
                state_2 = game.old_states[old_state_times.index(sorted_times[1])]
                state = state_1.copy()
                state.interpolate(state_1, state_2, (packet_time - sorted_times[0]) / (sorted_times[1] - sorted_times[0]))
        else:
            state = game.current_state

        # Delete all the old states, they are useless. Remember that list is chronologically ordered
        while len(game.old_states) > 0:
            if game.old_states[0].time <= packet_time:
                game.old_states.pop(0)
            else:
                break
        # Also delete those too far ahead
        server_current_time = packet_time + networker.estimated_ping
        while len(game.old_states) > 0:
            if game.old_states[-1].time >= packet_time + min(networker.estimated_ping, constants.MAX_EXTRAPOLATION):
                game.old_states.pop(-1)
            else:
                break

    else:
        state = game.current_state

    if state.time < packet_time:
        state.update_all_objects(game, packet_time-state.time)

    #try:
    #    print("game.old_states: {}\n".format([s.time for s in game.old_states]), "{0} < {1} < {2}\n".format(state_1.time, state.time, state_2.time), "packet time:{}\n".format(packet_time), "server time:{}\n".format(packet_time+networker.estimated_ping))
    #except:
    #    print("game.old_states: {}\n".format([s.time for s in game.old_states]), "state.time:{0}\n".format(state.time),"current_state.time:{}\n".format(game.current_state.time), "state.time-current_state.time:{}\n".format(state.time - game.current_state.time), "packet time:{}\n".format(packet_time), "server time:{}\n".format(packet_time+networker.estimated_ping))

    # State should now be exactly what the client thinks should happen at packet_time. Now let the server correct that assumption

    for player in state.players.values():
        length = player.deserialize_input(event.bytestr)
        event.bytestr = event.bytestr[length:]

        try:
            character = state.entities[player.character_id]
            length = character.deserialize(state, event.bytestr)
            event.bytestr = event.bytestr[length:]
        except KeyError:
            # Character is dead; continue
            pass

    # Now we have exactly what happened on the server at packet_time, update it to packet_time+ping (which also happens to be the length of all old_states)

    #state.update_all_objects(game, networker.estimated_ping)

    # Update this state with all the input information that appeared in the meantime
    for old_state in game.old_states:
        state.update_synced_objects(game, min(constants.PHYSICS_TIMESTEP, old_state.time - state.time))

        old_player = old_state.players[client.our_player_id]
        input = old_player.serialize_input()

        player = state.players[client.our_player_id]
        player.deserialize_input(input)

    game.current_state = state

NAGN, where should I push this? It pretty much works, aka I think the client emulates what's happening on the server pretty well, although I couldn't do a long-range hosting test yet. Also, it's totally not smooth, there's warping (which is supposed to be there), so I'll have to take a look at buffering stuff and using it for the interpolation.
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #864 on: July 13, 2012, 03:11:39 pm »

Code: [Select]
...

game.old_states: []
 state.time:30.417
 current_state.time:30.417
 state.time-current_state.time:0.0
 packet time:30.417
 server time:30.517

game.old_states: []
 state.time:30.467
 current_state.time:30.467
 state.time-current_state.time:0.0
 packet time:30.467
 server time:30.567

game.old_states: []
 state.time:30.517
 current_state.time:30.517
 state.time-current_state.time:0.0
 packet time:30.517
 server time:30.617

Traceback (most recent call last):
  File "make.py", line 60, in <module>
    client_main.GG2main(skipmenu=True)
  File "/home/user/Programming/Python/GG2/client_main.py", line 22, in GG2main
    cm.run()
  File "/home/user/Programming/Python/GG2/client/handler.py", line 30, in run
    while self.handler.step() and not self.quitting:
  File "/home/user/Programming/Python/GG2/client/main.py", line 161, in step
    self.game.update(self.networker, frame_time)
  File "/home/user/Programming/Python/GG2/engine/game.py", line 47, in update
    self.current_state.update_all_objects(self, constants.PHYSICS_TIMESTEP)
  File "/home/user/Programming/Python/GG2/engine/gamestate.py", line 21, in update_all_objects
    for entity in self.entities.values(): entity.endstep(game, self, frametime)
  File "/home/user/Programming/Python/GG2/engine/character.py", line 131, in endstep
    if game.map.collision_mask.overlap(self.collision_mask, (int(self.x), int(self.y))):
ValueError: cannot convert float NaN to integer
user@patience:~/Programming/Python/GG2$
Great.
« Last Edit: February 18, 2024, 06:20:15 am by MedO »
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Official PyGG2 Development thread
« Reply #865 on: July 16, 2012, 01:53:08 am »

Code: [Select]
...

game.old_states: []
 state.time:30.417
 current_state.time:30.417
 state.time-current_state.time:0.0
 packet time:30.417
 server time:30.517

game.old_states: []
 state.time:30.467
 current_state.time:30.467
 state.time-current_state.time:0.0
 packet time:30.467
 server time:30.567

game.old_states: []
 state.time:30.517
 current_state.time:30.517
 state.time-current_state.time:0.0
 packet time:30.517
 server time:30.617

Traceback (most recent call last):
  File "make.py", line 60, in <module>
    client_main.GG2main(skipmenu=True)
  File "/home/user/Programming/Python/GG2/client_main.py", line 22, in GG2main
    cm.run()
  File "/home/user/Programming/Python/GG2/client/handler.py", line 30, in run
    while self.handler.step() and not self.quitting:
  File "/home/user/Programming/Python/GG2/client/main.py", line 161, in step
    self.game.update(self.networker, frame_time)
  File "/home/user/Programming/Python/GG2/engine/game.py", line 47, in update
    self.current_state.update_all_objects(self, constants.PHYSICS_TIMESTEP)
  File "/home/user/Programming/Python/GG2/engine/gamestate.py", line 21, in update_all_objects
    for entity in self.entities.values(): entity.endstep(game, self, frametime)
  File "/home/user/Programming/Python/GG2/engine/character.py", line 131, in endstep
    if game.map.collision_mask.overlap(self.collision_mask, (int(self.x), int(self.y))):
ValueError: cannot convert float NaN to integer
user@patience:~/Programming/Python/GG2$
Great.

Check all places where sqrt, log, etc is used - they can return NaN for invalid input.
« Last Edit: February 18, 2024, 06:20:32 am by MedO »
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #866 on: July 16, 2012, 05:19:35 am »

Code: [Select]
...

game.old_states: []
 state.time:30.417
 current_state.time:30.417
 state.time-current_state.time:0.0
 packet time:30.417
 server time:30.517

game.old_states: []
 state.time:30.467
 current_state.time:30.467
 state.time-current_state.time:0.0
 packet time:30.467
 server time:30.567

game.old_states: []
 state.time:30.517
 current_state.time:30.517
 state.time-current_state.time:0.0
 packet time:30.517
 server time:30.617

Traceback (most recent call last):
  File "make.py", line 60, in <module>
    client_main.GG2main(skipmenu=True)
  File "/home/user/Programming/Python/GG2/client_main.py", line 22, in GG2main
    cm.run()
  File "/home/user/Programming/Python/GG2/client/handler.py", line 30, in run
    while self.handler.step() and not self.quitting:
  File "/home/user/Programming/Python/GG2/client/main.py", line 161, in step
    self.game.update(self.networker, frame_time)
  File "/home/user/Programming/Python/GG2/engine/game.py", line 47, in update
    self.current_state.update_all_objects(self, constants.PHYSICS_TIMESTEP)
  File "/home/user/Programming/Python/GG2/engine/gamestate.py", line 21, in update_all_objects
    for entity in self.entities.values(): entity.endstep(game, self, frametime)
  File "/home/user/Programming/Python/GG2/engine/character.py", line 131, in endstep
    if game.map.collision_mask.overlap(self.collision_mask, (int(self.x), int(self.y))):
ValueError: cannot convert float NaN to integer
user@patience:~/Programming/Python/GG2$
Great.

Check all places where sqrt, log, etc is used - they can return NaN for invalid input.

The problem is another, the interpolation is still borking on some rare cases. Most of the time it works, but not always.

How's the polygon collision coming along?
« Last Edit: February 18, 2024, 06:20:48 am by MedO »
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #867 on: July 16, 2012, 07:57:16 am »

(click to show/hide)

EDIT: I'm an idiot, forgot some .copy() statements.
« Last Edit: July 16, 2012, 04:41:32 pm by Orpheon »
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: Official PyGG2 Development thread
« Reply #868 on: July 19, 2012, 08:57:17 pm »

hello nagn here with a playable beta
https://dl.dropbox.com/u/92157440/PyGG2.zip

host a server, then launch the test client (connects to local host by default so you won't crash)

right now game's a piece of shit but I hope to fix that eventually

also if someone has an issue with running the game, please tell me, and if running vcredist_x86 helped you in any way
« Last Edit: July 19, 2012, 08:59:28 pm by NAGN »
Logged

billymaze

  • Veteran Member
  • ******
  • Karma: 9
  • Offline Offline
  • Posts: 6730
Re: Official PyGG2 Development thread
« Reply #869 on: July 21, 2012, 03:03:12 pm »

How do we play it?
Logged
Pages: 1 ... 56 57 [58] 59 60 ... 77
 

Page created in 0.024 seconds with 36 queries.