Sign in to follow this  

Phun - a 2D physics playground

This topic is 3564 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

Phun is an application for creating 2D simulations of physics. It has a cartoony feel to it and is simple and fun to use! Check out this video to see what it's all about: http://www.youtube.com/watch?v=0H5g9VS0ENM I have been developing Phun for the past six months as my Master of Science thesis, and now it's time to reveal it to the public. Phun is completely cross-platform, it's written in C++ and uses OpenGL for rendering. It also uses SDL (for window management and input), SDL_image (for reading images), GLEW (for OpenGL extension management), boost and boost_filesystem. I use no external physics engine or GUI library. Download Phun here: www.acc.umu.se/~emilk/ (Windows and Linux, soon MacOS) The program is still in Beta, so expect it to crash at least once for you. But don't worry, it has autosave. If you don't trust the autosave, just use ctrl-s a lot. Please let me know what you think of it! - Emil Ernerfeldt Update: I just released beta 3. Hopefully this will run on more computers. [Edited by - emilk on February 19, 2008 6:11:33 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by emilk
I use no external physics engine or GUI library.


After watching the video, I'm amazed that you did all of that yourself! That's quite impressive. Have you thought about releasing your own physics library or GUI library?

The game crashes for me at startup. The logfile says:


15:11:50: Application created
15:11:50: Parsing autoexec.cfg...
15:11:50: Creating window...
15:11:50: Destroying GL resources
15:11:51: Loading all resources...
15:11:51: Destroying GL resources
15:11:51: Creating GL resources
15:11:51: Reloading class rendering::Texture
15:11:51: Reloading class rendering::Shader


And the last line in the console window says "Creating window..."

Share this post


Link to post
Share on other sites
Man, I'm really looking forward to this. I've just been exploring this field.

You do know that the vc_redist files are taking up 5 megs out of your 7 meg download?

Share this post


Link to post
Share on other sites
I am very impressed. Not only does it work smoothly and as advertised, but it's actually fun :-) I can see this being used in a sort of suped-up Incredible Machine type game.

Share this post


Link to post
Share on other sites
This is simply amazing. This is the best 2d physics demo I've ever seen.

You've put tons of work into this and it really shows. I'll have quite a bit of fun playing with this, and I look forward to (hopefully) new versions in the future.

Share this post


Link to post
Share on other sites
Thanks for all the great replies, glad you like it!

Quote:
Original post by fd9_
After watching the video, I'm amazed that you did all of that yourself! That's quite impressive. Have you thought about releasing your own physics library or GUI library?


Thank you! Exactly how Phun and it's parts will finally be released is not yet decided. For now I'm just gonna continue to add cool features.

Quote:

The game crashes for me at startup. The logfile says:

15:11:51: Reloading class rendering::Shader


I should have warned you that the program may crash at times (and now I do). Sometimes at startup - sometimes just out of spite.

In your case, problem loading a shader could simply mean you need new graphics drivers (or worse, hardware). But it could also be some strange coding from my part, I'll look it over until the next beta.

Share this post


Link to post
Share on other sites
Did this kind of thing exist before crayon physics?
Why did you decide to make your own GUI?
Have you used or looked at open source physics libraries?

Share this post


Link to post
Share on other sites
One thing I've wondered about these simulations is why they're not simulated exactly the same way every time? If I load a scene like towerkill hit start, undo the start and hit start again, the blocks won't fall in the same way twice.

Share this post


Link to post
Share on other sites
Quote:
Original post by jonahrowley
One thing I've wondered about these simulations is why they're not simulated exactly the same way every time? If I load a scene like towerkill hit start, undo the start and hit start again, the blocks won't fall in the same way twice.


One thing it can be is if the solver doesn't use a constant time step, it could cause different results in the calculations.

Share this post


Link to post
Share on other sites
awesome. the video made me laugh! the GUI alone would take weeks or months to program and you've got those cool window animation fx to go with it. kudos!

will there be code made available?

Share this post


Link to post
Share on other sites
Wow, this looks really promising, like virtual sandbox with physics (feel like kid again :D). I liked the water most although it quickly slows down the simulation, do you use GPU for calculating the physics?

