January 09, 2025, 03:53:02 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 ... 29 30 [31] 32 33 ... 77

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

MedO

  • Owns this place
  • *****
  • Karma: 151
  • Offline Offline
  • Posts: 1755
Re: Porting GG2 to Python - PyGG2
« Reply #450 on: January 14, 2012, 07:54:11 am »

Sorry Gangsterman, but there is no way to explain even the most important differences in a small forum post, and this thread would be the wrong place for it anyway.
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.

MTK5012

  • 2011 Haxxy Finalist
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 773
  • if (ping <= 150) jaw.y += 100;
Re: Porting GG2 to Python - PyGG2
« Reply #451 on: January 14, 2012, 08:07:58 am »

kay,no prob,sorry for that

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Porting GG2 to Python - PyGG2
« Reply #452 on: January 14, 2012, 03:36:16 pm »

I'm sorry if I seemed like I was being pretentious for laughing at your post, but that's exactly what I would have posted if I were a normal member, which I treat myself as. However, that's not fit behavior for the section to begin with, so that's no excuse.
The only really incredibly wrong part of your post was your description of Java. It does ~not~ have to run inside of browsers, it just needs the JVM to run. Minecraft's launcher doesn't use a browser. EXEs that launch java applications have a lot in common with .NET applications, though they aren't exactly the same thing.
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

MTK5012

  • 2011 Haxxy Finalist
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 773
  • if (ping <= 150) jaw.y += 100;
Re: Porting GG2 to Python - PyGG2
« Reply #453 on: January 14, 2012, 07:23:04 pm »

That was my thought
And sorry for being a moron,posting unrelated stuff,i will try to use pm or irc instead next time

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: Porting GG2 to Python - PyGG2
« Reply #454 on: January 14, 2012, 10:07:30 pm »

what is the differents of C++,Java and Python?
in my mind:
C++:fast as hell but very hard to code,do powerful stuff but have little functions(i learned 12%)
Java:Normal,in the middle,the reason why i don't like java is every java game i had seen had to work on browser,i want stand-alone! (not count MineCraft,that's the launcher,not the game itself)
Python:faster than gmk but slower than C++,easy to learn and has many functions
They're very different, in reality the speed is negligible between Java and well-optimized C++ code. The main difference though is how they work, C++ is a compiled language while Java uses a form Just-in-Time compilation for optimization

Python is a useful scripting language, which isn't very often used for video games. I don't know really much about python
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Porting GG2 to Python - PyGG2
« Reply #455 on: January 15, 2012, 05:34:24 am »

I was reading through the PyGG2 code, trying to grok everything.  I noticed that, every frame, you're completely copying every single entity.  Surely that won't scale well.  Is there a good reason for that design decision?

I'm not trying to suggest we embark on some premature optimization, but this seems like a strange design choice and is in a core part of the engine; it would be difficult to refactor later.

It is a design decision. You see, we need to have the complete game state in one huge "struct". In our case that's the Gamestate class. We need to copy it for each physics frame, and we interpolate between two gamestates for the rendering. If we have this we can do lag compensation, interpolation and all kinds of nifty stuff that would be nigh impossible without it.

Or do you have some sort of genious alternative?
Logged

Nukleus

  • Guest
Re: Porting GG2 to Python - PyGG2
« Reply #456 on: January 15, 2012, 06:51:31 am »

Alright I've started a pyGG2 Skype conversation, so we can read over everything discussed easily and keep track of what's happening.
NC, accept my contact request and I'll add you to it.

Anyone else that wants to join, add me as a contact :P
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #457 on: January 15, 2012, 11:11:12 am »

Alright I've started a pyGG2 Skype conversation, so we can read over everything discussed easily and keep track of what's happening.
NC, accept my contact request and I'll add you to it.

Anyone else that wants to join, add me as a contact :P
We kinda use #gg2_dev as a channel, and it has worked fine.

Whatever, just join both :P
Logged

cspotcode

  • Coder
  • Administrator
  • *****
  • Karma: 134
  • Offline Offline
  • Posts: 412
Re: Porting GG2 to Python - PyGG2
« Reply #458 on: January 15, 2012, 08:21:15 pm »

I was reading through the PyGG2 code, trying to grok everything.  I noticed that, every frame, you're completely copying every single entity.  Surely that won't scale well.  Is there a good reason for that design decision?

I'm not trying to suggest we embark on some premature optimization, but this seems like a strange design choice and is in a core part of the engine; it would be difficult to refactor later.

It is a design decision. You see, we need to have the complete game state in one huge "struct". In our case that's the Gamestate class. We need to copy it for each physics frame, and we interpolate between two gamestates for the rendering. If we have this we can do lag compensation, interpolation and all kinds of nifty stuff that would be nigh impossible without it.

Or do you have some sort of genious alternative?

Nope, I don't have a genius alternative, just some ideas that you may or may not have already considered :D

I understand it's needed for interpolation.  My concern is that it's a lot of heap allocation, and not all of an entity's members are used for interpolation.  Have you considered ways to let entities only duplicate the members needed by their interpolation methods, reducing the amount of copying that happens every frame?

Of course, without a proper benchmark, I can't say for certain that my way is better.  And I also understand it's important to keep code simple.



