• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Marz Tierney

Need Better Physics Engine in Game

12 posts in this topic

Okay, so this is my first Post, so please forgive me as I'm sure I won't be giving out enough information.

I've been working on a project for some time now, and I'm trying to create a better physics engine, however physics is not my best subject. My game is similar to minecraft, there are static chunk objects, and physics objects. My main problem is that it seems very laggy, compared to other games, even with high fps. So i'm wondering if I [b]should be putting the physics step on a thread and just using the position data etc for the rendering[/b] in order to get better movement? Another problem is, [b]how do I do rotational collisions[/b]? Here is some of my code for collisions.
[attachment=12348:townGen4.png]

// This is for when a physics object when it hits the bottom of a block (static position)
void collide(PVector loc_, float r_) {
...
if (checkTop(loc_,r_,r_,r_)){
vel.y*= -bounce;
loc.y = loc_.y + r_+h+teleport;
hasCollide = true;
} else if (checkBottom(loc_,r_,r_,r_)) {
vel.y *= -(bounce);
loc.y = loc_.y -r_-h-teleport;
hasCollide = true;
isOnGround = true;
if (vel.y > -0.7 && vel.y < 0.7 && inBlockID == 0) {
vel.y = 0;
}
...
}

boolean checkTop(PVector loc_, float w_, float h_, float d_) { // Check Y axis collision
if ( loc_.y + h_ > loc.y - h && loc_.y - h_ < loc.y - h && // Y top's edge is between Blocks borders
loc.x < loc_.x + w_ && loc.x > loc_.x - w_ &&
(loc.z < loc_.z + d_ && loc.z > loc_.z - d_) )
return true;
else return false;
}
boolean checkBottom(PVector loc_, float w_, float h_, float d_) {
if ( loc_.y - h_ < loc.y + h && loc_.y + h_ > loc.y + h &&
loc.x < loc_.x + w_ && loc.x > loc_.x - w_ &&
(loc.z < loc_.z + d_ && loc.z > loc_.z - d_) )
return true;
else return false;
}

Would I have to check all the points along a plane to see if it goes through another plane? as they would not be parralel. (The sides of an object)
Also is there a better way to make sure a physics object doesn't clip through the block, besides setting its location outside of it?
(loc.y = loc_.y + r_+h+teleport;)
0

Share this post


Link to post
Share on other sites
Yeah i've seen some of them libraries before, they look amazing, but i'de prefer to implement my own, for the experience mostly. I guess i'll have to search more for examples or explanations on how to implement a simple version of bullet physics.

Im going for something like this:
http://www.youtube.com/watch?v=eQMBGLMtdFE
I just need to get a better way to do collisions.
0

Share this post


Link to post
Share on other sites
My goal does not involve using a physics engine, it involves building one. Game development is a hobby of mine, the features of a physics engine I need are not so far out of my grasp. I will find the answer if I spend more time on it. I'm a uni student after all with much free time. I've got experience in robotics too, so a physics engine also interests me. However I will try out some of the recommended physics engines in the mean time.

Regarding your suggestion of getting my game out there, what is the best way to go about this? I'm guessing releasing a playable version online somewhere, have you done this before?
0

Share this post


Link to post
Share on other sites
Fair enough :)

Releasing and publishing a game is a completely different subject, and I can't say I'm really experienced in that matter, there are however systems such as steam greenlight which can help you with getting your game published for a very reasonable fee. I'm mainly a graphics and gameplay programmer (and CS and former engineering student) myself, things like publishing and legal matters I leave to my business partner who's qualified to handle those things.
1

Share this post


Link to post
Share on other sites
Wow great links, they seem like just what I was looking for. I am well in it for the learning experience as well. 2D physics are very similar to 3D, my first 3D physics simulations were based directly off 2D. There is a lot of maths involved with getting the camera to work in opengl, it's possible, just hard haha. I was mostly working on data structures, loading on threads and world generation techniques before, and my physics engine (which I neglected) was based on older version off a 2d version of Daniel shiffman's physics examples I got my hands on in first year uni, something similar too:
http://natureofcode.com/book/chapter-2-forces/

Ahh okay, I'll look into steam greenlight for publishing. Atm though I'm mainly interested in having my game on a site, so people could possibly beta test it, have you done this before? I also have a bunch of questions about graphics programming, I'm using VBO's for the cubes, trying to implement a simple light shader, or the reflective water like in Terasology!

Well it seems I have a long and interesting road ahead. If I have any more questions I'll post them :D thanks for all the help!!
0

Share this post


Link to post
Share on other sites
Do you need the blocks to rotate? For a voxel based game, i think non-rotating cubes would be better because:
1.They fit in holes, if you rotate a cube you cant fit it anywhere because its never aligned right
2.Simpler for you to implement
3.Faster physics?

Though if you want to have objects that are not 1-cube-sized, it might not work that well. But for non-rotating multi-voxel objects, you could make big sliding doors out of them or something, which might be buggy with rotation...
1

Share this post


Link to post
Share on other sites
I 2nd Radikalizim ... any time you spend writing your own physic "engine" or even just rigid body physics routines is a waste, just use bullet physics and get the job done. You can override any of the bullet callbacks/solvers and have your own custom implementations.
0

Share this post


Link to post
Share on other sites
I need rotational collisions for skeleton/body physics, and also it's alot better if the cubes rotate... And yes Olof, i've read alot so far, and I realize there is alot of work that goes into physics engines, but I find if I make my own engine, it is easier for me to debug and modify. I know how versatile they are to use, but I don't think I need to implement all the features they have. The example i've looked at uses points and tests them in a feild, i'm not sure exactly because the dependencies are a little confusing, but im guessing the way to check basically would be to check all the points on a plane go through another plane? This mathematically makes sense, but would take alot more processing power.

http://www.openprocessing.org/sketch/39230
0

Share this post


Link to post
Share on other sites
I wasn't saying anything about the work going into the physics engine, I just said there is a non-trivial amount of work _using_ any physics engine, and that you can learn a lot from it that is useful when you make your own. And most are very modular, so you can use for example the collision detection part of it, and implement your own physics, and thus take it one problem at a time.

There is a certain pride in feeling you have control over _all_ the code in your project, so I totally understand your wish to roll your own :)
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0