Warfork

Warfork

Not enough ratings
A Guide to Custom Gametype Creation
By Hồ Chí Minh Gaming
All the scripting and tools necessary to make a custom gametype in Warfork
   
Award
Favorite
Favorited
Unfavorite
Introduction
Warfork contains a very powerful system for creating new gametypes without editing the game source. In this guide you will learn the ins and outs of this system and learn how to make your very own custom gametypes!
AngelScript Basics
The basics of AngelScript scripting and general programming are out of the scope of this guide.

Excellent documentation on AngelScript and its features is available from the official AngelScript manual.[www.angelcode.com]
Pk3 Structure
You must include several files in your Pk3 in order to have your custom gametype be loaded.

Note: all paths are relative to the root of the Pk3. foo/bar refers to a file or folder bar contained under a folder foo, which is in the root of the Pk3.

For the following section, replace mygametype with the short name of your gametype. This is also the name that shows up in the server browser.

progs/gametypes/mygametype.gt
The gt file is a semicolon separated file containing the list of AngelScript files to be loaded when your gametype is started. Any script or function you intend on using must be included in this list.

For example, the bomb gametype gt file has the following contents:
/shared/constants.as; /shared/utils.as; /shared/files.as; generic/quickmenu.as; generic/matchstates.as; generic/bots.as; generic/items.as; generic/awards.as; bomb/main.as; bomb/player.as; bomb/bomb.as; bomb/site.as; bomb/round.as; bomb/media.as; bomb/bots.as; legacy/quake1.as;

Most of these scripts are actually commonly loaded in many gametypes. Documentation on these base .as scripts is covered later. These paths are relative to the progs/gametypes folder, but if prefixed with a slash, actually refers to a path under progs/.

Notably, bomb includes bomb/main.as which happens to include many of the game hooks for the bomb gamemode. As we will see later, this is no more than an organizational trick. You are free to name your scripts however you please and put them in whatever folder (under gametypes) you wish.

progs/gametypes/mygametype.gtd
The gtd file is pretty straightforward. It is simply the 'pretty' title of your gamemode, as well as the description.

For example, the bomb gtd has the following contents:
Bomb and Defuse Team game mode where in which players join either the attacking team or the defending team. Each team attempts to complete their mission objective, either planting the bomb or defending the bomb site, or eliminate the opposing team.

The first line of the gtd is the title, followed by a mandatory blank line, and then the description.

Both of these files are necessary in order to have your gametype be loaded.

AngelScript files
The custom AngelScript files you write should be included under progs/gametypes/. To avoid confusion and issues with identical names, it is best practice to put your scripts under a folder named after your gametype, like progs/gametypes/mygametype.
Scripting Preface
Due to the relatively large amount of control available to gametype AngelScripts, there is some non-obvious boilerplate code that must be written for certain features to work properly, such as config, item spawning, and instagib. I recommend not starting from scratch when making a new gametype. Leverage the base implementations available to you and change what you need.

The implementation for the Free For All gamemode can be found under data0_21pure.pak3/progs/gametypes/ffa.as. It's commented quite nicely and contains at least a stub for all of the game hooks. This is a good base to start with.
Scripting Hooks
Hooks are the foundation of custom gametype scripting. Warfork has a list of functions it can call in your gametype to allow you to react to many different events and provide feedback to start or stop certain actions.

A complete list of these functions, along with documentation on what they mean and their parameters, can be found at http://livesow.net/wsw/api/game/gt_script_calls.h. You should also consult the provided implementations to see how gametypes typically react to these events.

Additional information on these functions and the interpretation of GT_ScoreEvent args can be found in the Scripting Reference section.
Scripting Techniques
todo
Scripting Reference
todo
Loading and Playing
When it comes time to play your gametype, you will need to have Warfork load your pk3 and select it as a gametype.

On Windows:
Place your pk3 under
C:\Program Files (x86)/Steam/steamapps/common/fvi/Warfork.app/Contents/Resources/basewf

You can then use your gametype to start a local game, or load it onto a server.
Be sure to keep an eye on the console for script errors!
1 Comments
Bastard 18 Oct, 2023 @ 9:10pm 
ok