Jump to content

  • Log In with Google      Sign In   
  • Create Account


high over 3d engine design


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
15 replies to this topic

#1 cozzie   Members   -  Reputation: 1550

Like
0Likes
Like

Posted 22 May 2013 - 04:16 PM

Hi all,


For the last years (with pauses) I've been working on my own C++ 3d engine.

I'm using D3D9 for rendering up till today (DX11 later now, gathering knowledge and experience first).

 

Everything's done on a hobby basis and last months I've been working myself through basics, like brushing up C++ and 2d games.

For who's interested: http://www.crealysm.com/games/Asteroidz%20v0.3.zip.

 

With all knowledge gained and articles/ books read, I'm rethinking my high over 3d engine design.

I would really like to hear your thoughts and gather input, before adding more and more functionality.

 

Below I've tried to explain 'the basic layout'.

Any input is really appreciated, what would you do, what do you think is wrong as initial design etc.

 

Next steps will be

- implemening correct usage of 'const' (when passing objects by reference)

- adding an entity manager/class structure (with vectors instead of dynamic arrays, which I now do for the 'static scene')

- rethink/ design classes using inheritance, not done up till now

- make some simple demo's along the way, adjust and improvise along the way

 

(my apologies for using text, the VS class diagram doesn't work somehow, something about keys being added already)

 

TOP LEVEL: NAMESPACES (including classes, .....)

 

- d3drenderer (camera, font, light, mesh, mesh instance, scene, shader, skybox)

- dxinput

- dxmath (boundingbox, struct likes vectors, materials, vertices)

- game (player)

- general (FPS/ timer)

- IO (fileformat for scenes, classes for light, mesh, meshinstance etc., api independent)

- math (structs API independent, vector, indices for materials/ submeshes, colors etc.)

- renderer (scenegraph class and structs for effects/shaders, lights, materials, meshes, instances etc.)

- audio (FMod audio wrapper, class)


Edited by cozzie, 22 May 2013 - 04:17 PM.


Sponsor:

#2 Steve_Segreto   Crossbones+   -  Reputation: 1492

Like
2Likes
Like

Posted 23 May 2013 - 12:34 AM

Here's my honest opinion. Focus on results, nothing else matters (especially correct usage of const). You see, all the end user is going to see is the results. Most likely nobody else but you will ever look at your source code, so don't waste time making it obsessively neat.

 

I downloaded and tried out your asteroidz game. Pretty decent asteroids game, good enough graphics. Very annoying that I ran out of ammunition so quickly. There was a sound bug when your shot hits two asteroids in rapid succession the sound effect is not played twice as I would have expected.

 

Overall, not a very impressive showing of DX9, could just as easily have been coded in SDL or WinGDI, but a good solid game and I spent about 5 minutes using it before I got bored (I reached 9th place on scoreboard).


Edited by Steve_Segreto, 23 May 2013 - 12:42 AM.


#3 cozzie   Members   -  Reputation: 1550

Like
1Likes
Like

Posted 25 May 2013 - 12:00 AM

Hi steve.
Thanks for your input and testing. Nice to hear, I'll do some changes in asteroidz v0.4.

The game was honestly just to see if I can finish somehing, no special d3d at all. I'll post a short demo of my engine next week.
On the engine side I'll just go on adding new cool stuff, maintaining clear code/structure, but not as a goal itself, thanks for that note.
Maybe I should also try to finish some simple demo using my engine, just to see how that goes (instead of blind staring at the structure/ design).

#4 cozzie   Members   -  Reputation: 1550

Like
0Likes
Like

Posted 27 May 2013 - 04:39 PM

@Steve; here's the demo I mentioned (work in progress though)

http://www.crealysm.com/engine/2013-05-28%20demo%20-%20in%20progress.zip

 

(movement W/S/A/D and mouselook)



#5 Jason Z   Crossbones+   -  Reputation: 4859

Like
2Likes
Like

Posted 28 May 2013 - 04:23 PM

Here's my honest opinion. Focus on results, nothing else matters (especially correct usage of const). You see, all the end user is going to see is the results. Most likely nobody else but you will ever look at your source code, so don't waste time making it obsessively neat.

I think you need to take this in context - results are what the end user will see, for sure.  However, if you are making an engine, that means you are planning on re-using it on more than one project.  That means that your end users will actually be other developers (or yourself if you keep it as a hobby).  In that case, I would highly, highly recommend going through the exercises that you are describing here and consider different aspects and designs that you could implement.

 

This makes you think more about how you are doing things, gives you more and more experience with the language that the engine is written in, and helps you learn more about the API you are using.  These benefits may not be tangible in the end result of a rendered frame, but they will certainly be tangible in your development experience as well as your debugging of issues during development.  So I would agree with Steve that output matters, but disagree that it is the only thing you should focus on!



#6 metsfan   Members   -  Reputation: 654

Like
0Likes
Like

Posted 28 May 2013 - 05:57 PM

think you need to take this in context - results are what the end user will see, for sure. However, if you are making an engine, that means you are planning on re-using it on more than one project. That means that your end users will actually be other developers (or yourself if you keep it as a hobby). In that case, I would highly, highly recommend going through the exercises that you are describing here and consider different aspects and designs that you could implement.

This makes you think more about how you are doing things, gives you more and more experience with the language that the engine is written in, and helps you learn more about the API you are using. These benefits may not be tangible in the end result of a rendered frame, but they will certainly be tangible in your development experience as well as your debugging of issues during development. So I would agree with Steve that output matters, but disagree that it is the only thing you should focus on!


^ This, end result obviously matters, but if you write bad code, it makes it hard to add features to the game/engine, and it also makes it difficult to bring on new developers. Also bad code begets more bad code.

Edited by metsfan, 28 May 2013 - 05:59 PM.


#7 cozzie   Members   -  Reputation: 1550

Like
0Likes
Like

Posted 29 May 2013 - 02:02 PM

@Jason/Metsfan; thanks, I also think that having the right base/ design will help me in adding future functionalities.

In this context, can you share your ideas on my highover design?



#8 Steve_Segreto   Crossbones+   -  Reputation: 1492

Like
0Likes
Like

Posted 30 May 2013 - 03:42 PM

Hey cozzie,

 

I downloaded and tried your engine demo. The render is showing up quite dark for me....

   

http://imageshack.us/scaled/thumb/197/enginetoodark.png



#9 Steve_Segreto   Crossbones+   -  Reputation: 1492

Like
0Likes
Like

Posted 30 May 2013 - 03:44 PM

Well I hate to take the ratings hit, but I think people who give you the opinion to work on your game as an engine don't ship many products.



#10 Jason Z   Crossbones+   -  Reputation: 4859

Like
2Likes
Like

Posted 31 May 2013 - 05:54 PM

Well I hate to take the ratings hit, but I think people who give you the opinion to work on your game as an engine don't ship many products.

 

I won't rate you down, as I think it is productive to discuss counter opinions - so I would also suggest that others don't rate you down either.  To be perfectly honest, I don't work in the games industry, so I haven't shipped any games.  I have however build and delivered many diverse applications that use 3D rendering functionality.  So you are right, I can't speak to game development, but I most certainly can speak to software development that utilizes reusable rendering routines and algorithms (i.e. an engine).

 

So are you implying that you don't have an engine?  You just work on one project, and when its time for another project you just take the existing project and modify it?  What if you find a bug in your rendering routines - do you have to go back and make the same changes to a bunch of different projects?

 

It seems a bit silly to me to make the leap that anyone that tries to properly design a reusable library somehow isn't successful at delivering the end product.  In fact, I would say the opposite - having discipline and considering a design aspect of a library has always driven higher productivity in my experience.  You mileage may vary, but when you have to support many simultaneous and different projects with some common functionality, then I think it only makes sense to consider that common functionality as an engine...



#11 Steve_Segreto   Crossbones+   -  Reputation: 1492

Like
0Likes
Like

Posted 01 June 2013 - 12:41 AM

Well I hate to take the ratings hit, but I think people who give you the opinion to work on your game as an engine don't ship many products.

 

I won't rate you down, as I think it is productive to discuss counter opinions - so I would also suggest that others don't rate you down either.  To be perfectly honest, I don't work in the games industry, so I haven't shipped any games.  I have however build and delivered many diverse applications that use 3D rendering functionality.  So you are right, I can't speak to game development, but I most certainly can speak to software development that utilizes reusable rendering routines and algorithms (i.e. an engine).

 

So are you implying that you don't have an engine?  You just work on one project, and when its time for another project you just take the existing project and modify it?  What if you find a bug in your rendering routines - do you have to go back and make the same changes to a bunch of different projects?

 

It seems a bit silly to me to make the leap that anyone that tries to properly design a reusable library somehow isn't successful at delivering the end product.  In fact, I would say the opposite - having discipline and considering a design aspect of a library has always driven higher productivity in my experience.  You mileage may vary, but when you have to support many simultaneous and different projects with some common functionality, then I think it only makes sense to consider that common functionality as an engine...

 

I also don't work in the games industry, so I personally haven't shipped any games either. My understanding of the engine space is limited to Microsoft platforms, specifically directX. I develop a game in my spare time. I hope to one day make money from the game I develop, but of course I haven't, mainly because I work alone and I don't move quickly enough to capitalize on any markets. :(

 

I've been working on my hobby game for about 5 years, in that time Microsoft (which is where my full-time job is ironically), has changed the directX APIs significantly. I haven't had time to adapt, simply because I'm trying to get my original game finished. I would imagine that a slightly larger team (< 100 people) might actually be able to crank out a shipping game product in less than a years time with a certain degree of quality and make some money from it.

 

My opinion is that if they spent any extra time doing "engine" work they would both lose that slim chance to make money and still not create the re-usability they are after as the industry would have passed them by.

 

My opinion is that larger teams (> 100 people?) could make a living out of developing engines, either as middleware or for a platform with reasonable (3-5 year) longevity. In that case, the investment of time and energy in perfecting a usable engine *might* actually pay off for those larger teams.

 

However, for the hobbyist, I would not recommend wasting any time in crafting an engine or designing for reusability or future use. The hobbyist in my opinion should be obsessively focused on just producing a result and getting it to market (even if its alpha), so they can MAKE MONEY from it :)



#12 cozzie   Members   -  Reputation: 1550

Like
1Likes
Like

Posted 01 June 2013 - 02:26 AM

The dilemma seems clear to me and is something I run into often.
I solve it very pragmatically:

- I work on my engine, keeping and expanding it in a structured way (keeping reusage in the back of my head)
- since it doesn't deliver direct results, when I have a difficult challenge, I make a fairly simple game to get some results and experience in gameplay (not even using the engine :))

The 2nd even helps me indirectly with challenges I face in my engine.
For example, I was stuck with my flexible point light management for weeks, so I made 'Asteroidz' and actually finished it. This gives me new experience on gameplay functions, audio etc.. And luckily yesterday I found the solution for my point light 'challenge', so now I can get into that and improve my engine. Between all this I try to read books and articles which can give me knowledge on both fields.

All from a hobby perspective for now. But from my daily job (not programming) I have quite some project and product management experience, which drives me to doing preparations and in this case makes me want to make a good design of the engine. Combine that with an upcoming 2 week holiday with just an iPad, some ibooks, a paper and pen... Makes me think, lets rethink the design of the engine, highover. What should it be able to do? How to split this in usefull namespaces? Including which classes and inheritances? Etc.

I could actually copy my timer (FPS management/ time delta) class including all functions, 1 to 1 directly to my Asteroidz game, saving me time. This also motivates me to have my engine include independent classes and parts, so I can reuse them anywhere (as far as possible of course). The same goes for my audio namespace/ classes (FMOD wrapper) and (dx)input wrapper.

#13 Steve_Segreto   Crossbones+   -  Reputation: 1492

Like
0Likes
Like

Posted 01 June 2013 - 03:51 AM

Is it a requirement for your engine to be cross-platform? If so, make sure to spend some time on creating platform independent abstractions for rendering and audio (including shaders .... HLSL is platform/render API specific).



#14 cozzie   Members   -  Reputation: 1550

Like
1Likes
Like

Posted 01 June 2013 - 04:16 AM

For directx will do, I'm trying to make my scenegraph, object, lights, scene etc. Classes API independent and have inherited classes to be able to use them for d3d. I think FMOD should be fairly simple if I move to another platform (a few other parameters).
Basically for now all d3d (keeping in mind upgrading to dx11) and where possible having data structures D3D independent

#15 Juliean   GDNet+   -  Reputation: 2364

Like
1Likes
Like

Posted 01 June 2013 - 06:36 AM

However, for the hobbyist, I would not recommend wasting any time in crafting an engine or designing for reusability or future use. The hobbyist in my opinion should be obsessively focused on just producing a result and getting it to market (even if its alpha), so they can MAKE MONEY from it smile.png

 

I think you leave out an important point. See, there is hobbyists like me (well at least there is one), who don't have any skills in making even simply 3d graphics, and (for personal reasons) aren't willing to work in a team in their free time to create a game. What have we left to do? We could eigther write a game using shitty placeholder or ripped graphics, but we still won't be able to "sell" the game. I rather write my own engine, and even if it won't be something practical to make money off of, I at least HAD FUN creating it. Programming, unless you plan on making a living off of, shouldn't be all about the money, should it? How could something be a waste of time if you enjoyed doing it, let alone learned a few things from it?

 

Plus, even if the "industry passes you by" as you design an engine, you still get more reusability than if you just design game for game and only pick out some selected reusable components. Sure, you'll be missing some "state of the art" features, but hell - its better than having to basically start from scratch every time you start a new game. You can still improve your "engine" more easily than if you just built game after game using the "latest technologies". At least IMHO.



#16 Jason Z   Crossbones+   -  Reputation: 4859

Like
1Likes
Like

Posted 01 June 2013 - 07:17 AM

@Steve: I think you are mixing two arguments, and that we are agreeing more than disagreeing.  Your experience is that you started out with one API (I guess D3D9) and now there is D3D11.1 - so your efforts are socked into the D3D9 level of effects.  If you were using a well designed engine, the pain of upgrading to a new API would be significantly decreased.  That is the whole point of an engine, to decouple the game itself from the reusable parts.  On a side note, I don't think there is any need to update in this case, as there are still quite a few D3D9 based games being released...

 

One other point that I wanted to make was regarding hobbyist vs. indie vs. professional (Juliean touched on this too).  If you are working on something as a hobbyist, then by definition you are doing it because you like the topic and want to do it.  If you are trying to create a product and sell it, then you are more like an indie, where you are making more of an investment and want to get monetary returns on it.  And of course, the professional makes their full-time paycheck from working in the area.

 

I have personally been a hobbyist for a very long time, and moved into doing professional work more recently - skipping the indie stage.  It sounds to me like you are more focused on being an indie developer, which takes a totally different perspective than a hobbyist.  The OP is looking for perspectives on hobbyist development, so I still think he should lean towards developing an engine as a learning exercise.  He clearly seems motivated enough to knock out a few games here and there, so it is also clear he is learning from doing.  I say, keep it going and enjoy the ride.

 

If you are having trouble finishing your game, is it because you don't have enough time to put on the project, or something more like feature creep?  Identify what the problem is, and take steps to handle it!  I want to see your game on the (digital perhaps) store shelves!






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