May 19, 2024, 06:01:23 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 ... 48 49 [50] 51 52 ... 77

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

notajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #735 on: May 04, 2012, 08:06:56 am »

I'm trying to add networking and I keep getting this error:
http://pastebin.com/raw.php?i=tcajYUXQ
What on earth does that have to do with networking?

That's a pyglet error.

However it did start happening only as soon as I added the twisted reactor in a side thread.
OpenGL is not thread-safe

Then what do I do if I want to run the pyglet engine and the twisted reactor at the same time?
Not use threads, or not use Twisted. The socket module isn't SO bad.
You can integrate pyglet and Twisted, there's instructions for doing so somewhere.
« Last Edit: June 04, 2013, 03:24:19 am by ajf »
Logged

notajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #736 on: May 04, 2012, 02:42:50 pm »

This is the most difficult code I've ever written:

            if self.rotation != 0:
                # get centre of image
                old_centre_x = sf.get_width() / 2
                old_centre_y = sf.get_height() / 2
               
                # rotate surface
                sf = pygame.transform.rotate(sf, 0 - self.rotation)
               
                # get centre of rotated surface
                centre_x = sf.get_width() / 2
                centre_y = sf.get_height() / 2

                # get angle in radians
                a = math.radians(self.rotation)
               
                # from anchor point and image centre, calculate distance
                x = old_centre_x - self.anchor_x
                y = old_centre_y - self.anchor_y
                r = math.sqrt(x*x + y*y)
               
                # offset image based on how much anchor has moved in rotation
                offset_x += math.cos(a) * r - centre_x
                offset_y += math.sin(a) * r - centre_y
            else:
                offset_x, offset_y = -self.anchor_x, -self.anchor_y


But I managed to do it :)
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Official PyGG2 Development thread
« Reply #737 on: May 04, 2012, 08:47:18 pm »

This is the most difficult code I've ever written:

           if self.rotation != 0:
                # get centre of image
                old_centre_x = sf.get_width() / 2
                old_centre_y = sf.get_height() / 2
                
                # rotate surface
                sf = pygame.transform.rotate(sf, 0 - self.rotation)
                
                # get centre of rotated surface
                centre_x = sf.get_width() / 2
                centre_y = sf.get_height() / 2

                # get angle in radians
                a = math.radians(self.rotation)
                
                # from anchor point and image centre, calculate distance
                x = old_centre_x - self.anchor_x
                y = old_centre_y - self.anchor_y
                r = math.sqrt(x*x + y*y)
                
                # offset image based on how much anchor has moved in rotation
                offset_x += math.cos(a) * r - centre_x
                offset_y += math.sin(a) * r - centre_y
            else:
                offset_x, offset_y = -self.anchor_x, -self.anchor_y


But I managed to do it :)

https://github.com/nightcracker/PyGG2/blob/ad5b9ad09665b8c20b0df1c52e6db5d3c3fd940c/function.py#L23
« Last Edit: June 04, 2013, 03:14:19 am by ajf »
Logged

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1672
  • Gardicolo time is over.
Re: Official PyGG2 Development thread
« Reply #738 on: May 04, 2012, 09:51:34 pm »

That's got to sting a bit. Agonize over code. Bam. Already done.
Logged
A CHALLENGER HAS ARRIVED.

notajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #739 on: May 05, 2012, 10:01:22 am »

This is the most difficult code I've ever written:

           if self.rotation != 0:
                # get centre of image
                old_centre_x = sf.get_width() / 2
                old_centre_y = sf.get_height() / 2
                
                # rotate surface
                sf = pygame.transform.rotate(sf, 0 - self.rotation)
                
                # get centre of rotated surface
                centre_x = sf.get_width() / 2
                centre_y = sf.get_height() / 2

                # get angle in radians
                a = math.radians(self.rotation)
                
                # from anchor point and image centre, calculate distance
                x = old_centre_x - self.anchor_x
                y = old_centre_y - self.anchor_y
                r = math.sqrt(x*x + y*y)
                
                # offset image based on how much anchor has moved in rotation
                offset_x += math.cos(a) * r - centre_x
                offset_y += math.sin(a) * r - centre_y
            else:
                offset_x, offset_y = -self.anchor_x, -self.anchor_y


But I managed to do it :)

https://github.com/nightcracker/PyGG2/blob/ad5b9ad09665b8c20b0df1c52e6db5d3c3fd940c/function.py#L23
Your code makes no sense, I'm keeping my code :U
« Last Edit: June 04, 2013, 03:13:54 am by ajf »
Logged

notajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #740 on: May 07, 2012, 08:51:17 am »

https://github.com/PyGG2/PyGG2/graphs/impact

Impact of different people. Note nightcracker's long streak, whilst I have occasional bumps.
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #741 on: May 07, 2012, 09:22:21 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
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

notajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #742 on: May 07, 2012, 09:25:30 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #743 on: May 07, 2012, 10:51:01 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
« Last Edit: June 04, 2013, 02:51:59 am by ajf »
Logged

notajf

  • Guest
Re: Official PyGG2 Development thread
« Reply #744 on: May 07, 2012, 11:10:48 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Wasn't I here at the start? Well, close to it...
« Last Edit: June 04, 2013, 02:51:52 am by ajf »
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #745 on: May 07, 2012, 11:11:26 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Wasn't I here at the start? Well, close to it...
You made a rather large pause in the middle  :hehe:
« Last Edit: June 04, 2013, 02:51:43 am by ajf »
Logged

Port

  • Junior Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 82
    • portify.github.io
Re: Official PyGG2 Development thread
« Reply #746 on: May 12, 2012, 10:13:24 am »

This networking is really akward (or the physics code is). I randomly get "teleported" around (not huge random changes in position, just slightly, for example to the layer of stairs beneath the current one) the map.
Logged
portify@neko.im

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #747 on: May 12, 2012, 03:25:04 pm »

This networking is really akward (or the physics code is). I randomly get "teleported" around (not huge random changes in position, just slightly, for example to the layer of stairs beneath the current one) the map.
That's a problem with the compensation that I haven't fixed yet. I know.
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #748 on: June 14, 2012, 04:23:04 pm »

REVIVAL

We found a solution to the pygrafix problem. It's called pySFML, and it's based off the pretty good C++ graphics lib SFML.
SFML works through almost pure OpenGL, and pySFML uses Cython, so speed is similar to pygrafix, but it's actively getting developed, is based on a pretty mature library and has a nice API.

Because proof of concept is needed, I and NAGN already started working on it here.
Screenshot after 1.5 hours work (including compiling pySFML):





Also, I should mention that the collision code, presumably the stair code of Jaxof07, is buggy and sometimes causes teleports.
« Last Edit: June 14, 2012, 04:26:29 pm by Orpheon »
Logged

AcidLead

  • The Flash of the Action
  • Veteran Beta Tester
  • *****
  • Karma: 103
  • Offline Offline
  • Posts: 6370
  • Our hero returns triumphant. Execute him at once.
Re: Official PyGG2 Development thread
« Reply #749 on: June 14, 2012, 06:10:58 pm »

huzzah!
Logged
fire at cyberdisc
eighty-five percent hit chance
doh, she missed the shot
Pages: 1 ... 48 49 [50] 51 52 ... 77
 

Page created in 0.027 seconds with 33 queries.