flyxiv / ffxiv_simbot

1 stars 0 forks source link

Event queue Refactor #10

Closed flyxiv closed 1 month ago

flyxiv commented 1 month ago

To properly simulate this game, we need to change from turn-based design to event-driven design

flyxiv commented 1 month ago

Event Driven Design

-> All skill, player, ticker, status are event producers - When these event entities are used, they produce lists of events tha to the event queue, with the time that each event is scheduled to execute.

The queue is a sorted array that always gets the first(= earliest) happening event in the queue and makes the entity responsible for the queue to handle the event.

The entity produces new events as they handle the current event.

While combat_time < finish_time {
    next_event = event_queue.pop();
    // the event adds new events to the queue as they are executed.
    execute_event(next_event);
}
flyxiv commented 1 month ago

Classify as Player Internal Event and Global Event

Internal Event

Global Event

All the instance/partywise events that affect the combat. Player GCD, Skill usage, Skill Damage Infliction, Tickers, etc.

Screenshot 2024-05-18 at 11 23 34 PM