Sign in to follow this  
deathwearer

Some questions about 3D Engines

Recommended Posts

Hello, I recently created a small 3D game using DirectX. Now I'd like to make a 3D engine for learning purpos and I'm in front of some questions. 1. What's inside a 3D engine and what it does? Does it take care of loading map, the rendering, the world transformation, creating the light and the particule effects? Is the input movement inside a 3D engine? If you have any website or article that refer to this question, that would be very nice, because if I'm planing to make one I better start learning what it is exactly, before doing one. 2. How is a 3D engine used? I mean, is is compiled and used as a lib?(lib or dll). Do you keep it uncompiled and code your game inside the project? 3. This one is a bit offtrack, but still related. How are game maps created. I know some of them use their own map editor (such as HL). Is there any tool that is commonly used if they don't use their own? And is it possible to make maps using 3D max. Because for my map in my game i used DeleD. Created the map and exported each object 1 by 1 in the .x format and it was pretty long. Thank you for your time. And if you have also documentation(website, free book) related to these question, I'll make sure to read it all.)

Share this post


Link to post
Share on other sites
Quote:
1. What's inside a 3D engine and what it does? Does it take care of loading map, the rendering, the world transformation, creating the light and the particule effects? Is the input movement inside a 3D engine? If you have any website or article that refer to this question, that would be very nice, because if I'm planing to make one I better start learning what it is exactly, before doing one.


Yes, then engine would handle all of the above. The goal of the engine is to handle all tedious calculations and provide all the groundwork so that someone can build their game with the characters, weapons, and levels they want instead of dealing with things like drawing polygons or sending packets or calculating ragdoll movements.

Quote:
2. How is a 3D engine used? I mean, is is compiled and used as a lib?(lib or dll). Do you keep it uncompiled and code your game inside the project?


I'm sure there's varying opinions about this, but most games are built in a dev environment (like Visual Studio) where developers can have access to the uncompiled engine code, so they can tweak it if need be, or more importantly, know how the internals work so their content works smoothly with the engine. When the code is all compiled, I believe most engines and games compile code out to libs and dlls.

Quote:
3. This one is a bit offtrack, but still related. How are game maps created. I know some of them use their own map editor (such as HL). Is there any tool that is commonly used if they don't use their own? And is it possible to make maps using 3D max. Because for my map in my game i used DeleD. Created the map and exported each object 1 by 1 in the .x format and it was pretty long.


Every engine I know of has a custom map editor. They do this because they have created their own game objects, the engine has its own internal representation of level layouts, and so they need to create the appropriate tool so that every map that you make will work in the engine.

Neither of these books is free, but I think they're worth the investment:

A good book (at least I think so) for engine development is 3D Game Engine Programming. You'll see mixed reviews on this, but the negative ones usually have to do with broken CD code or translation issues, neither of which is a problem if you download updated code from the author's website and know your English.

When you get your engine made, check out Game Engine Toolset Development.

Share this post


Link to post
Share on other sites
Thank for the infos!

I have a remaining question.

Is also things like map trigger built in the 3D engine? or is it left for the game code? So in the end what's left for the game code. Things like rules of the game and loading objects?

And I'm not too sure about your answer to #2. Must be my english lol =/ Are you saying that the engine is compiled into a library and they code the game on it. Or they code the game inside the uncompiled engine (Not talking about using the uncompiled as a reference)


Again thank.

[EDIT]

Also, if people code the game over the engine compiled in a lib. That mean they gotta pass a pointer to various stuff all the time? Because dll cannot keep store of variables and the likes. Doens't it make it less efficient (if that's the right word)

Share this post


Link to post
Share on other sites
For #2, you would code the game alongside the uncompiled engine. This way when you make your game you can see how the engine works. Then when you compile your game it will compile everything into their respective dll and lib files (the engine code will compile into its own dll and lib files, and your game content into others).

You don't have to worry about pointers in dlls with the engine because that happens at the lowest level of the engine, which game developers shouldn't be screwing with anyway.

