Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Plugins

Physic plug-in for ShiVa

ShiVa Plugin Development

Physic plug-in for ShiVa

Postby Heartbroken » 04 Sep 2011, 17:06

Hi all

I saw there already was an attempt to make a Bullet based physic plugin, but that project looks frozen so I decided to make it by myself as I need it for the game I want to make.

Here is a link to an archive with the first approach:
http://bitchingames.com/bikini/bikini-0.01.zip

The archive contains the manual (which is rather a draft of a manual) and the ShiVa project which can be opened by ShiVa editor. Just load the game, run it and click 'Next' button to see the next demo scene. There are only four of them for the moment.

Yes, it's only for Windows for now.

I will be happy to answer any of your question, and from my side want to ask if such a plugin would be of interest for some one, and if yes which feature would be the most important for it in your opinion.

Thanks

[UPDATE]
Version 0.02 is here:
http://bitchingames.com/bikini/bikini-0.02.zip
Last edited by Heartbroken on 25 Sep 2011, 22:43, edited 1 time in total.
Heartbroken
Fresh Boarder
Fresh Boarder
 
Posts: 9
Location: Montpellier, France

Re: Physic plug-in for ShiVa

Postby pataya » 04 Sep 2011, 17:15

hi Heartbroken wellcome
i will try when i can
thanks
User avatar
pataya
Platinum Boarder
Platinum Boarder
 
Posts: 876

Re: Physic plug-in for ShiVa

Postby NiCoX » 04 Sep 2011, 21:00

Hi Heartbroken,

First of all, welcome to the ShiVa community, I see it's your first post :)

A first post, but what a nice post! Indeed your demo is just great, the code is just perfectly clean, and the water scene is just impressive.

which feature would be the most important for it in your opinion

Asynchronous simulation mode (multi-thread/core).

Again, great job man. Looking forward to test the 0.02 version ;)
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5641
Location: France

Re: Physic plug-in for ShiVa

Postby makkar » 05 Sep 2011, 07:59

Your demo is really impressive! I don't have any particular feature needs other than everything :) so I'd just like to see what you plans are.

Do you plan to create an Android implementation some time? Would that be much faster on mobile than the current ODE?
User avatar
makkar
Platinum Boarder
Platinum Boarder
 
Posts: 1500

Re: Physic plug-in for ShiVa

Postby ThunderZ » 05 Sep 2011, 08:43

Wonderfull pluging with exellent exemple.
Really great work !!!!
User avatar
ThunderZ
Platinum Boarder
Platinum Boarder
 
Posts: 429
Location: France - Loiret

Re: Physic plug-in for ShiVa

Postby Heartbroken » 05 Sep 2011, 15:50

Hi makkar

Yes sure I'm going to make an Android version as well. And for its speed, I hope it will be able to handle not less objects than the system is able to render :)
Heartbroken
Fresh Boarder
Fresh Boarder
 
Posts: 9
Location: Montpellier, France

Re: Physic plug-in for ShiVa

Postby michax » 05 Sep 2011, 18:23

Great work ! I wonder how it will perform on mobile :)
User avatar
michax
Platinum Boarder
Platinum Boarder
 
Posts: 466
Location: Poland

Re: Physic plug-in for ShiVa

Postby 8DashP » 10 Sep 2011, 02:16

Heartbroken wrote:I saw there already was an attempt to make a Bullet based physic plugin, but that project looks frozen so I decided to make it by myself as I need it for the game I want to make.


Great work on the plugin and documentation. It looks like a very nice, clean implementation.

I'm afraid my version is still "on hold" for now. I'm starting to get back into programming after 4 months away, which is why I'm catching up on forum posts, but I don't know yet where my priorities will lie. Do you plan on making a full bullet implementation (as far as practical anyway), or are you just looking to do a subset?

Interesting you've taken the approach of automating the attachment of the physics to the objects through AI Models. My approach was a pure code approach of converting bullet calls to Shiva calls and allowing the programmer to do all the attachment manually. Your approach certainly makes it much simpler to get going, although do you think in the long run this may limit some flexibility? I don't know, I'm just wondering. There's an awful lot of configuration parameters for the full physical model on each object, especially when joints are involved.

