Jump to page: 1 2
Thread overview
GDC 2006 2D Physics Demo for D
Oct 31, 2006
clayasaurus
Oct 31, 2006
clayasaurus
Oct 31, 2006
Olli Aalto
Oct 31, 2006
Mike Parker
Oct 31, 2006
Mike Parker
Oct 31, 2006
Lucas Goss
Oct 31, 2006
Hasan Aljudy
Oct 31, 2006
Walter Bright
Oct 31, 2006
clayasaurus
Oct 31, 2006
Walter Bright
Nov 01, 2006
clayasaurus
Nov 01, 2006
Walter Bright
October 31, 2006
After quite a conversion process, I've successfully converted the c++ GDC 2006 2D Physics demo to D.

Original:
http://www.gphysics.com/archives/18

D Version: http://www.dsource.org/projects/arcgames/browser/trunk/physics/demo.zip?format=raw

Use keys 1-9 to switch through demo, and space bar to launch the 'bomb'.

It also comes with a public domain red black tree implementation that seems to work. The author of http://eternallyconfuzzled.com/tuts/redblack.html told me he is going to add a license page that says all the code on his pages are in public domain.

Special thanks to Christian Kamm for helping me track done a bug.

~ Clay
October 31, 2006
"clayasaurus" <clayasaurus@gmail.com> wrote in message news:ei67hf$2dgi$1@digitaldaemon.com...
> After quite a conversion process, I've successfully converted the c++ GDC 2006 2D Physics demo to D.
>
> Original:
> http://www.gphysics.com/archives/18
>
> D Version: http://www.dsource.org/projects/arcgames/browser/trunk/physics/demo.zip?format=raw
>
> Use keys 1-9 to switch through demo, and space bar to launch the 'bomb'.
>
> It also comes with a public domain red black tree implementation that seems to work. The author of http://eternallyconfuzzled.com/tuts/redblack.html told me he is going to add a license page that says all the code on his pages are in public domain.
>
> Special thanks to Christian Kamm for helping me track done a bug.
>
> ~ Clay

Sweet, but it runs at about 3000 FPS, and so is nearly impossible to see anything running except the pyramid demo.  I see some kind of delta timing with the "dt" global in main.d, but it's set to a constant 1/60, and in windowed mode on Windows, it'll try to update the screen as fast as possible, so the frame time will be something other than 1/60 of a second.

Is there maybe a way to force it to run in fullscreen, so it's limited to the refresh rate?  I'd recompile it but I don't have Derelict, so..


October 31, 2006
Jarrett Billingsley wrote:
> "clayasaurus" <clayasaurus@gmail.com> wrote in message news:ei67hf$2dgi$1@digitaldaemon.com...
>> After quite a conversion process, I've successfully converted the c++ GDC 2006 2D Physics demo to D.
>>
>> Original:
>> http://www.gphysics.com/archives/18
>>
>> D Version: http://www.dsource.org/projects/arcgames/browser/trunk/physics/demo.zip?format=raw
>>
>> Use keys 1-9 to switch through demo, and space bar to launch the 'bomb'.
>>
>> It also comes with a public domain red black tree implementation that seems to work. The author of http://eternallyconfuzzled.com/tuts/redblack.html told me he is going to add a license page that says all the code on his pages are in public domain.
>>
>> Special thanks to Christian Kamm for helping me track done a bug.
>>
>> ~ Clay
> 
> Sweet, but it runs at about 3000 FPS, and so is nearly impossible to see anything running except the pyramid demo.  I see some kind of delta timing with the "dt" global in main.d, but it's set to a constant 1/60, and in windowed mode on Windows, it'll try to update the screen as fast as possible, so the frame time will be something other than 1/60 of a second.
> 
> Is there maybe a way to force it to run in fullscreen, so it's limited to the refresh rate?  I'd recompile it but I don't have Derelict, so.. 
> 

Derelict comes with the demo.zip package along with SDL.dll. If you have the D compiler and build, all you need to do is 'build main.d -Rn -full -release -O' to build it.

Throw in an SDL_Delay(40) in the main while loop if you want a quick solution, or add a 'flags = SDL_OPENGL | SDL_FULLSCREEN' to the SDL video flags for fullscreen in main.d around line 668.

Within the next year or so I'm going to integrate this into my 2D game library ( http://arcgames.dsource.org/arc/arc/time.html ) which has a delay timer that will delay the main loop as needed to keep a constant frame rate.

I need to figure out how to add circle shapes and eventually polygon shapes, however the author says at GDC 2007 he'll put more shapes in his demo. There is also a java port that supports circle and line shapes http://code.google.com/p/phys2d/









October 31, 2006
wow .. just amazing!!

