Welcome!
This repository contains the source code and resources for implementing a TDM game mode in your game project.
Whether you're building a multiplayer game, experimenting with game mechanics, or enhancing an existing project, this TDM game mode provides a starting point to get you started.
- client.lua: Handles drawing on the client as well as team selection.
- server.lua: Handles most of the TDM logic.
- shared.lua: Has some structs (and lua tables) and a single function that is shared by the server and the client. Documentation about the
shared_scriptdirective can be found here.
For the server logic and teams 'classes' are used, Lua supports such in the form of metatables under chapter 16.1.
Classes used in this game-mode are detailed down below:
- TDMGame: The main class used to interact with teams, its
constructor(to initialize teams) and aTDMGame:shutDownmethod that is used to 'dispose' of any team instances onceonResourceStopgets called. - Team: An instance of
Teamstores the base position and each team color, teams (referred byTDMGameasself.teams) are Blue, Red and Spectator (where Spectator is simply a placeholder at the moment).
This game mode utilizes the following FiveM features:
- State Bags: To keep track of any entity states between client and server.