Anyway, if you come across something I might have covered already and can help with, feel free to contact me. Keep up the good work.
Russell - http://store.synapticbytes.com - Software Store now open, including ShiVa3D assets
Checkout sbPhysics, the bullet physics plugin, plus the Partifex particle libraries on the store
User avatar
8DashP
Platinum Boarder
Platinum Boarder
 
Posts: 1123
Location: Queensland, Australia

Re: Physic plug-in for ShiVa

Postby FF.Fan » 10 Sep 2011, 08:38

Good Job ! Can't wait to see more :)
Really impressive.
User avatar
FF.Fan
Gold Boarder
Gold Boarder
 
Posts: 270
Location: France

Re: Physic plug-in for ShiVa

Postby Heartbroken » 11 Sep 2011, 15:54

8DashP wrote:Do you plan on making a full bullet implementation (as far as practical anyway), or are you just looking to do a subset?

Hi 8DashP. I'm going to expose all the Bullet's feature that can be useful. And probably add something from my self. But I won't preserve the Bullet's interface if it doesn't fit well to ShiVa's idiom or even just to my preferences. That's why I don't call the plugin 'Bullet' but 'based on Bullet' :)

8DashP wrote:Your approach certainly makes it much simpler to get going, although do you think in the long run this may limit some flexibility? I don't know, I'm just wondering. There's an awful lot of configuration parameters for the full physical model on each object, especially when joints are involved.

For me, ShiVa is more appropriate for short term projects of *not so experienced in programming* teams or individuals. For this I want to minimize the amount of scripting and parameters, as well as provide the available parameters with reasonable default values. But sure, I can't predict if it will be as handy as I imagine it. Will see.

8DashP wrote:Anyway, if you come across something I might have covered already and can help with, feel free to contact me. Keep up the good work.

Thanks :wink:
Heartbroken
Fresh Boarder
Fresh Boarder
 
Posts: 9
Location: Montpellier, France

Re: Physic plug-in for ShiVa

Postby Heartbroken » 11 Sep 2011, 19:01

Hi all

This weekend I finally had an opportunity to test the plugin on iOS (thanks to NiCoX).
After some compilator options black magic and some playing with the Bullet's collision algorithms, the first good news - it works. My test device is iPod Touch 4 (iOS 4.2.1), and the speed is something like 10-20 (sometimes even 100) times slower than my laptop, but it still usable as for me. My laptop is quite powerful one :)

Above is a short analysis of each of four scenes in my demo. There are some screenshots where, at the top, you can see a kind of profiler. The number in the right corner is current FPS. The number in the left corner is the time taken by the simulation step in milliseconds. And the RGB line near the step time is the step phases details - RED for the broadphase (computation of objects pairs with overlapping bounding boxes), GREEN for the narrowphase (contact points computation for each overlapping pair) and BLUE for solver (computation of the contacts and joints constraints impulses). All the values are averages for several frames (approx. 200ms).

1. Simple
Nothing is moving on this scene, but initially all the objects are active. The simulation take around 13 milliseconds. This wall of the boxes seems to be quite heavy thing for my iPod. I tried to run the similar scene (a wall of 5x5 unit boxes) on ODE physics on my iPod and FPS was about 10 all the time. But probably I was doing something wrong.
Image

After a couple of seconds all the objects go to the sleeping state and the life is getting much better.
Image

2. Kinematics
At the start the time is almost the same as in 'Simple'.
Image

But later, even when all the boxes have fallen down from the platform they are still active as their bounding boxes overlap the platform's bounding box and it activates them on each step. So it's important to let your dynamic objects to go to the sleeping state as soon as possible.
Image

3. Joints
Just two joints don't add much work for the solver, so at the start the simulation time is the same.
Image

And as all the boxes are thrown away from the platform they can sleep now.
Image

4. Terrain
I removed the ocean from this scene as I wasn't able to make it render right on iPod. But as it shares the collision implementation with the terrain it's not necessary for testing.
So as the scene starts and the objects fall on the terrain, the simulation starts to take awful ~90ms for one step. Looks scaring. But it's not so hopeless. Bullet collision system has a lot of space for optimization, I will just need to implement a couple specific collision algorithms like box-triangle and capsule-triangle and I believe it will work much faster.
Image

