Jump to content
  • Advertisement
Sign in to follow this  
hufeilxl

what zhe "game engine" includes ?

This topic is 4867 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

we know we can use DirectX API to make a "3D game" , why we still write a "game engine" for a big "3D game". what zhe "game engine" includes ? why zhe "game enine" is so difficult to write(some good engine cost several years)?

Share this post


Link to post
Share on other sites
Advertisement
A game engine basically wraps around the API, so that you don't have to deal with the API directly while writing your game. For example, instead of calling DirectX's rendering function, you call your engine's function and then the engine deals with the low level stuff. There are several benefits to this...

1) It makes it easier to reuse code from one project to another. Commonly used code can be built into the engine so that it will not need to be duplicated in your next game.

2) It makes it easier to port the game from one platform to another. For example, let's say that you wrote a game that uses DirectX and you decide that you want an OpenGL version. You would have to go through your code line by line, delete all of the DirectX function calls, and replace them with the equivalent Open GL calls. Doing this would take a lot of time and your code would become very error prone. Instead, what you should do is to write an engine that gives the user (the game programmer) the option of using DirectX or OpenGL. Each engine function that calls the API will need to have two versions--an OpenGL one and a DirectX one. It would still be a lot of work, but this is a much better approach than writing a game with one API and then trying to switch APIs later.

3) It makes your game code cleaner and easier to understand. Because the engine is handling all of the low level API calls (initializing DirectX, loading textures, setting render states, etc.) your game code will only include game-specific stuff.

These are just a few of the benefits of game engines, but I'm sure there are others.

You might want to check out the book “3D Game Engine Programming” by Stefan Zerbst. It does a good job of showing you what an engine needs to do and how to implement it. I do have one warning about this book. The version that I have has some misprints (I even found a place on the CD-ROM where they forgot to translate some of the comments from German!) and there are a couple of corrupted files on the CD-ROM. You can download the corrections from the publisher’s website, but it’s kind of a pain. My copy have was printed a couple of years ago. Hopefully they’ve worked out the bugs since then.

Share this post


Link to post
Share on other sites
Thank you for explaining so clarity.
if there are some Direct3D API cann't suoport zhe effect I need ,
can I extend zhe Direct3D API ?

Share this post


Link to post
Share on other sites
I'm not quite sure what you're asking, and I'm not a DirectX expert (more of a hobbyist), but I'll give it a shot.

Basically, from what I understand, DirectX is what it is and there is no way to extend it. But if you learn the whole API, you should be able to create just about any kind of effect that you want (within the limits of your CPU and graphics adapter, of course). This site has tons of articles and forum posts about how to create just about any kind of effect that you can imagine.

The use of vertex shaders and pixel shaders is about the closest thing to "extending the API". Shaders allow you to write your own miniature programs that run on the graphics adapter's GPU. These programs replace parts of the fixed-function pipeline, so you get the flexibility of being able to write your own transformation and lighting code, while retaining the performance benefits of hardware acceleration.

I hope that answered your question.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!