- Disconnecting clients is relatively slow.
- Vision command is heavily optimizable
- Do not start before using a profiler first
- We'll do it when everything else is working
- Handle kicking
- Use ~conditional compilation~ to avoid relying on gettimeofday unless it is necessary.
- When using the graphics, both server and clients slows down massively.
- Create more unit tests
- Develop more commands for the TESTER group.
All server actions are blocking unless said otherwise.
take_decision: Override this to create your client behaviour. Called constantly, does not need to be an infinite loop,starter: Override this to create your client behaviour. Called once beforetake_decisionat the start of the game, then never again.on_broadcast_received(msg, direction): Override this. Called when receiving a broadcaston_ritual_started: Override this. Called when a ritual including the player is started.on_ritual_completed(new_level): Override this. Called once a ritual including the player is finished.@levelis updated automatically, no need to do it.broadcast_prefix: String to prepend to broadcasts.initialize(*args): You can override this. Callsuperif you do to call parent constructor.
prendre(item): Attempts to pickupitemat the current position without verification, and updates inventory on success. Returns true/false depending on result.pickup(item): Alias forprendre.pose(item): Attempts to poseitemat the current position without verification, and updates inventory on success. Returns true/false depending on result.incantation: Do an incantation. Returns true if the level changed.ritual: Alias forincantation.voir: Returns the vision string from the server.see: Alias forvoir.broadcast: Sends a broadcast to the server. Prependsbroadcast_prefixbefore each call.inventory: Updates inventory by asking the server about it. Returns nil, the results are stored in@inventory.inventaire: Alias forinventory.do_action(action): Sendactionto server, and blocks while listening. Returns server answer.listen(only_one = false): Blocks while listening to server and returns answer. Only return upon receiving something other than a broadcast, unlessonly_oneistrue.find_item(item): Returns a vector giving the 2D direction towardsitemif found,nilotherwise.move_towards(coordinates): Move towards coordinates. Parameter is relative. Does not guarantee final orientation.gather_item(item): Attempt to look up for and pickup an item. Returns true if successfull, false if failed to pickup or find.
item_name_to_id(item_name): Returns the server ID corresponding to a given item name string.translate_broadcast_to_vector(direction): Returns a vector giving the 2D direction towards to given broadcasttranslate_vision_to_map(index): Returns a vector giving the 2D direction towards a given case from the vision string.available_slots: Returns available slots on the server for the team.quantity_of(item, vision_string): Returns amount of item on the case the client is.get_ritual_cost(level): Returns the cost of rituals in an array. Includes food (index 0) and players (index 7).can_do_ritual(vision_string, level): Returns true/false depending on whether there are enough materials where the player is to do a ritual.convert_vision_string(vision_string): Transforms the vision string in an array of array.dead?: Returns death status.dead: Returns level.
@team_name: The team name as given in parameter@self_id: a randomly generated ID, going from 0 to 100,000. Not guaranteed to be unique, but close enough.@dead: True if there is reason to believe the client is dead. (Such as server saying it so, for example)@inventory: Array containing stones. Server order.@food: Hunger/food. Decreased automatically when callingdo_action.@level: Player level.@socket: Server socket. Be careful with it.
- If you suspect a bug, please write a precise description of it / make a ticket. We don't have enough TODOs.
- You can use manual client with group TESTER to alter the behavior of the game however you want. You need the flag -v on the server for it to work.