Integrating BEPUPhysics with an existing project

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Integrating BEPUPhysics with an existing project

Post by jaja1 »

Hello guys! First post on the forum :)

I am currently developing an MMO in unity and photon server. Since it is an authoritative server I need to do stuff like collision calculations on the server side. I'm reading through the docs right now for this engine but I'm still not 100% sure how to start integrating BEPU with my project. Can anyone just give me a brief guide as to where to start? (sorry for such a vague question...)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Integrating BEPUPhysics with an existing project

Post by Norbo »

The Getting Started documentation shows a minimal simulation. The BEPUphysicsDemos, contained in the main source download, show dozens of different simulations covering the engine's features. The EntityConstructionDemo is particularly helpful for becoming familiar with some of the engine layout.

To do much better than that, I'll probably need more specifics :)
jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Re: Integrating BEPUPhysics with an existing project

Post by jaja1 »

Ahhhh thank you for the reply Norbo :D

I will check out the examples and documentation in more detail in just a few hours...busy life :(

Let me see if I have this right:
I think I need to create an "invisible copy" of the maps on the server side and based on the type of character the player is using, his equipment etc, that will determine the sort of shapes that will be used for collision detection when say he/she attacks a monster on the client. So I basically want every instance of the character class on my server to have its own colliders attached to it which will be defined by BEPU's code. So essentially for now my main aim is to design a method that is called every time the player's input is recognized as an attack command AND the player's weapon or fists etc. is in contact with the enemies collider on the server side.
I'm confused at to whether BEPU stores a copy of the character's mesh and uses it for collision detection or do I have to manually draw and update an "invisible" set of shapes that belongs to the character class that is used for collision detection based on its position in a space? Same goes for the enemy class. Hope you understand how I phrased this :oops:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Integrating BEPUPhysics with an existing project

Post by Norbo »

The graphical and physical representation of characters and objects are fully separate, so you will indeed need a separate bunch of BEPUphysics objects representing things.

Typically, the physics representation is much, much simpler than the graphical version. Simple primitives like BoxShapes and SphereShapes are much higher performance than trying to use an actual mesh-based shape. Since the characters and enemies would likely be represented by the CharacterController, they would just be a cylinder.

The way to implement more fine grained collision detection for, say, the hitboxes of body parts on a character, depends on a lot of details. Multiplayer complicates things quite a bit. By default, latency will make most attempts to perform high frequency hit detection somewhat pointless due to the difference in what the client and server see. Games like Counter-Strike jump through a lot of hoops to make things work, and not all of the tricks scale up to MMO levels well.
jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Re: Integrating BEPUPhysics with an existing project

Post by jaja1 »

Thanks alot for the reply again Norbo!

Think I got an idea on how to work this out now using simple primitives. Once I figure out the code I should be well on my way to making things work the way I want them too :)
Post Reply