Jump to content

  • Log In with Google      Sign In   
  • Create Account

Creating a Game Engine - Where to Start


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 Xooch   Members   -  Reputation: 179

Like
0Likes
Like

Posted 21 December 2012 - 12:42 PM

Hello,

 

I've been given a task to create a game engine, I am working on the graphics part of the engine. Now I don't know alot about creating an engine, I know what they do but thats about it.

 

Here is the scope of my problem.

 

I need to be able to allow a user to create objects to the screen in real-time, using input from the keyboard or mouse, either by typing command lines or clicking buttons, the user should then be able to place the objects where they desire by either being prompted to enter X,Y,Z cords or simply drag and drop (alot harder, will try to avoid that method).

 

I'm completely confused on even how to start this, I have fairly good knowledge when it comes to DirectX11 and I know how to create objects in a 3D space. But I have no idea how to do this, so I was wondering if someone could point in the right direction, what I should be looking at, I am constantly being told I should be using design patterns such as Factory Method or Service Locator, but I can't get my head round it. I guess what I am looking for is sample code of a working project which works similar to what I am trying to do, or UMLs which explain it better.

 

Any help would be appreciated, if my question is too bland please ask so I can help you help me..



Sponsor:

#2 Morphex   Members   -  Reputation: 298

Like
0Likes
Like

Posted 21 December 2012 - 12:50 PM

So you area basically creating a scene editor?

 

My first comment is , if you are creating that, you are not creating a engine, but rather a editor. The engine part should be already done and it would simplify most of those operations. 

So my first bet is to actually create  something that renders your objects with hardcoded positions to the screen.

 

Then your editor would only , create, translate and rotate them around using your "engine" methods. 

The factory Design pattern could help you in creating your objects, but its is not needed. Start simple.Get things done, then improve with your experience.


Check out my new blog: Morphexe 


#3 Xooch   Members   -  Reputation: 179

Like
0Likes
Like

Posted 21 December 2012 - 12:55 PM

At the moment yeah, I have a system where I am able to hard code objects to the screen, adding in the coords (X,Y,Z) manually into the code I am able to create a scene, but this doesn't solve my problem. So whats my next move, how am I able to get this code to be more flexible so anybody can use the application to create what they want without knowing C++ or DirectX



#4 L. Spiro   Crossbones+   -  Reputation: 14424

Like
2Likes
Like

Posted 21 December 2012 - 12:56 PM

Firstly ignore any advice you got related to patterns.  That is general/overall advice and has nothing to do with getting started, nor anything to do with graphics.  You can always find an excuse to use a pattern somewhere, but if and when you do it will be because you decided it was appropriate, not because someone told you do use a pattern and you went on a wild goose chase looking for where you can use them.  They don’t work that way and it would be better to just forget about them and lighten your load for now.

 

 

How to start a graphics engine?

Create a window and a device.

 

Then create a 3D file format that allows you to load 3D objects.

 

Then create something that draws those objects.

 

Things get more open-ended around that point, so instead of continuing to list a step-by-step procedure it would be better if you came back with further questions at that time.

 

 

L. Spiro


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#5 Xooch   Members   -  Reputation: 179

Like
0Likes
Like

Posted 21 December 2012 - 12:58 PM

Firstly ignore any advice you got related to patterns.  That is general/overall advice and has nothing to do with getting started, nor anything to do with graphics.  You can always find an excuse to use a pattern somewhere, but if and when you do it will be because you decided it was appropriate, not because someone told you do use a pattern and you went on a wild goose chase looking for where you can use them.  They don’t work that way and it would be better to just forget about them and lighten your load for now.

 

 

How to start a graphics engine?

Create a window and a device.

 

Then create a 3D file format that allows you to load 3D objects.

 

Then create something that draws those objects.

 

Things get more open-ended around that point, so instead of continuing to list a step-by-step procedure it would be better if you came back with further questions at that time.

 

 

L. Spiro

 

 

Ok, I have created a window, using hwnd, and Direct3D device aswell as a back buffer, what do you mean by a 3D File Format?



#6 L. Spiro   Crossbones+   -  Reputation: 14424

Like
0Likes
Like

Posted 21 December 2012 - 12:58 PM

At the moment yeah, I have a system where I am able to hard code objects to the screen, adding in the coords (X,Y,Z) manually into the code I am able to create a scene
That would have been nice to know from the first post.

So whats my next move, how am I able to get this code to be more flexible so anybody can use the application to create what they want without knowing C++ or DirectX
By allowing them to select which 3D object they want to add to the scene. Probably by adding a Browse button.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#7 L. Spiro   Crossbones+   -  Reputation: 14424

Like
0Likes
Like

Posted 21 December 2012 - 01:00 PM

