catpad (catpad) wrote in fipl,
catpad
catpad
fipl

AOS Runtime specification

Вот моя попытка формализовать порядок выполнения команд и разрешения конфликтов. Комментарии и возражения приветствуются !



Definitions


  • Game cycle: basic turn in the game process including command execution, and event triggering.
  • Command quantum: simultaneous execution of all pending commands of the same type of all objects. For example: execute all current "attack" commands that must be executed on this game cycle.
  • Command quantum order: well-defined order of command quantums within one game cycle. Command quantum order is object-friendly: all objects that can escape attack should escape it, all objects that can receive mana should receive it, etc.
  • Task: block of several commands grouped by the same goal. These commands are always grouped by {}.
  • Current task: the task that is not yet accomplished, that is not all of its commands are executed.
  • Task stack: each object has its own task stack. Interrupted tasks will be placed on stack for further execution. Current task is on the top of the stack.
  • Current command: the command that is assigned to the immediate execution on the next game cycle. Note, that several commands (such as MOVE and GOTO) may require more than one cycle for accomplishment. Current command always belongs to the current task.


Command quantum order


  1. PUMP: those who need energy will receive it.
  2. RADAR: objects who move at this cycle will be catched by this radar.
  3. MOVE, GOTO: those who can escape attack will escape it.
  4. SHIELD: those who can prevent attack will prevent it.
  5. ATTACK: "if you have to shoot, shoot don't talk".
  6. SEND, BROADCAST: if you still alive to send a message, send it.
  7. TURN: if you still alive to turn, do it.
  8. TIMER: if you still alive to set a timer, set it.
  9. CREATE: those agents created in this cycle will not be involved in any activity.


Command quantum execution


  1. Check mana of the command initiator objects.
  2. Stop objects whose mana is not enough to perform the command. Switch them to "idle" mode.
  3. Execute all pending commands of this type.
  4. Decrease mana of the command initiator objects.
  5. Update mana of recepient objects (according to the nature of command).
  6. Mark killed objects.
  7. Gather triggered events.

Notes:
- command quantums are executed in the order mentioned above.
- within one command quantum all commands are performed independently of one another. That means no command can influence another command of the same type. For example, if two objects attack one another, their mana will be decreased after the attacks are performed.

Game cycle execution


  1. Collect mana of idle objects.
  2. Execute all command quantums according to command quantum order (see above) using the current commands of all the objects.
  3. Deliver triggered events.
  4. Determine what event handlers should be called for each object.
  5. Save current tasks where interrupted on task stacks.
  6. Assign new current tasks and next commands of all objects.
  7. Clear killed objects.
  8. Display current situation.


Rules of event handler determination for a given object


  • Find the first event handler by its order of definition in the body of object's class.
  • If there are several events of the same type: choose events initiated by enemies.
  • If there are several events of the same type initiated by enemies choose those initiated by stronger objects. Next step - undefined (choose random event).
  • If there are no events initiated by enemies, do the same for events initiated by allies.
Subscribe

  • Клич

    Ну, кто ещё хочет принять участие в проекте века The Age of Smalltalk ? Это будет Великая Игра, верьте мне ! Это будет Веха. Работы начинаются...

  • О серьёзности-несерьёзности

    Слово в защиту "серьёзного отношения к AOS". Тут все поспешили высказаться о своём несерьёзном отношении к AOS. А я вот хочу сказать о своём…

  • Язык AOS

    Согласен, что правила разработаны недостаточно. Хочу защитить язык. Я считаю, что язык надо заморозить. Продолжаю выступать за то, что язык игры…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 16 comments

  • Клич

    Ну, кто ещё хочет принять участие в проекте века The Age of Smalltalk ? Это будет Великая Игра, верьте мне ! Это будет Веха. Работы начинаются...

  • О серьёзности-несерьёзности

    Слово в защиту "серьёзного отношения к AOS". Тут все поспешили высказаться о своём несерьёзном отношении к AOS. А я вот хочу сказать о своём…

  • Язык AOS

    Согласен, что правила разработаны недостаточно. Хочу защитить язык. Я считаю, что язык надо заморозить. Продолжаю выступать за то, что язык игры…