May 02, 2024, 10:57:51 pm

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 2 3 [4] 5

Author Topic: When do we rewrite GG2 in a sane language  (Read 5075 times)

Orpheon

  • 2011 Haxxy Award Winner
  • *
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: When do we rewrite GG2 in a sane language
« Reply #45 on: July 15, 2011, 08:48:38 am »

What would be the first things to rewrite?

Yeah, I know a working server with a quote that walks around is great, I mean before that.

Does someone have a working concept for the collision detection and response? (copying the current one is not going to work)

Would we want to profit to restructure certain very bad things in the current version that are just to deep and grown to remove properly?
(UDP?)

And before you say "No one will be able to do this"; the more concept we put down, the easier for someone who will try.
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: When do we rewrite GG2 in a sane language
« Reply #46 on: July 15, 2011, 03:19:45 pm »

it won't be easy for anyone to do so just because you make a basic checklist
here's a basic checklist if you want

[ ] write a basic server program independent of game maker, which handles collisions properly but does not need to graphically render the game
[ ] finally move over the entire engine into a (preferably open source) engine which cuts it's ties from game maker entirely
[ ] rewrite the netcoding to be in a more quake-like udp snapshot system, and ditch the old tcp system in favor of a more lossy, but less bandwidth intensive and latency inducing way. This would require compensention for important packets, along with some sort of client-sided prediction coupled with lag compensention. None of this is necessarily, but it is preferred.


In that order respectively would smooth the transition

A basic server would not be hard to do, what would be difficult is getting the game to behave the way it does currently. Getting someone to do all this, or even the team to do this is difficult as very little of us have much experience outside of game maker and doens't have enough time

that's pretty much it
Logged

Dokurider

  • Humble Servant of the Trinity
  • Veteran Beta Tester
  • *****
  • Karma: 14
  • Offline Offline
  • Posts: 1442
  • Your sins have no absolution
Re: When do we rewrite GG2 in a sane language
« Reply #47 on: July 15, 2011, 03:40:41 pm »

Well, if you guys go with Python, you are in luck as I know Python and might be able to lend a hand.
Logged
Liked Final Fantasy Tactics, but wanted more? Then come visit:

Phantom Brave

  • All Hail Classicwell
  • Designer
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: When do we rewrite GG2 in a sane language
« Reply #48 on: July 15, 2011, 04:05:02 pm »

It's not going to happen. That's what NAGN's been trying to say.
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

Orpheon

  • 2011 Haxxy Award Winner
  • *
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: When do we rewrite GG2 in a sane language
« Reply #49 on: July 15, 2011, 04:29:39 pm »

[ ] rewrite the netcoding to be in a more quake-like udp snapshot system, and ditch the old tcp system in favor of a more lossy, but less bandwidth intensive and latency inducing way.

First of all, thanks.

Second, what do you mean with "snapshot system"? Please explain.
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: When do we rewrite GG2 in a sane language
« Reply #50 on: July 15, 2011, 04:34:26 pm »

in quake 3, the networking system basically works like this:

Everything is disposable. The only thing important is making sure that the clients get the most current game state, and they get it as fast as possible.


This opens up alot of new possibilities. Firstly, there's the movement away from tcp into udp, which is very fast and doesn't require port forwarding in some cases (socket punching) though that's irrelevent tbh to the whole decision as a whole

Basically when a missed packet is missed in the current system, tcp must freeze the socket, ask the server to resend the packet, and then unfreezes the socket. That's very slow and induces alot of latency.

In a udp based system we wouldn't need to pause for everything. If something is missed last frame, such as the position of a player, it doesn't really matter. The next frame will be updated so quickly that you won't even notice the brief decync. This makes the game artificially much much smoother
Logged

Orpheon

  • 2011 Haxxy Award Winner
  • *
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: When do we rewrite GG2 in a sane language
« Reply #51 on: July 15, 2011, 04:44:27 pm »

in quake 3, the networking system basically works like this:

Everything is disposable. The only thing important is making sure that the clients get the most current game state, and they get it as fast as possible.


This opens up alot of new possibilities. Firstly, there's the movement away from tcp into udp, which is very fast and doesn't require port forwarding in some cases (socket punching) though that's irrelevent tbh to the whole decision as a whole

Basically when a missed packet is missed in the current system, tcp must freeze the socket, ask the server to resend the packet, and then unfreezes the socket. That's very slow and induces alot of latency.

In a udp based system we wouldn't need to pause for everything. If something is missed last frame, such as the position of a player, it doesn't really matter. The next frame will be updated so quickly that you won't even notice the brief decync. This makes the game artificially much much smoother

I know what UDP is. My question was what kind of structure needs changing to achieve this:
Quote
Everything is disposable
, because I can't really imagine how we should change what.
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: When do we rewrite GG2 in a sane language
« Reply #52 on: July 15, 2011, 04:56:21 pm »

simple: we don't compensate packets
Logged

Orpheon

  • 2011 Haxxy Award Winner
  • *
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: When do we rewrite GG2 in a sane language
« Reply #53 on: July 15, 2011, 05:03:13 pm »

