Advertisement

Integrating Physics Into Rendering Engine

Started by July 01, 2018 08:56 PM
6 comments, last by 0r0d 6 years, 5 months ago

I'm currently a college student and have been working on a personal project for my own enjoyment.  I've completed a pretty wholesome rendering engine, and I was wondering what the best approach is for tying it to a physics engine.  Additionally I don't know whether or not it would be better to attempt to learn an existing engine, or just write my own physics.  

 

I know the question coming is "well what do you want to do with the engine?" to which I say general enough to be able to create 3D and 2D platforming/action adventure content..

 

I know this is vague; please ask me questions if I need to elaborate specifically!

 

Thanks so much, and sorry!

Additionally, Idk if my question goes here. I've made a few games on my own before in free engines, so I'm not exactly new to this, this is just my first time writing my own engine of sorts.  I wanted to most in a different forum, but it wouldn't let me, so here I am lul

Advertisement

Have you made a full game yet using a library or framework, even a simple one that contains a working game loop with a logic and draw state (Not something in a program like GameMaker that does this behind the scenes)? What is your current understanding of a full game loop? Have you used another library or framework before that handles logic, rendering, ect... in which you had to combine?

On 7/1/2018 at 2:56 PM, hpiper3097 said:

Additionally I don't know whether or not it would be better to attempt to learn an existing engine, or just write my own physics.

This depends on if you want to make the engine yourself at a low level, or if you're more concerned with having something in place quicker that allows you to work on your game. 'Better' is really subjective and more based on your current goals.

2 hours ago, hpiper3097 said:

I've made a few games on my own before in free engines

What engines have you used? What is your experience in programming? What language are you using?

Simply put your game engine is just a collection of other components. For example if I programmed my own rendering engine, then I programming an event handler, basic 2D AABB collision detection, keyboard input, ect... I would take everything and include it into the same project file in correlation with my game loop.

2 hours ago, hpiper3097 said:

Additionally, Idk if my question goes here.

If you're talking about programming a physics engine, this is well beyond beginner. Maybe look at this forum: https://www.gamedev.net/forums/forum/7-math-and-physics/

Programmer and 3D Artist

10 minutes ago, Rutin said:

Have you made a full game yet using a library or framework, even a simple one that contains a working game loop with a logic and draw state (Not something in a program like GameMaker that does this behind the scenes)? What is your current understanding of a full game loop? Have you used another library or framework before that handles logic, rendering, ect... in which you had to combine?

No.  I've made a kind of demo of sorts with a few levels in SDL, but nothing complete.  I have a pretty good understanding of the game loop.

10 minutes ago, Rutin said:

What engines have you used? What is your experience in programming? What language are you using?

Mostly UE4 and a little bit of Unity.  I'm a student, but I've been using C++ for about six years now, and I'm comfortable using the modern iterations of it with effective design patterns. I'm using only C++ on this project for the immediate future.

 

15 minutes ago, Rutin said:

This depends on if you want to make the engine yourself at a low level, or if you're more concerned with having something in place quicker that allows you to work on your game. 'Better' is really subjective and more based on your current goals.

If you're talking about programming a physics engine, this is well beyond beginner. Maybe look at this forum: https://www.gamedev.net/forums/forum/7-math-and-physics/

I'm interested in doing it myself from a low level.  I'm doing this mainly as an educational exercise for myself right now.

Well then you just need to go out and build your physics engine, and when you're ready just create you game project and use your rendering engine to render graphics, and include your physics engine for physic related tasks. This is no different than going online and downloading a library for (x) and including it into your game. If you understand how a game loop works and how different systems work together then you already know the answer to your question. :) 

Programmer and 3D Artist

Thank you!! I think I wanted to over-complicate it, but seeing it typed out like that I understand now.

Advertisement
On 7/1/2018 at 1:56 PM, hpiper3097 said:

I'm currently a college student and have been working on a personal project for my own enjoyment.  I've completed a pretty wholesome rendering engine, and I was wondering what the best approach is for tying it to a physics engine.  Additionally I don't know whether or not it would be better to attempt to learn an existing engine, or just write my own physics.  

First off, a physics engine is a complicated thing.  Even if you already have a really good understanding of the math and physics required, it's still a very complicated thing.  

My suggestion is to tackle it in the same way I'd recommend tackling anything: break it down into small, simple steps that can be done separately, with each additional one building on the previous one and the knowledge you got from it.  This way you take variables out of the equation.  As such, get an existing engine like Bullet, integrate that with your rendering engine.  Then build a small test scene or game, whatever you want, that uses both the rendering and physics.  Once you have that all working and you understand what Bullet does and why it does it, then build your own if you still want to.  This will be immensely easier because you have now not only worked out and solved the integration issues, know exactly what features you need from your new engine, but you also have a test case against which to test your new physics code.  If you #ifdef your code, you can switch between the old and new to help debug issues.

I would NOT recommend building your own engine first because that's going to be a lot of pain and frustration.  The way you accomplish a large and complex project with a lot of stuff you've never done before is by doing it one thing at a time, not by trying to do the whole thing at once.

This topic is closed to new replies.

Advertisement