#1 Members - Reputation: 111
Posted 05 March 2013 - 08:11 AM
Earlier I used to have two arrays: one for storing times of actions, another for strings "action_number|argument0|argument1|...|". So, when time for Nth action has come, Nth string from second array splits into a temporary array with arguments and corresponding function for this action is called.
If you're aware of a more efficient way to organize actions, please respond. Preferred languages are C# and AS.
#2 Members - Reputation: 243
Posted 05 March 2013 - 12:51 PM
Why not make an event structure like following:
public struct Event_t
{
char eventType;//Byte alignment error, for more memory efficient storage, should this byte be the last element of the struct!
int eventDuration;
short eventSize;
}
Event duration is the time from this event to next event. The event duration can be zero, which means that the event would be processed simultaneously with the next event. The event size are the number of bytes of the event(can be discarded if the size of the types of events are static). From here you can make different Event types. For example:
public struct EventMessage_t
{
int nMessageLength;
string szMessage;
}
After you have loaded the level. You can derive the event structs from a base event struct. Then you can make an array of base event structs, which you can easily process, by casting the base struct to the right event type structure.
Edited by Tapped, 05 March 2013 - 12:58 PM.






