Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

vnillabrent

Opinions Please: 2D Physics Demo

This topic is 5214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Get it here. My goal this week was to finish a 2D version of Paul Nettle's article General Collision Detection for Games Using Ellipsoids with dynamic levels. I guess it has been a success, but I would like your opinions. 1. What is your framerate? 2. How fast is your processor? 3. Any ideas on what to do when the ellipse is "squished" by a moving platform? EDIT: Link changed [edited by - vnillabrent on May 7, 2004 12:50:15 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hey,

I''m going to have to read that article, thats a pretty nice.

Couple of things:
A. Make a simple HTML for it and put a link there, as your host doesn''t allow for hot-linking and I had to fudge with the URL a bit to get it to download.

B. You can''t jump when on the slanted ramp.

Now for my specs:
~20 frames per second
P3 700mhz 256 megs of RAM with an ATI Radeon 8500

As you can tell, my machines not good but I imagine thats all computation framerate loss as its certainly not video =)

Good job.

Share this post


Link to post
Share on other sites
I''m getting ~75fps on a 2.4ghz. What are you doing with all those cycles man?? That is not vsync locked either, I refresh at 85. This demo should be very trivial computationally. If you post your code I''m sure we could get it running quite a bit nicer.

Share this post


Link to post
Share on other sites
Grozzler: Thank you, its a great read. http://www.peroxide.dk has a thesis regarding Paul Nettle''s article. Link provided. Ramp seems to be fixed - i think it was due to floating point math errors.

Thanks tim, the dissapearing is my response to when the player is "squished." Any other solutions?

To both Grozzler and haro: The framerate is definitly much lower than my target. I would like to achieve at least 50fps on 600MHz processor. I don''t think that''s a bad goal, so now its time for optomization.

I''ll review my code and post the algorithm i''m using here tomorrow. Tonight I''m off for bed. Thanks for testing it out, must appreciated.

Share this post


Link to post
Share on other sites
Well, the collision detection works very nicely (other than the disappearing error previously mentioned). Good job.

In a game, you would either have the player killed upon squishing or have the object and/or player displaced from its intended path. You possibly have the moving platform wait until the player is out of the way and then resume moving.

The performance DEFINITELY leaves much to be desired.
I have an Athlon XP 1700+ (1453 MHz) and I get 62 fps.

You should have said collision detection demo, not physics demo.

[edited by - Eccentrix on May 8, 2004 2:22:42 AM]

Share this post


Link to post
Share on other sites
Eccentrix - Good point. It is more of a collision detection demo. The ellpse is displaced to a certain extent, but if the line hits the ellipse at a strong-enough angle, the engine sends a message to destroy the ellipse and that is why the ellipse dissapears.

This morning I did some profiling to look for sluggish functions, and the results suprised me.

1. SDL_Flip - 40.0%
2. SDL_FillRect - 27.3%
3. PlotPixel - 6.2%
4. SDL_InitSubsystem - 5.0%
4. DrawLine - 4.7%

I''ve tried to speed up the rendering engine, but SDL isn''t my preference for graphics. Any ideas for a faster rendering engine?

And one more thing, removing the call to SDL_WM_SetCaption, which I was using to display the FPS in the title, gave me a 20% speed boost.

A new version is online now and it stores a log file of the frames/sec each frame. Collision detection code has not been touched.

Share this post


Link to post
Share on other sites
230 FPS P4 3.2 GHz, Radeon 9800 Pro

One thing you should add to make it more realistic: when the oval is riding the platform, when the oval jumps, it should have an x velocity the same as the x velocity of the platform.


some pixel shaders would be nice too



[edited by - Mulligan on May 8, 2004 11:32:55 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by vnillabrent
This morning I did some profiling to look for sluggish functions, and the results suprised me.

1. SDL_Flip - 40.0%
2. SDL_FillRect - 27.3%
3. PlotPixel - 6.2%
4. SDL_InitSubsystem - 5.0%
4. DrawLine - 4.7%

I''ve tried to speed up the rendering engine, but SDL isn''t my preference for graphics. Any ideas for a faster rendering engine?


When you do per-pixel operations in you negate the ability to use vram for drawing; your modifying the vram every frame from the cpu; this is slow. To speed up use sprites or tiles; aka little images that can be stored in vram and blit super fast like. Even opengl putpixel is really slow.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!