Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Functions (Library C)

Jonas Götz edited this page Jan 12, 2024 · 1 revision

Definition Funktionsablauf: ----- Game start -----

  • Socket connection to sever
  • if all clients are connected -> config json to clients
  • set config const var ----- Game loop -----
  • Function game_loop
    • gets called with every server update
  • if new server update while client is still running
    • json data gets cached
      • if new server response && already cached
        • cache gets replaced by new json data
    • after game_loop is finished
      • if cache exists
        • game_loop gets called with cache data
          • clear cache
      • else wait for next server update
  • Breaking async function wartet auf json

--- deprecated ---

  • get_distance(entity1: Entity, entity2: Entity): uint
  • get_ores_in_range(entity: Entity): List
    • get_ores()
    • for each ore
      • is_in_range()?
  • get_units_in_range(entity: Entity): List
    • get_units()
    • for each unit
      • is_in_range()?
  • get_cores_in_range(entity: Entity): List
    • get_cores()
    • for each core
      • is_in_range()?
  • get_closest(list: List): Entity
    • check type of entity
    • get__in_range
    • sort by range
    • give index first entity

  • move_start(enity: Entity, dir: Vec<x, y>): Bool
  • move_to(entity: Entity, pos: Vec<x, y>): Bool
  • move_stop(entity: Entity): Bool

autoattack?

  • attack_start(attacker: Entity, attacked, entity): Bool
  • attack_stop(attacker: Entity): Bool
  • collect(entity: Entity): Bool
  • buy(entity: Entity): Bool

Clone this wiki locally