I am just sitting here thinking about how to handle various actions that an object can perform and how those actions will affect the object, as well deal with sound.
A thought did occur to me that perhaps a good way would be to have a bunch of action objects, and each of those would in turn have its own sound, graphic and other stuff.
This means that we would in essence be free to choose which actions an object can perform, and simply change to a different action library if we wanted to use a different type of engine for the game.
For example, a text action library might perform actions by returning or printing text, while a 2D action library might use sprites and sounds for different actions.
Now, the trick is to decide how far the actions extend and what kind of default actions each object normally has anyway. Also, where exactly the actions will live, in C++ or in Python?
I will attempt to discuss this topic now.
Now Playing: Gamma Ray - Voice In My Head
Read more…
I think I got the whole sound thing under control.
I am using OpenAL to play sounds, which means sounds can have vectors to specify velocity and position. This isnt too imporant really since I will probably add the ability to turn off environmental audio. The point is, sounds are now ordinary objects just like you and me. They are labeled not solid so they can never collide with anything, and in order for me to deal with them properly, they are added as children to whatever object produces them.
The only problem I believe I currently have is that the sound objects do not die when the sound is finished, which is not a very nice way to deal with memory
However I am working on that, now that I have dealt with hierarchies. The cool thing about hierarchies is that I can now easily create formations of enemy ships!
I also implemented that thing I talked about in my previous post. There is a method called obeyParent(), which can be overridden by any class inheriting from object, and this method basically takes whatever data the current objects needs to inherit from its father and applies it to itself.
So for a torpedo, this is nothing, and thus the method is empty. The ship uses the default, which is to apply the fathers velocity to the childs position. For the sound, I have not figured it out to 100% yet, but one of the aspects is to set the sounds position to that of its father. I believe i might need to mess with some other stuff because the sound is still not perfect when you move around.
In any case, now its time for bed.