Jump to content

  • Log In with Google      Sign In   
  • Create Account


CDProp

Member Since 07 Mar 2007
Offline Last Active Yesterday, 04:27 PM
-----

Posts I've Made

In Topic: OpenGL Camera Concept

16 June 2014 - 10:17 AM

I don't know of any tutorials, but basically all you need to do is give your camera a transform matrix just like any other object in your world. When it comes time to render the scene, invert the Camera's matrix to get the view matrix. At the end of the day, your verts need to be in camera-relative space before doing the projection transformation. So, this last step of inverting the camera matrix to get the view matrix, and then multiplying your world-space verts with this view matrix, cannot be avoided. However, at least with this method, you can think in terms of the camera's position until the very end.


In Topic: Just a couple of Data-Oriented Design questions.

16 June 2014 - 08:13 AM

I'm not trying to use it for every piece of code. I'm trying to use it to speed up entity/component updates. I must say, what I'm asking seems like a totally reasonable request. That is, help me understand how data-oriented design is used in games. So far, I've gotten some good replies along with at least two lectures about how I shouldn't be using data-oriented design like a golden hammer. Is that what I'm doing? Because most of the reading I've done on the subject uses this sort of entity-component update as an example of precisely where DOD comes in handy. Is there some way in which I'm misapplying the concept? If so, it would most helpful if you would be explicit about it.

In Topic: Just a couple of Data-Oriented Design questions.

16 June 2014 - 12:12 AM

Thanks very much for your help! Now that you mention it, I think this plan I'm referring-to will work pretty well with my project, because I'm going to have relatively few entity types, but dozens or hundreds of each. In a project where there are hundreds of entity types, and perhaps only a few of each, and perhaps even entities that dynamically change their composition, then this plan probably wouldn't work that well.

 

Then again, for an Asteroids clone, anything approaching a data-driven, data-oriented, component-entity system is hugely overkill. :P

 

But, it's good to have a small project to practice a new concept on.


In Topic: Just a couple of Data-Oriented Design questions.

15 June 2014 - 11:59 PM

 

However, ignoring for the moment the problem of the dynamic cast, my understanding is that this is not done in a Data-Oriented way


Who cares? Use tools when you need them and don't try to slavishly apply them to every situation.

Even if you do want to write every last bit of your code using data-oriented design... that term doesn't say that you have to avoid every single cache miss ever no matter what. It just says that you should think about your data and how it's accessed when designing your architecture. If you've done that and haven't identified a verifiable issue that needs addressing, have a beer and move on to a real problem that needs your time and attention. smile.png

 

 

Point taken, definitely. A lot times I don't feel that I understand a concept unless I've implemented it, though. So the point of this exercise is "Understand Data-Oriented Design". Once I've done that, I'll feel ready to make decisions about where DOD makes sense.


In Topic: Just a couple of Data-Oriented Design questions.

15 June 2014 - 11:57 PM


Regarding your proposed solution of having the physics/transform components for objects of a certain type stored together... with the way you've described it so far, I have trouble immediately seeing how it would fit into everything cleanly

 

Yeah, one thing I don't really like about it is that I have these classes called Asteroids, BlackHoles, etc. I would prefer to just have an Entity class. No EntityBase, no hierarchy. All game objects are Entities, and how the Entity behaves, renders, etc., is fully defined by which Components it takes on. I think it wouldn't be too difficult, though, to generalize this idea a bit so that it has the best of both worlds. Maybe I could define something called an EntityType. It would have a list of ComponentBehaviors (like DriftPhysics) that would each update in a certain order. As above, an EntityType instance would contain arrays of data, where the ith element from each array corresponds to the ith Entity of that type. I would need a factory that could read in an EntityType specification, instantiate the arrays, instantiate the behaviors, and then bind the arrays to the behaviors. At that point, adding new Entity instances is simply a matter of pushing new data onto the arrays. For entity deletion, I could do something similar to the swap-delete thing in the Insomniac presentation you linked to (although I suppose this version of it would not be much different than erase-remove).

 

I should probably read that Insomniac presentation more in-depth, though (and other stuff as well) just to make sure I'm not going down a bad road here.


PARTNERS