And as usual - "Who sleeps he doesn't ask to eat" (an old Russian saying). So if your objects are initially sleeping, and if you don't place 25 boxes in one terrain notch like me, you can use the terrain even now.
Image

That's it. If someone could try the demo on the other iOS devices I would be happy to know the results. The STK file for iOS is here:
http://bitchingames.com/bikini/Demo_Bikini_iOS-0.01.01.stk

Thanks
Heartbroken
Fresh Boarder
Fresh Boarder
 
Posts: 9
Location: Montpellier, France

Re: Physic plug-in for ShiVa

Postby Scribe » 12 Sep 2011, 00:27

I'm curious, how's performance vs ODE?

What are some of the primary benefits of using bullet physics over ODE?
ShiVa 3D 1.9.1 | UAT 1.3.1
VS 2010 | Xcode 4.1 | iOS 5.0.1
PC: OS Windows 7 x64 | CPU Phenom II X6 | Memory 16GB | GFX Geforce 480GTX
MacMini: OS OSX 10.7 | CPU i7 3.4ghz | Memory 4GB | GFX ATI 6630M
Scribe
Gold Boarder
Gold Boarder
 
Posts: 286
Location: UK

Re: Physic plug-in for ShiVa

Postby scorpio » 13 Sep 2011, 02:01

Interesting stuff and great work!

1. How far along is the port?
2. What features have been implemented so far?
3. Do you plan on skipping any features that you know of at this point ?
4. How does the plugin/wrapper fair performance-wise vs the unwrapped engine ?

Sorry for the 100 questions quiz but I'm so very much interested in this plugin :)

@Scribe
Google Bullet vs ODE for more details but from what I've been able to find out so far Bullet is more consistent in detection and supports a few more features like continuous hit detection and native convex hull support, is growing faster overall and its faster but by how much I dunno yet. Hope that helps a bit :)
Find me on :
irc.shivaplace.com:16669
(Java chat client: http://www.shivaplace.com/irc )
or
AOL messenger login in my profile
Please speak English or Polish.
scorpio
Senior Boarder
Senior Boarder
 
Posts: 72
Location: Poland

Re: Physic plug-in for ShiVa

Postby Heartbroken » 13 Sep 2011, 18:19

Hi scorpio
Thanks for your interest. I'll try to answer all your questions, hope I understand them correctly.

1. Do you mean porting for different platforms like iOS and Android? The best thing in Bullet is that there's no need to port anything. It's already cross-platform. My task is only keep the plugin-wrapper code cross-platform as well.
2. I have described all available features for v0.01 in its manual. In short - it's basic dynamic simulation, kinematics, several types of collision shapes, shapes material parameters, one joint, ray cast, collision events and my favorite - ShiVa's terrain and ocean. And maybe something else less significant.
3. For the moment I doubt if I will expose Bullet's soft bodies simulation. Though it looks cool in demos, but I've never seen someone using it in real games.
4. I didn't check this. I know the way plugin communicates with ShiVa is not very efficient for now. But this will probably be changed after the next ShiVa release.

Thanks again and if you have more questions just ask :)
Heartbroken
Fresh Boarder
Fresh Boarder
 
Posts: 9
Location: Montpellier, France

Re: Physic plug-in for ShiVa

Postby scorpio » 13 Sep 2011, 19:16

Heartbroken wrote:Do you mean porting for different platforms like iOS and Android?

I mean when will you be ready with porting all the features of the plugin? A sort of ETA. I know its fluid like any other development but a rough estimate would do.

As the features are concerned .. can you link me the manual ? I'm wondering. Do you intend bullet to be a replacement of ODE or to somehow work alongside ?

Thanks.
Find me on :
irc.shivaplace.com:16669
(Java chat client: http://www.shivaplace.com/irc )
or
AOL messenger login in my profile
Please speak English or Polish.
scorpio
Senior Boarder
Senior Boarder
 
Posts: 72
Location: Poland

Next

Return to Plugins