clayasaurus wrote:
> After quite a conversion process, I've successfully converted the c++ GDC 2006 2D Physics demo to D.
> 
> Original:
> http://www.gphysics.com/archives/18
> 
> D Version: http://www.dsource.org/projects/arcgames/browser/trunk/physics/demo.zip?format=raw 
> 
> 
> Use keys 1-9 to switch through demo, and space bar to launch the 'bomb'.
> 
> It also comes with a public domain red black tree implementation that seems to work. The author of http://eternallyconfuzzled.com/tuts/redblack.html told me he is going to add a license page that says all the code on his pages are in public domain.
> 
> Special thanks to Christian Kamm for helping me track done a bug.
> 
> ~ Clay
October 31, 2006
"clayasaurus" <clayasaurus@gmail.com> wrote in message news:ei6dp6$2i50$1@digitaldaemon.com...
> Derelict comes with the demo.zip package along with SDL.dll. If you have the D compiler and build, all you need to do is 'build main.d -Rn -full -release -O' to build it.
>
> Throw in an SDL_Delay(40) in the main while loop if you want a quick solution, or add a 'flags = SDL_OPENGL | SDL_FULLSCREEN' to the SDL video flags for fullscreen in main.d around line 668.

Ahh, great, that worked :)  So much cooler when it's running at a reasonable speed.  Though strangely putting it in fullscreen didn't help.  Apparently, there's a way to make SDL wait until a vertical retrace until it updates the screen, using SDL_DOUBLEBUF for the video flags and SDL_Flip() at the end of the loop, but I tried that and that didn't help either.


October 31, 2006
Jarrett Billingsley wrote:
> "clayasaurus" <clayasaurus@gmail.com> wrote in message news:ei6dp6$2i50$1@digitaldaemon.com...
>> Derelict comes with the demo.zip package along with SDL.dll. If you have the D compiler and build, all you need to do is 'build main.d -Rn -full -release -O' to build it.
>>
>> Throw in an SDL_Delay(40) in the main while loop if you want a quick solution, or add a 'flags = SDL_OPENGL | SDL_FULLSCREEN' to the SDL video flags for fullscreen in main.d around line 668.
> 
> Ahh, great, that worked :)  So much cooler when it's running at a reasonable speed.  Though strangely putting it in fullscreen didn't help.  Apparently, there's a way to make SDL wait until a vertical retrace until it updates the screen, using SDL_DOUBLEBUF for the video flags and SDL_Flip() at the end of the loop, but I tried that and that didn't help either. 
> 
> 

The SDL_DOUBLEBUF and SDL_Flip() are not used in OpenGL mode. The SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) and SDL_GL_SwapBuffers() are used instead respectively. I haven't looked at the code yet, but I believe those are used there.

As what comes to the vsync you could try SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1)[1]. Put it before the call to SDL_SetVideoMode().

O.

1. http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fGL_5fSetAttribute
   http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fGLattr

October 31, 2006
clayasaurus wrote:
> Within the next year or so I'm going to integrate this into my 2D game library ( http://arcgames.dsource.org/arc/arc/time.html ) which has a delay timer that will delay the main loop as needed to keep a constant frame rate.

I think it would be better to use frame rate independence. By delaying the main loop some input can become jagged and seem unresponsive (mouse jumping places). I know I've seen some articles on gamedev.net, now where were they...

http://www.gamedev.net/reference/articles/article1604.asp
http://www.gamedev.net/reference/articles/article1382.asp

lucas
October 31, 2006
"Olli Aalto" <oaalto@gmail.com> wrote in message news:ei7088$2vl4$1@digitaldaemon.com...
> The SDL_DOUBLEBUF and SDL_Flip() are not used in OpenGL mode. The SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) and SDL_GL_SwapBuffers() are used instead respectively. I haven't looked at the code yet, but I believe those are used there.
>
> As what comes to the vsync you could try SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1)[1]. Put it before the call to SDL_SetVideoMode().

Crap!  The version of SDL that Derelict (or at least the Derelict that comes with Clay's demo) is 1.2.0, and SDL_GL_SWAP_CONTROL is only available starting with 1.2.10.  Have to do some more fiddling this afternoon..


October 31, 2006
Jarrett Billingsley wrote:
> "Olli Aalto" <oaalto@gmail.com> wrote in message 
> 
> Crap!  The version of SDL that Derelict (or at least the Derelict that comes with Clay's demo) is 1.2.0, and SDL_GL_SWAP_CONTROL is only available starting with 1.2.10.  Have to do some more fiddling this afternoon.. 
> 

Actually, the version of Derelict with the demo should support SDL 1.2.10 (as defined in sdlversion.d). The missing enum was a bug. It was also missing SDL_GL_ACCELERATED_VISUAL. The Derelict trunk has been updated with the fix.
October 31, 2006
Mike Parker wrote:
> Jarrett Billingsley wrote:
>> "Olli Aalto" <oaalto@gmail.com> wrote in message
>> Crap!  The version of SDL that Derelict (or at least the Derelict that comes with Clay's demo) is 1.2.0, and SDL_GL_SWAP_CONTROL is only available starting with 1.2.10.  Have to do some more fiddling this afternoon..
> 
> Actually, the version of Derelict with the demo should support SDL 1.2.10 (as defined in sdlversion.d). The missing enum was a bug. It was also missing SDL_GL_ACCELERATED_VISUAL. The Derelict trunk has been updated with the fix.

Correction -- the trunk is being updated with the fix. I keep timing out. I'll post on the Derelict forums when it succeeds.
« First   ‹ Prev
1 2