Also, I don't quite understand this code snippet from GameState.interpolate()
Code: [Select]
            if id in prev_state.entities:
                prev_entity = next_state.entities[id]
            else:
                prev_entity = entity

            self.entities[id].interpolate(prev_entity, entity, alpha)

It looks like prev_entity will always point to an entity from next_state instead of prev_state.  Thus interpolation will be performed between two identical states instead of between the previous and next states.
Logged
"The knack of flying is learning how to throw yourself at the ground and miss."
- Douglas Adams

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Porting GG2 to Python - PyGG2
« Reply #459 on: January 16, 2012, 07:36:56 am »

I was reading through the PyGG2 code, trying to grok everything.  I noticed that, every frame, you're completely copying every single entity.  Surely that won't scale well.  Is there a good reason for that design decision?

I'm not trying to suggest we embark on some premature optimization, but this seems like a strange design choice and is in a core part of the engine; it would be difficult to refactor later.

It is a design decision. You see, we need to have the complete game state in one huge "struct". In our case that's the Gamestate class. We need to copy it for each physics frame, and we interpolate between two gamestates for the rendering. If we have this we can do lag compensation, interpolation and all kinds of nifty stuff that would be nigh impossible without it.

Or do you have some sort of genious alternative?

Nope, I don't have a genius alternative, just some ideas that you may or may not have already considered :D

I understand it's needed for interpolation.  My concern is that it's a lot of heap allocation, and not all of an entity's members are used for interpolation.  Have you considered ways to let entities only duplicate the members needed by their interpolation methods, reducing the amount of copying that happens every frame?

Of course, without a proper benchmark, I can't say for certain that my way is better.  And I also understand it's important to keep code simple.



Also, I don't quite understand this code snippet from GameState.interpolate()
Code: [Select]
            if id in prev_state.entities:
                prev_entity = next_state.entities[id]
            else:
                prev_entity = entity

            self.entities[id].interpolate(prev_entity, entity, alpha)

It looks like prev_entity will always point to an entity from next_state instead of prev_state.  Thus interpolation will be performed between two identical states instead of between the previous and next states.

Good catch about that last thing, that indeed was an error. I fixed it in the latest commit.
Logged

Dusty

  • 2012 Haxxy Award Winner
  • *
  • Karma: -78
  • Offline Offline
  • Posts: 10312
  • Dust in a box under a table
Re: Porting GG2 to Python - PyGG2
« Reply #460 on: January 16, 2012, 07:50:16 pm »

So, quick question before my phone dies on me. How well does python handle large arrays (100x100 and up), and can it handle 3d arrays? when using game maker's ds_grid stuff I noticed it started lagging considerably when I bumped the world size from 100^2 to 125^2.

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #461 on: January 17, 2012, 02:03:39 am »

So, quick question before my phone dies on me. How well does python handle large arrays (100x100 and up), and can it handle 3d arrays? when using game maker's ds_grid stuff I noticed it started lagging considerably when I bumped the world size from 100^2 to 125^2.
Uhh... GML does have 2d/3d/4d arrays.
Code: [Select]
array[0, 0, 0, 0] = something
ds_grid is not an array.
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Porting GG2 to Python - PyGG2
« Reply #462 on: January 17, 2012, 07:11:59 am »

So, quick question before my phone dies on me. How well does python handle large arrays (100x100 and up), and can it handle 3d arrays? when using game maker's ds_grid stuff I noticed it started lagging considerably when I bumped the world size from 100^2 to 125^2.

Quite well, and since Python list's can store anything (so you can have a list of numbers, but also a list of numbers AND strings), a multi-dimensional array is simply a list of lists.
Logged

Dusty

  • 2012 Haxxy Award Winner
  • *
  • Karma: -78
  • Offline Offline
  • Posts: 10312
  • Dust in a box under a table
Re: Porting GG2 to Python - PyGG2
« Reply #463 on: January 17, 2012, 11:52:34 am »

So, quick question before my phone dies on me. How well does python handle large arrays (100x100 and up), and can it handle 3d arrays? when using game maker's ds_grid stuff I noticed it started lagging considerably when I bumped the world size from 100^2 to 125^2.
Uhh... GML does have 2d/3d/4d arrays.
Code: [Select]
array[0, 0, 0, 0] = something
ds_grid is not an array.
ds_grids are arrays, in the sense that they are two dimensional lists that can store data.
And no gml doesn't have 3d+ arrays, I've tried, and the help system even says it can't

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Porting GG2 to Python - PyGG2
« Reply #464 on: January 17, 2012, 12:32:15 pm »

So, quick question before my phone dies on me. How well does python handle large arrays (100x100 and up), and can it handle 3d arrays? when using game maker's ds_grid stuff I noticed it started lagging considerably when I bumped the world size from 100^2 to 125^2.
Uhh... GML does have 2d/3d/4d arrays.
Code: [Select]
array[0, 0, 0, 0] = something
ds_grid is not an array.
ds_grids are arrays, in the sense that they are two dimensional lists that can store data.
And no gml doesn't have 3d+ arrays, I've tried, and the help system even says it can't
Oh. Ok.
Logged
Pages: 1 ... 29 30 [31] 32 33 ... 77
 

Page created in 0.03 seconds with 36 queries.