simple: we don't compensate packets
I fell very dumb, but what do you mean by that? Do we not expect packets, and just take those that appear? Do we try to guess how the game will go, and just take any packet that chances our way, without really expecting any?

What?
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: When do we rewrite GG2 in a sane language
« Reply #54 on: July 15, 2011, 05:08:41 pm »

Send snapshots of the current game state

if anything's lost, it'll be in the next update so it doesn't matter

:I
Logged

Orpheon

  • 2011 Haxxy Award Winner
  • *
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: When do we rewrite GG2 in a sane language
« Reply #55 on: July 15, 2011, 05:15:31 pm »

Send snapshots of the current game state

if anything's lost, it'll be in the next update so it doesn't matter

:I
Oh.

Ok.
Logged

notajf

  • Guest
Re: When do we rewrite GG2 in a sane language
« Reply #56 on: July 16, 2011, 09:45:15 am »

Well, I was working on this. I'm just not sure how to design it. I was basically copying the Game Maker design (objects with events, speeds and sprites, and steps), but perhaps a different design is a good idea. Hmm.
Logged

notajf

  • Guest
Re: When do we rewrite GG2 in a sane language
« Reply #57 on: July 16, 2011, 10:53:42 am »

A design I just thought of, which is probably better than what I thought of before, for objects.
Objects do not necessarily have properties. However, some have x and y, for instance.
A plain GameObject doesn't actually do anything. It can be extended to provide movement and drawing however. But as the base GameObject doesn't have any default behaviour, it means objects that are invisible don't unnecessarily waste space.

An object can register itself for the draw event so it is drawn, and provide a method to be called. It provides a z-index for sorting.
Similarly, an object can register for the begin step, step and end step events (similarly to game maker).
So, something like this:
Code: [Select]
class GameObject:
    """
    Class all game objects inherit from.
    """
    
    def __init__(self, environment):
        self.environment = environment

class MyFancyObject(GameObject):
    """
    A fancy game object!
    """

    def __init__(self, environment, x=0, y=0):
        GameObject.__init__(self, environment)
        self.x, self.y = x, y
        self.sprite = load_sprite("lol.png")
        self.environment.register_event("draw", self.draw, zindex=20)
        self.environment.register_event("step", self.step)

    def step(self):
        self.x += 2
        self.y += 3

    def draw(self, canvas):
        canvas.draw(self.sprite, self.x-self.enviroment.viewport[0], self.y-self.enviroment.viewport[1])

This isn't that different from the game maker coding style, which would make porting easier.
« Last Edit: July 16, 2011, 10:56:06 am by ‫‮‏fja »
Logged

Orpheon

  • 2011 Haxxy Award Winner
  • *
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: When do we rewrite GG2 in a sane language
« Reply #58 on: August 12, 2011, 04:44:32 am »

(click to show/hide)

Though I'm wondering what would be a better language, C++ or Python.

Both have their Pros and Cons, and I'm really unsure which I should stick to.

Question Libraries, Python has Pygame, and for C++ the best option would probably be SFML (although SFML also exists for Python).


Also I'm a bit unsure as to how to manage sprites. Loading them from a file at creation is probably pretty inefficent, so we'll probably need a sprite manager or something that loads all images in memory and then just gives the images away.


And no, multiplayer doesn't have to be in from the start. Coding everything in the Character object + coding maps + coding all the weapons and classes is already a big thing that can be done (almost) completely independently of networking.
« Last Edit: August 12, 2011, 05:19:26 am by Orpheon »
Logged

MedO

  • Owns this place
  • *****
  • Karma: 151
  • Offline Offline
  • Posts: 1752
Re: When do we rewrite GG2 in a sane language
« Reply #59 on: August 14, 2011, 05:45:57 pm »

I just randomly noticed that there is a LUA wrapper for Game Maker, unsurprisingly called gmlua. It can apparently call into GML functions by using the dark magic of GMAPI, so a relatively tight integration between LUA and GML is possible. However, GMAPI only works with GM up to version 8.0 and doesn't seem very active, so if we did use it, we might not be able to switch to GM 8.1. GMAPI is LGPL licensed, so we could always do the porting ourselves, but I don't really feel like taking on yet another GM extension projekt at the moment.

On the upside, having coroutines could dramatically simplify the netcode. If I understand them correctly (I never actually used coroutines yet), they would allow writing netcode almost as if the calls were blocking. That is, you could have a function receiveOrYield(socket, size) that will only return once the requested ammount has been read, and in the meantime it wouldn't block the thread, but allow the game to continue running. It would also improve the possibilities of script-based modding. And if done well, the game logic might be translated to LUA bit by bit, until we only have the bare "engine" in GML, which could then be recreated in a different host language to migrate completely away from Game Maker.

I didn't spend any time actually planning this so there might be glaring flaws. Just putting it here as an idea. I still won't have time to do this kind of thing for a while now.
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.
Pages: 1 2 3 [4] 5
 

Page created in 0.064 seconds with 36 queries.