2 #include "../sv_minigames.qh"
4 #include "../cl_minigames.qh"
9 How to create a minigame
10 ========================
12 Create a file for your minigame in this directory and #include it here.
13 (ttt.qc implements tic tac toe and can be used as an example)
14 and add your minigame to REGISTERED_MINIGAMES (see below)
20 int minigame_event_<id>(entity minigame, string event, ...count)
21 see ../minigames.qh for a detailed explanation
23 void minigame_hud_board_<id>(vector pos, vector mySize)
24 draws the main game board inside the rectangle defined by pos and mySize
25 (That rectangle is expressed in window coordinates)
26 void minigame_hud_status_<id>(vector pos, vector mySize)
27 draws the game status panel inside the rectangle defined by pos and mySize
28 (That rectangle is expressed in window coordinates)
29 This panel shows eg scores, captured pieces and so on
30 int minigame_event_<id>(entity minigame, string event, ...count)
31 see ../minigames.qh for a detailed explanation
36 You can link entities without having to worry about them if their classname
37 has been defined in MINIGAME_SIMPLELINKED_ENTITIES (see below)
38 Such entities can be spawned with msle_spawn and the system
39 will handle networking and cleanup automatically.
40 You'll still need to set .SendFlags according to what you specified in FIELD
41 in order for them to be sent, ../minigames.qh defines some constants to be
42 used as send flags for minigame entities:
45 Used when creating a new object, you can use this to define fields that don't change
47 A miscellaneous update, can be safely used if the entity has just a few fields
49 Starting value for custom flags, since there are bit-wise flags,
50 the following values shall be MINIG_SF_CUSTOM*2, MINIG_SF_CUSTOM*4 and MINIG_SF_CUSTOM*8.
52 Maximum flag value that will be networked
54 Mask matching all possible flags
56 Note: As of now, flags are sent as a single byte
58 Even for non-networked entities, the system provides a system to remove
59 automatically unneeded entities when the minigame is over, the requirement is
60 that .owner is set to the minigame session entity and .minigame_autoclean is true.
69 * id (QuakeC symbol) Game identifier, used to find the functions explained above
70 * "Name"(String) Human readable name for the game, shown in the UI
72 #define REGISTERED_MINIGAMES \
73 MINIGAME(nmm, "Nine Men's Morris") \
74 MINIGAME(ttt, "Tic Tac Toe") \
78 * Set up automatic entity read/write functionality
79 * To ensure that everything is handled automatically, spawn on the server using msle_spawn
81 * MSLE(classname,Field...) \
82 * classname: Identifier used to recognize the type of the entity
83 * (must be set as .classname on the sent entities)
84 * Field... : List of FIELD calls
85 * FIELD(sendflags, Type, field)
86 * sendflags: Send flags that signal when this field has to be sent
87 * Type : Type of the entity field. Used to determine WriteX/ReadX functions.
88 * Follows a list of accepted values
95 * String Note: strzoned on client
96 * Float Note: implemented as Write/Read Coord
97 * Vector Note: implemented as Write/Read Coord on _x _y _z
98 * Vector2D Note: implemented as Write/Read Coord on _x _y
100 * classname and netname are always sent
101 * MSLE stands for Minigame Simple Linked Entity
103 #define MINIGAME_SIMPLELINKED_ENTITIES \
104 MSLE(minigame_board_piece,FIELD(MINIG_SF_CREATE,Byte,team) FIELD(MINIG_SF_UPDATE, Short, minigame_flags) FIELD(MINIG_SF_UPDATE, Vector2D,origin)) \