Hi Mike and David,
First of all. Excellent book! Absolutely love it!![:D](https://www.mcshaffry.com/GameCode/wcf/images/smilies/biggrin.png)
Moving on. I've been working on a project for my OpenGL graphics unit at uni where I have to write a simple renderer. I've so far managed to create a simple engine/renderer by adapting some of the systems described in the book (more specifically: scene graph, actor system and the event system) and retrofitted them into my needs. With that, I have a few questions/issues that I'd like some help with:
# Event system.
- I've managed to build a modified version of the event management system replacing the FastDelegate library with C++11's std::function. Is this a logical/wise choice?
- Interestingly, std::function is not comparable with each other (found that out the hard way :P). I've changed the event manager so that every listener must now provide an unique ActorID id. Internally, the EventManager now maintains a std::map<EventType, std::map<ActorID, EventDelegate>>. In an abstract sense, every listeners are now just Actors. Double registration is now checked via checking the existence of the provided ActorID and RemoveListener is now done by giving it the ActorID and EventType instead of the delegate. Any comments or suggestions on this change?
- The end of chapter 6 briefly described and proposed the use of Events for communication between Actor components (EDIT: within the same Actor). Chapter 11 went on to describe an engine/system wide Event system, but never came back to the proposition in chapter 6. Letting all the Actors and their components to use and register to the system EventManger seem like quite a performance overhead. Imagine there are a thousand Actors each have their AI components listen to a specific event that's suppose to come from another component that's owned by their respective owners/Actor. Actor A's input component queues an Event that all ai components listens for. When the EventManager updates, all AI components will receive that same event, with the majority having to do a check and discard it except one. The check and discard will happen 999 times every time an event with the same type is queued and sent. What is a generally good approach for implementing an event system for Actor and it's components?
# ActorID and SceneNodes
- Each SceneNode contains an ActorID to it's owner. That's all good and dandy. But what about Actor's with a bunch of SceneNodes that are all in a tree with a root SceneNode. Do they all have the same ActorID? This obviously cannot happen as the Scene class uses a map to hold all the SceneNodes. But then how does each SceneNode know which Actor they belong to? Should I use a multi-map?
I think like I've missed out some thing very trivial.
# Rendering
- In the book, the draw calls are placed inside the object's themselves. Such as the Mesh class with it's VRender() method. At the moment I've placed my glDraw* calls inside a Renderer class. What do game engines usually do. Do they place the draw calls in the drawable objects or a Renderer class? I am only drawing simple meshes at the moment with simple shader lights. But what would be the proper way to write the render pipeline when I move on to more advanced rendering techniques such as deferred lighting, deferred rendering etc?
I feel very restricted when writing the rendering stuff at the moment because I fear that I might be doing it wrong and would have to re-invest time to rewrite the rendering system in the future.
That's all for now. I've enjoyed the book very much so far. I've learnt so much for it. The best part of all is that the book has opened this door into all sorts of different fields that I can dig into. Any comments, suggestions and help with my questions above will be much appreciated!
Ben
First of all. Excellent book! Absolutely love it!
![:D](https://www.mcshaffry.com/GameCode/wcf/images/smilies/biggrin.png)
Moving on. I've been working on a project for my OpenGL graphics unit at uni where I have to write a simple renderer. I've so far managed to create a simple engine/renderer by adapting some of the systems described in the book (more specifically: scene graph, actor system and the event system) and retrofitted them into my needs. With that, I have a few questions/issues that I'd like some help with:
# Event system.
- I've managed to build a modified version of the event management system replacing the FastDelegate library with C++11's std::function. Is this a logical/wise choice?
- Interestingly, std::function is not comparable with each other (found that out the hard way :P). I've changed the event manager so that every listener must now provide an unique ActorID id. Internally, the EventManager now maintains a std::map<EventType, std::map<ActorID, EventDelegate>>. In an abstract sense, every listeners are now just Actors. Double registration is now checked via checking the existence of the provided ActorID and RemoveListener is now done by giving it the ActorID and EventType instead of the delegate. Any comments or suggestions on this change?
- The end of chapter 6 briefly described and proposed the use of Events for communication between Actor components (EDIT: within the same Actor). Chapter 11 went on to describe an engine/system wide Event system, but never came back to the proposition in chapter 6. Letting all the Actors and their components to use and register to the system EventManger seem like quite a performance overhead. Imagine there are a thousand Actors each have their AI components listen to a specific event that's suppose to come from another component that's owned by their respective owners/Actor. Actor A's input component queues an Event that all ai components listens for. When the EventManager updates, all AI components will receive that same event, with the majority having to do a check and discard it except one. The check and discard will happen 999 times every time an event with the same type is queued and sent. What is a generally good approach for implementing an event system for Actor and it's components?
# ActorID and SceneNodes
- Each SceneNode contains an ActorID to it's owner. That's all good and dandy. But what about Actor's with a bunch of SceneNodes that are all in a tree with a root SceneNode. Do they all have the same ActorID? This obviously cannot happen as the Scene class uses a map to hold all the SceneNodes. But then how does each SceneNode know which Actor they belong to? Should I use a multi-map?
![:S](https://www.mcshaffry.com/GameCode/wcf/images/smilies/wacko.png)
# Rendering
- In the book, the draw calls are placed inside the object's themselves. Such as the Mesh class with it's VRender() method. At the moment I've placed my glDraw* calls inside a Renderer class. What do game engines usually do. Do they place the draw calls in the drawable objects or a Renderer class? I am only drawing simple meshes at the moment with simple shader lights. But what would be the proper way to write the render pipeline when I move on to more advanced rendering techniques such as deferred lighting, deferred rendering etc?
I feel very restricted when writing the rendering stuff at the moment because I fear that I might be doing it wrong and would have to re-invest time to rewrite the rendering system in the future.
That's all for now. I've enjoyed the book very much so far. I've learnt so much for it. The best part of all is that the book has opened this door into all sorts of different fields that I can dig into. Any comments, suggestions and help with my questions above will be much appreciated!
Ben
BenH
The post was edited 1 time, last by boxy ().