This reminds me of an old game idea i had back in 2002. Physics puzzle game where player(s) would face problems that they need to solve by using various physical pheneoms such as (much simplified) thermodynamics, material properties, fluid dynamics and traditional rigid bodies. The more ridicilious contraptions&combinations they would produce the more points they would earn from solving the problem. Like someone said earlier suped-up TIM.

But for masters thesis i hope you'll get the good ratings which this kind creativity deserves.

Share this post


Link to post
Share on other sites
Thanks again for the feedback, time to answer some questions:

Quote:
Original post by __ODIN__
For the water, it's just simulated with Spheres with low friction and low restitution, or is there something more complex going on there?

Allan


It's SPH, Smoothed Particle Hydrodynamics. I haven't really put much time into it yet though, the next version will feature more realistic water that will run faster (or so is my ambition).

Quote:
Original post by Boder
Did this kind of thing exist before crayon physics?
Why did you decide to make your own GUI?
Have you used or looked at open source physics libraries?


The idea of drawing physics like this isn't new, but it's just lately that faster hardware and better algorithms has enabled it on a fun scale. I beleive crayon physics was inspired by the MIT SKETCH video (http://www.youtube.com/watch?v=NZNTgglPbUA), as was I.

The reason I made my own GUI code was
A) I wouldn't have to learn somebody elses!
B) I could do things that no other gui could (like the wobbly windows)
C) I could make it look just like I wanted.
It's also worth pointing out that I have made all the graphics myself in The Gimp and Paint.NET (all hail the programmers art!)

I haven't really needed to look at others physics libraries that much, I had a very good solver developed here in Umeå that I used right of the bat, and that works wonderfully. There is still a lot of tweaking to be done to it however. The solver is based on a regalurized Gauss-Seidel Baumgarte impulse solver with leap-frog integration. This is not at all as complex as it sounds, only the math behind it (which I haven't had to worry about too much). The full details will be explained in my thesis that I will hopefully publish in a month or two.

Quote:
Original post by jonahrowley
One thing I've wondered about these simulations is why they're not simulated exactly the same way every time? If I load a scene like towerkill hit start, undo the start and hit start again, the blocks won't fall in the same way twice.


This is a known bug, and I will try to fix it in upcoming releases. Entropy can come frome anywhere, and the butterfly effect says that even the smallest changes can have large effect over time. Maybe I iterate over the contact set in slightly different order, for instance.

Quote:
Original post by leiavoia
will there be code made available?


Yes, probably. I haven't decided under which licence yet though, which is why I'm holding off on it.

Quote:
Original post by EntropaiI liked the water most although it quickly slows down the simulation, do you use GPU for calculating the physics?


No, everything runs in software, and optimization hasn't really been a priority. I hope to speed up the SPH simulation by 2-3x until the next beta.


/emilk

Share this post


Link to post
Share on other sites
I am having a hard time installing the program in Ubuntu 7.10. After I change permissions so that the file is executable, I click on it and a box pops up for about a second and goes away. What do I need to do to install this great piece of software.

Share this post


Link to post
Share on other sites
This software is amazing. I can't believe you did all of that by yourself in only 6 months. I'm glad you are continuing to add to it. I have a couple of feature suggestions for you to think about.

It would be nice to be able to draw polygons using lines and nodes similar to how the Paths Tool works in the Gimp. Sometimes it's hard to draw a good triangle with the brush tool.

Also it would be helpful to be able to move the whole environment around instead of having to maneuver around by using the zoom feature. EDIT: I guess I need to learn to read help files. You can do this by dragging with the right button, or pressing the directional keys.

I see you are planning some work on the liquid. Maybe sometime the ability to set options for the liquid to simulate different types.

And sometime in the future maybe you could add wind, and the ability for objects to get crushed or squished.

I don't know if you even can do these things, or if you would even want to. It's just some ideas of things I think might be useful. But I love your program just the way it is. Thank you for making it available to the public.

Share this post


Link to post
Share on other sites
Sign in to follow this