As for map triggers, it’s a combination of the engine code and map tool. The engine code would need a scripting engine to drive particular events and triggers. For instance, if the map places a trigger on the floor that says "When I step on this, open the door", that will create an entity in the game (when the level is loaded) that essentially listens to the players position. When his position matches the triggers, it would call its effect function, OpenDoor().

I don't have a whole lot of experience with trigger systems, but I know it involves the map editor for placement and behavior choice, and the engine code for actually performing the behavior.

EDIT: Another good book is Game Coding Complete. It contains a lot of useful knowledge with regards to writing clean and efficient code in various areas of game development (such as event listeners, resource managers, etc.). It also discusses good debugging and testing practices.

Share this post


Link to post
Share on other sites
Quote:
Original post by ChopperDave
For #2, you would code the game alongside the uncompiled engine. This way when you make your game you can see how the engine works. Then when you compile your game it will compile everything into their respective dll and lib files (the engine code will compile into its own dll and lib files, and your game content into others).

You don't have to worry about pointers in dlls with the engine because that happens at the lowest level of the engine, which game developers shouldn't be screwing with anyway.


Ok. That's something I'm not too familiar with. You can have more than a single output file when you compile a single project? Like have a section that is the engine and it compile into a dll and have the game that compile into a executable in the same project?

And you say I don't have to worry about pointers in dll? Why? and how? I mean let's say your engine create a windows app and initialize D3D. When you call a function from a dll and lets say you passe a variable to this function. After the function is executed the DLL memory is release and your hwnd and you D3DDevice doens't existe anymore. What I'm wondering is how does it work at this level =/. When you start your game it does create somekind of instance with the dll and only release it when the game is close? Or something like that?

Thank

Share this post


Link to post
Share on other sites
Quote:
Original post by deathwearer
Ok. That's something I'm not too familiar with. You can have more than a single output file when you compile a single project? Like have a section that is the engine and it compile into a dll and have the game that compile into a executable in the same project?

In MSVC there is a difference between Solutions and Project, with a Solution being able to contain multiple Projects. You can make any project the active project, such that click on the build and run buttons will affect that project only. You can also build all projects in a solution. This is an elegant way to manage complex projects that are interrelated.

Quote:
And you say I don't have to worry about pointers in dll? Why? and how? I mean let's say your engine create a windows app and initialize D3D. When you call a function from a dll and lets say you passe a variable to this function. After the function is executed the DLL memory is release and your hwnd and you D3DDevice doens't existe anymore. What I'm wondering is how does it work at this level =/. When you start your game it does create somekind of instance with the dll and only release it when the game is close? Or something like that?

There's [plenty of] documentation. You should read it. The simplest thing I can tell you is that a DLL is nothing like a static library: DLLs are processes (just like EXEs), and have their own address spaces.

Share this post


Link to post
Share on other sites
Oluseyi, are you sure about that?
DLLs don't have their own address space, they share it with the attached process.

For instance, COM servers can be either in-proc servers (DLLs or OCX), whilst out of proc servers (such as MS Word/Excel) are out of process (address space) and require marshalling.

[EDIT: I agree that DLLs are very different to static libraries, 100 processes can attach to a single DLL, whilst 100 processes linked with a static library have their own independent copy of the library binaries as part of their executable. A DLL can create a memory block for each attached process, in the memory space of the attaching process]

Share this post


Link to post
Share on other sites
Quote:
Original post by Oluseyi
There's [plenty of] documentation. You should read it. The simplest thing I can tell you is that a DLL is nothing like a static library: DLLs are processes (just like EXEs), and have their own address spaces.


Well, I say this because I'v coded COM server with DLLs and it wasn't working like that =/

If you say the opposite I have NO trouble to trust you :P But this isn't how I saw dll until today.

P.S If you have docs that talk about using DLL as you say I'd be happy to read it and learn something new about them ^^

Thank guys

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