Skip to content

Multiplayer Bot Features (aka AddPlayer)

Claire Ellis requested to merge addplayer into next

srb20001

  • Establishes constants and types for player->bot: 0 BOT_NONE, 1 BOT_2PAI, 2 BOT_2PHUMAN, 3 BOT_MPAI. 0-2 function the same as always, while 3 serves as an alternative bot type with full player functionality.
  • Adds the lua function G_AddPlayer(*skin, *color, *name, *bot), which adds an unmanned player instance to the game. Built off of code started by Tatsuru.
  • Adds the lua function G_RemovePlayer(*playernum). Despite the name, this is currently set up to only kick players that do not have bot type BOT_NONE.
  • MPAI bots will respond to the BotTiccmd hook.
  • Bots has been reworked to allow support for multiple AI per game, in both online and offline environments.
  • player.blocked has been created and is read+writable to lua. It tracks whether movement was blocked during the last input frame.
  • player.lastbuttons has been created and is read+writable to lua. It stores the player's cmd button inputs from last frame.
  • player.botleader has been created and is read+writable to lua. By default, AI will follow this player, and 2P AI will respawn to them.
  • Various other minor tweaks

Notes:

  • MPAI bot types have their own lives and checkpoint status, and will not respawn to a botleader when far away. They can receive game overs in single player, but they will respawn with three lives during the next level load sequence and will not consume continues.
  • For general gameplay purposes, it is recommended that only BOT_2PAI and BOT_MPAI types are spawned. BOT_2PHUMAN bots spawned through G_AddPlayer() will be instantly reset to BOT_2PAI. G_AddPlayer() allows for the creation of BOT_NONE types, but this is strictly as a developer tool to modders; keep in mind that BOT_NONE players cannot be removed with the G_RemovePlayer function.
  • player->botmem has been created as an internal struct for storing AI variables through netcode. However, the struct is potentially subject to change in a future update, and as such has not been made available through the lua framework.
  • This branch makes the default co-operative Tails AI compatible in multiplayer environments, but no new AI logic has been added for other gametypes or characters. Modders are encouraged to use the BotTiccmd hook to overwrite the default bot behavior with their own scripts.

Example addplayer.wad addbot <bot type> - Adds a bot player instance to the game. kickbot <playernum> - Removes a bot player from the game. getbots - Outputs player bot-related variable information in the console.

Edited by Claire Ellis

Merge request reports