Ok, I have created a window, using hwnd, and Direct3D device aswell as a back buffer, what do you mean by a 3D File Format?
If you want to load 3D objects, you will need to store the data inside of a file.
Make a file format that contains the 3D data for your models. Vertices, normals, materials, textures, etc.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#8 Morphex   Members   -  Reputation: 298

Like
0Likes
Like

Posted 21 December 2012 - 01:07 PM

Your question is really open right now, what do you mean by creating all they want? 

Well thats a big question because you can't make a generic editor that will be used by everyone and to everyone needs, you need some sort of requirements. From your first post your requirements where: Create Objects, Translate and Rotate them in the world.

 

So start with that. You will need some sort of Scene Structure, do you have that? This would be where all the information of your scene is detailed, objects, positions, translations.

 

After that, you will need to decided what features you need, if your objects are sorted in list, you would need some sort of uniqueID, Name to distinguish them in the world.

After you have that, selecting a object would be a matter of requesting by that ID/Name, after that you could change your positions via other methods.

 

As I said, start simple, then keep adding features as you need it.


Check out my new blog: Morphexe 


#9 kuramayoko10   Members   -  Reputation: 386

Like
0Likes
Like

Posted 21 December 2012 - 04:11 PM

Ok, I have created a window, using hwnd, and Direct3D device aswell as a back buffer, what do you mean by a 3D File Format?
If you want to load 3D objects, you will need to store the data inside of a file.
Make a file format that contains the 3D data for your models. Vertices, normals, materials, textures, etc.

An easy format to work with is Wavefront OBJ (.obj)

All 3D modeling softwares export to this format.

 

I've worked with it using OpenGL, but since there are many open-source loaders for this format out there, translating it to DirectX specifications should be straightforward.


Edited by kuramayoko10, 21 December 2012 - 04:11 PM.

Programming is an art. Game programming is a masterpiece!

#10 L. Spiro   Crossbones+   -  Reputation: 14424

Like
1Likes
Like

Posted 21 December 2012 - 10:39 PM

It should be mentioned that you should never load directly from .OBJ, .DAE, .FBX, etc. into your run-time.  These formats should be converted to your own custom formats and loaded into your run-time with your own custom loader.

 

 

L. Spiro


Edited by L. Spiro, 22 December 2012 - 07:54 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#11 simpler   Members   -  Reputation: 913

Like
0Likes
Like

Posted 22 December 2012 - 07:28 AM

It should be mentioned that you should never load directly from .OBJ, .DAE, .FBX, etc. into your run-time.  These formats should be converted to your own custom formats and loaded into your run-time with your own custom loader.

 

Whats the reason to why you never want to do that?

 

I can recommend Assimp if you easily want to import many different model formats. Then once the models are imported you can easily export them to a custom format if you want.



#12 L. Spiro   Crossbones+   -  Reputation: 14424

Like
3Likes
Like

Posted 22 December 2012 - 07:50 AM

Whats the reason to why you never want to do that?

Because those file formats were intended from the start to serve a different purpose. They are meant to provide a means of transferring data from Autodesk® Maya® to Autodesk® 3ds Max®, for example. As such they contain all possible data you could imagine that should be shared between 3D-authoring tools.

 

This is not desirable in a game-oriented format.

Your files should contain no more data than your engine can load and use.  Imagine loading a gloss map when your engine can’t actually use gloss maps.  It doesn’t make sense.  You should only use a format that was designed for your engine, and .OBJ, .FBX, and .DAE were not.

 

Furthermore, since these file formats were designed to transfer data between 3D authoring tools, they do not store their data in a game-friendly format.

In other words, a game-friendly format would allow your engine to load the vertex buffers directly into memory with no processing.  On the other hand, .OBJ, .DAE, and .FBX require that you parse faces, index into vertex/normal/UV pools, and construct the final vertex buffers that you need.

This is obviously undesirable overhead for games.

 

Then there is the idea of distribution.  Do you want your engine to rely on Assimp or do you want your tools to rely on it?  It is easy to make tools that rely on loaders—you don’t need to distribute those with your games so their licenses don’t matter at all (literally there is no way to prove how your own files came into existence so no matter what technology you use to make your own format there is no possibility of ramifications, hence there is no such thing as a license that burdens you based off how you created your own file format).

But if it is your engine that requires X library to load its 3D format you had better check the conditions under which you can distribute said loader.  If you made your own format, this will never be a problem.  If not, this will always be a problem.

 

 

Then there is loading time.  My converter uses the Autodesk® FBX® SDK to load .FBX files.  That in itself takes over 2 seconds on some files and is out of my hands.  Those same files converted to my engine format take 0.2 seconds to load.

 

 

Basically, .OBJ, .DAE, and .FBX were not meant to be loaded directly into games.  They were designed for a specific purpose and should be used for that purpose.

The things you load into your engine should have been designed for loading into your engine.

 

 

L. Spiro


Edited by L. Spiro, 22 December 2012 - 07:56 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS