Menu

Hardware acceleration

2007-12-20
2013-04-25
1 2 > >> (Page 1 of 2)
  • Patrick Devine

    Patrick Devine - 2007-12-20

    Hey guys,

    I haven't posted in a while, but I've been busy at work trying to figure out how to speed up the game.  I've been messing around with "Pyglet", which is a new python library which is a replacement for pygame not based on SDL but on OpenGL.  It supports hardware acceleration in 2d and 3d and looks extremely promising.

    Anyway, I've been porting the existing code over to using it, although it's been taking a while since not all of the functions are the same and it uses a true cartesian coordinate system (and not a cartesian coordinate system with the y-axis flipped).  So far I have the guy walking around following the mouse and the nav lights turned back on in the ship, so there is quite a ways to go to get back to where I was with pygame (probably 4-5 days), but in the long run I think it's going to be worth it.

    So that brings me to the most exciting part.  Since it uses OpenGL, it's possible for us to do a fully 3d space combat sim.  We'll use the same cockpit (which I'm rather fond of) but we'll be able to move the Sun Dog along all three axis (pitch/bank/yaw) vs two in the original game (pitch/yaw).  This is something that I always had problems with in the original game.  I always wanted something like SunDog + Wing Commander or SunDog + Elite, but I don't really know of any game out there quite like that.  So...

    We're going to need some 3d models of ships!  That and textures.  If anyone knows anyone who'd be willing to help out, please send them this way.

    thanks!

    --Patrick.

    Oh right:  new hw accelerated demo:  http://pdevine.users.sonic.net/20071219sundog3d.tar.gz  You'll need to install Pyglet which you can find out there on the net.  Still not much to see vs. the pygame code and the load time is a little longer (due to making all the image textures digestible by OpenGL), but it should feel a lot smoother than the old code.

     
    • Jake La Foret

      Jake La Foret - 2007-12-21

      Hey Patrick,

      I know I've been in touch with you via email, but I'll post something here as well for everyone's benefit. The new code runs on my computer at roughly 59 frames per second, which is fantastic. And that's on my battle-scarred (literally) Panasonic Toughbook that's 5 or 6 years old and slower than molasses. I have yet to try it on my new Dell Latitude, but if it runs at 59fps on the same machine that was sluggish before, than that's a huge step up. I can't wait to test it again with the added cockpit functionality - that will be a true test!

      In other news, I have been working on city tiles, and hope to complete all of the "normal" city tiles from the original game (normal as in what you see on all planets other than Enlie and in all cities other than Banville). There may be some city tiles I missed, but after wandering Sundog on STEEM a lot recently, I haven't found any I have not screen-captured and cut out for redrawing. Once I finish the "normal" city tiles, I'll finish Banville - that's almost done anyway, and I'll add a few new tiles to it as well. Then I'll have to begin work on the Enlie set, which is something I have not even started yet. The new "desaturated techy theme" is almost done too - I'll make a few more enterable buildings, teleporters, and I think I might call that one finished. I'm starting a sheet where I'm giving each tile an identifying number, and when the entire set is completed, I'll create a single PNG file with all the tiles from that set laid out on a 100x100 grid, which would leave 20-pixel wide streets between the 80x80 buildings. That's if we're going with the simple city-map construction, of course.

      Alright, that's it for now.
      -Jake

       
    • Patrick Devine

      Patrick Devine - 2008-01-14

      OK.. a new update with some of the stuff I've been working on (including a reticle and partially working radar).  This version has a special suprise, so let me know if it works for you guys.  To start it run game.py.  Let me know if it works or not though -- it does in OSX but I haven't tested it in Windows or Linux yet (although it should work in theory).  Also, try and guess what movie I was watching the other night.  :-D

      http://pdevine.users.sonic.net/20080113sundog3d.tar.gz

       
    • Jake La Foret

      Jake La Foret - 2008-01-15

      Yay! Surprises!

      I did get it to work in Windows XP, though the load time was unusually long. Perhaps it has something to do with the special surprise. ;) I won't give away what movie you were watching, but I know what it was! Excuse me while I go rummage around in some bones next to a large black monolith outside my house.

      I had a hard time controlling the flight of the ship - I was spiraling all over the place watching the Earth flash by in a glorious second of majesty before returning to the sweeping stars. lol... Some captain I am!

      But it's great to see the progress! Thanks for the update!
      -Jake

       
    • Jeremy Hitchcock

      Pretty nice!  Very cool to see this.  Python?  Pretty cool.  I've heard good stuff about pygame and it works pretty well under OS X.  I have some more time these days so I should be able to take some light things on.

       
    • Jake La Foret

      Jake La Foret - 2008-01-21

      Hey Jeremy, `great to see you again! And it would be great if you can help out! Patrick is discovering that free time is a relative term when a newborn baby is inserted into the equation, so maybe he can give you a pointer or two on what parts of the code can be worked on next.

      As for me, I'm busy out the wazzoo at the moment. This "holiday" weekend I'm driving 1000 miles round-trip for a job interview, and I'm completing the last semester of my J.D. But I'm plugging away at city tiles and other assorted graphics as I find spare time. But if any new or altered graphics are needed for the code, I'm giving them priority to crank them out pronto.

      To catch you up on other news, Jeremy, this project has recently been featured on Bruce Webster's webpage, so we're getting lots of traffic through there. I'm glad to see there's such a high degree of interest out there! Well, hopefully we can keep plugging away at the game and get something released in 2008... ;)

      Alright, gotta run...
      -Jake

       
    • Patrick Devine

      Patrick Devine - 2008-01-22

      OK..  sorry for the long times between updates.  I have been busy working on the code, but Jake is right.  The new baby is throwing a spanner into the mix.  But have no fear, progress is still being made.  :-D

      I've been busy trying to get back to the same point where we were with pygame but with pyglet.  A lot of the code I've been working on is just plumbing since pyglet doesn't give you quite as much to work with.  So here it is:

      http://pdevine.users.sonic.net/20080121sundog3d.tar.gz

      To run it, try:

      # python game.py

      You'll need pyglet installed of course.  We're back to having to use the keyboard to bring up various screens.  Press 'c' for the cockpit (the right mouse button or apple-click should get you back out, although I've only done it on the mac with a single button so let me know if that is busted).  '1', '2' and '3' will bring up the various lockers, although the system bays aren't back in yet (they should come quickly though once the lockers are re-done).  The collision detection in the ship still needs a little bit of tweaking, but I'm getting there.  Also, I re-did part of the map in the cockpit but discovered there is no primitives for drawing ellipses so I haven't stuck those back in yet.  You can now turn the music on and off with the 'p' key (for play and pause).

      Still lots to do.  Actually, when I look back on it, I really did get quite a lot done with the pygame engine and it's takes a little more time to get any of this stuff working with OpenGL, but I think in the end it's worth it for the hardware acceleration.

      Have fun,
      --Patrick.

       
      • Jeremy Hitchcock

        Sweet!

        Frame rate on my MacBook Pro hovers around 223-224 in the ship display, 130 or so in the cockpit.

        Right clicking did not work but apple clicking did.

        It can be a little tricky making it around the curves and the pod and back but otherwise the navigation is great.

        I just noticed the game clock in the cockpit, that's pretty awesome :)

         
        • Patrick Devine

          Patrick Devine - 2008-01-22

          Yeah.. the cockpit frame rate is actually slowing down because it's rendering the green grid in real time with OpenGL calls.

          If you look at the pygame version of the game most of the menu system/buttons/displays/etc. are all working, but it's taking a while to get everything back in with the pyglet version of the code just because a. pyglet doesn't have the same kind of drawing primitives that the SDL has, and b. the y axis is flipped on the cartesian coordinate system for displaying images which means I have to go and change things in the ship.xml file and I'm lazy :-D.

          --Patrick.

           
    • Jake La Foret

      Jake La Foret - 2008-01-22

      Whoot! New version!

      I'm enjoying the progress as the hardware accelerated version grows closer to the pygame version - and it's getting good! My initial test of the new code did reveal a few probs, tho. Listed below:

      1. The right-click did not work for me and my Windows XP laptop - once a locker was opened (or the cockpit) I could not get rid of it with the right click.

      2. The speed of the character was chipmunk-on-crack-cocaine fast. The FPS bounced around between 100 and 166 fps during this. This probably isn't a big deal and can be easily fixed when the bigger deal stuff is dealt with.

      3. Graphics - I see you are using the old object images (because they are off-centered in the locker) and the old ship lights (because of the black line under the top one). If you want, I can zip up all the graphics you need and email them to you, while you delete all your graphics. This way we're sure that, like a stubborn cockroach, all the old graphics are gone for good.

      Speaking of graphics, if there's the feeling that it would be good to have a larger screen size than what we have now, this is probably the best and only time to upgrade. A while back I edited the cockpit to make the screen quite a bit larger and wider by moving the consoles to the left and right. If you want to play with the new cockpit before the current cockpit is all hooked up, I can send the new version to you. Adjusting the position of the controls to the new cockpit shouldn't be too hard - since I just shifted the console to the side, we'd just have to subtract (left side) or add (right) the number of pixels from the XY coords of the control's old position. The larger screen would mean larger maps and more screen space for controls.

      Alright, that's my take. It's looking good, and I'm glad to see progress, despite the spanner wrench! :) Take it easy!
      -Jake

       
    • Patrick Devine

      Patrick Devine - 2008-01-22

      Sweet.  I'll take a look at getting the guy moving at proper speeds.  I've been developing all of the stuff on my dog ass slow mac laptop just to make certain everything was working.  As for the graphics, a zip file with the current images would be fine.  They are easy enough to shoe horn in.

      As for enlarging the screen size, given my laptop does 1024x768, I'm not going to be able to see the entire screen if we make it a different resolution.  Maybe that's an excuse to buy a new laptop.. :-D

      --Patrick.

       
    • Jake La Foret

      Jake La Foret - 2008-01-22

      lol... trust me, I know about dog ass slow computers... Ugh. Heck, I think mine might qualify as a sloth ass slow computer.

      Anyway, I guess I wasn't clear - when I referred to screen size, I was referring to the large MFD screen in the center of the cockpit, not the "screen" size for the game. I want to keep the screen size for the game at 1024, since that will work for most computers out there, even those of the slow canine maximus glutinous variety. So... with that clarification, do you think we should boost the MFD screen size up a bit? I was growing concerned a while back about that.

       
    • Jornel

      Jornel - 2008-01-29

      Greetz guys,

      If the frame rate is slowing down too much, can yoo slow the rendering cycle down? Like, instead of maxing the rendering speed to the CPU speed, can you time it so the program isnt running full speed to render stuff? I don't know what I'm talking about, ubt it sounds good! haha... I just wanna contribute something. :)

      Thanks for the updates! I cannot wait to play the game! I'm hoping I can I pimp the pod around the cities soon... That is going to be sweeeeeeeeeeeeeeeeet!!!!!!!!!!!

       
    • Patrick Devine

      Patrick Devine - 2008-02-06

      Hey guys,

      Long time no update, so thought I'd spring one on you.  I haven't been getting as much done as I'd like (need to recover on the sleep front), however, this change brings updated gravlockers and mech bays.  Also, I rewrote how the item classes work and you'll note a lot more items in each of the bays.  Jake changed up the inventory bar so that looks a lot different right now but unfortunately I don't have it quite working yet (soon!).  Also added back was picking up items again, although I ended up having to write it differently than for the old version (due to the way events work with pyglet vs. pygame), however one cool thing you'll notice is what happens when you pick up an item and 'drop' it with the right mouse click  --  there is a slight bug in there right now if you do it too close to where you picked it up it will exit the window when it's not supposed to, but try moving it further away and clicking and you'll see the new effect.

      Here's the new code:

      http://pdevine.users.sonic.net/20080206sundog3d.tar.gz

       
    • Jake La Foret

      Jake La Foret - 2008-02-06

      Hey Patrick,

      I checked the new code, and on the PC box I'm still having problems closing the windows (mech bay, etc). Once opened, I cannot right click to close them, and I have to restart the game to do something else. Also, I cannot pick up objects. There must be something miscommunicating since these functions apparently work on other operating systems, but not on Pyglet running on a PC.

      Let me know if you need more specific info on these problems.

      Also, if anyone else has a PC box and can get the game working, then it could be a problem with my Pyglet or Python setup. I might try reinstalling everything to make sure.

      -Jake

       
    • Patrick Devine

      Patrick Devine - 2008-02-07

      Hey Jake,

      Can you go into util.py and change the function getButton() to look like:

      def getButton(button, modifiers):
          if button == window.mouse.LEFT:
              return 'left'
          elif button == window.mouse.RIGHT:
              return 'right'

      and at the top of the file add:

      from pyglet import window

      I think that ought to work.  The problem is the Mac laptop using different buttons than a real mouse.

       
    • Patrick Devine

      Patrick Devine - 2008-02-07

      Oh.. indenting is important too which it looks like this forum cuts spaces out (which is kind of lame).

       
    • Jake La Foret

      Jake La Foret - 2008-02-07

      Yeah, the indenting in the forum is removed, but I get all posts to this forum emailed to me, and the indents looked fine in the email. I changed the code and it is working great now! That's the ticket! Thanks!

      -Jake

       
    • Sarah J. Marsden

      Super!

      It took some doing (I had to set the PATH environment variable in windows to get it to stop crashing & reinstall python/pyglet/psyco), then update the code in util.py.

      I think it is starting to flow a little better.  The bays look good but I still can't put things in my inventory.  I also noticed that the collision map isn't bound anymore, so I can walk everywhere!

      Lucky number 7 ;)

       
    • Patrick Devine

      Patrick Devine - 2008-02-19

      Hey guys,

      I've been busy learning OpenGL so things have been a bit of a slow slog (much slower than just whipping everything out in 2d with pygame).  Anyway, I've put together a demo of galactic map with everything running hardware accelerated and true perspective rendering.  Also, since it's fully 3d, if can be spun or tilted (before I was only doing tilt).  I'm not going to bother with a full update for now, but you can test out the code at:

      http://pdevine.users.sonic.net/map.py

      By default, the disc is animated which you can turn on/off by hitting the space bar.  You can tilt/rotate with the arrow keys.  You'll need to put map.py into your sundog3d/ directory since it needs the Drahew.xml file to snag all of the star systems.  For now, the star systems are all randomly coloured and not named, but I'll fix that tomorrow.  For now I'm just happy that it's rendering properly.  :-D

      Thanks,
      --Patrick.

       
    • Jake La Foret

      Jake La Foret - 2008-02-19

      Hey Pat,

      Great to see the new stuff! It took be a bit to get it working - the code calls for a "star.png" which does not exist. My data folder has "starstrip.png" which I assume is the graphic needed, so I changed the code to call "starstrip.png". That got the map to work, but it seems like the map is showing the entire frame of the star, including the red letter under the planet that designates the class type. (I say "seems" because the star images are distorted). In the pygame release, the letter was cut out and not displayed on the map.

      Anyway, once I got the map working, it looks great! Very smooth movement! That's going to be one sexy map when incorporated into the MFD of Sundog. Sexy but very functional too. Don't forget about that new cockpit image, which not only has been touched up and improved, but also has a much larger MFD screen to display a bigger map and to lay out control buttons. Since we are going to have a very slick hardware supported map, it would be a shame to cram it down smaller than it has to be.

      Alright, I'm slacking off from my work. Must run along... Thanks for the update and I look forward to the next one!
      -Jake

       
      • Patrick Devine

        Patrick Devine - 2008-02-21

        Hey Jake,

        Actually, there's a new file called "star.png" which you can put in your data/ directory, and I've also included a "Drahew.xml" file (since I realized it wasn't in the sundog3d tarball).  My phoneline got wrecked by a backhoe after I uploaded the map.py file so I haven't been able to get online since then, but the files should be there now.

        --Patrick.

         
    • Patrick Devine

      Patrick Devine - 2008-02-28

      Hey guys,

      I've been a little bit busy with work and the new kidlet, however I have still been working on stuff.  I've updated map.py to now include all of the names of each of the star systems and fixed up a couple of bugs in it.

      I've also been working on some pyglet / opengl example code which will teach you the basics of how to move things around/create simple objects/etc.  I'll put that up on the website in the next couple of days.

      Thanks,
      --Patrick.

       
    • Jake La Foret

      Jake La Foret - 2008-03-02

      Thanks for the update, Patrick! I've been away for the past 7 days, spending time in three different states along the way, so I've not done much recently...  :( I'm looking forward to having more time in the near future to do some more work on the project.

      As for the example code, I'm looking forward to seeing that and doing some experimenting. If there's anything I can do to free up time for you to code out more advanced stuff, that would be great.

      Alright, I have a STACK of work that has backed up for me to complete in the past week... ugh.
      -Jake

       
    • Patrick Devine

      Patrick Devine - 2008-04-18

      Hey guys,

      Sorry for taking so long for updating anyone.  Things have been crazy with between new baby, work and being sick, but I have started working on Sundog again.  I just hacked in the new fancy galactic map into the cockpit and I think it looks pretty sweet, although there are a couple of bugs still.  I'll send out an update soon.

       
1 2 > >> (Page 1 of 2)

Log in to post a comment.