Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Well I'm completely completely new to computer graphics and even more to game development. I am searching info and all that stuff to have the basics quickly. But there's a big question mark in my head: how does Crytek Engine or Unreal Engine or any other game engine related to OpenGL or DirectX ?

I'm very interested in game physics but I can't figure out how game Physics + graphics + engine come together; there are gaps I cannot fill. Either you tell me what it is or somewhere I can read about it would be great!

share|improve this question
    
Here's part of the answer but it just bring other questions. scientificninja.com/blog/write-games-not-engines –  BRabbit27 Dec 7 '11 at 19:05
    
Where does the physics enter? It's like I should write a physics algorithm, for instance collision algorithm and then making some circles created on OpenGL behave according to my physics algorithm? –  BRabbit27 Dec 7 '11 at 19:09
add comment

1 Answer

up vote 6 down vote accepted

TL;DR: An engine is just a collection of reusable components.

Wall of text: Games store a representation of the world, e.g. you'd have an entity like a house, which has a mesh that defines what its geometry looks like and a position.

Now, you probably have more than one entity. Let's say we've got a player controlled character and some boxes. When the player wants to move, you'd move the character and check if he collides with any boxes. That's where physics come into play. Depending on how physics are modelled, the character might just walk through the boxes, stop in front of the boxes or push the boxes.

Mind you, this only changes the internal state of the game world.

Then, after calculating movement and physics, you'd render a frame, e.g. draw the current state of the world on the screen.

OpenGL and DirectX are graphics APIs, they are only used to render stuff (e.g. the character) to the screen.

So, you're basically telling OpenGL/DirectX 'I want to draw the character at position1 and a box at position2, and ...'.

Of course, this is a gross oversimplification.

Anyway, since we don't want to walk through that procedure step by step all the time, we put that stuff into functions and classes. So, we might have a class physics which holds all the functions needed for the physics simulation, or a graphics class which interfaces with the graphics api and draws our entities. Et voila, we've got an engine.

share|improve this answer
    
There's an accent missing "Et voilà" haha just joking. Thanks very much I think I was thinking right but wasn't sure so I decided to ask. Thanks a lot! –  BRabbit27 Dec 7 '11 at 19:52
2  
DirectX isn't graphics API, but Direct2D and Direct3D are. –  Jaakko Lipsanen Dec 8 '11 at 4:34
    
@JaakkoLipsanen yes I see now, DirectX is a complete framework for game development (3d, audio, video, etc) and Direct3D is just the graphics module. –  BRabbit27 Dec 8 '11 at 15:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.