]> de.git.xonotic.org Git - voretournament/voretournament.git/blob - misc/mediasource/extra/fteqcc-src/readme.txt
fteqcc source
[voretournament/voretournament.git] / misc / mediasource / extra / fteqcc-src / readme.txt
1 Readme for the FTE QCLib
2
3 This library is a library for running QuakeC gamecode. It does not provide any builtins itself.
4
5 Features:
6         * Multiple library instances, enabling server qc, client qc, and menu qc. There is no maximum instance limit other than memory.
7
8         * Addons, for running multiple progs in any individual instance.
9
10         * Field reassignment, allowing a single engine to support multiple subtly different QC APIs. Also makes additional fields easier.
11
12         * Step-by-step debugging. Requires a text editor of some form, however. A printout of the current line is also useful of course.
13
14         * 64bit support. All strings, globals, and fields are allocated in a consecutive addressable section of memory. This also allows pointers and secure access (not implemented yet, but should be relativly easy bar builtins, which are your responsability).
15
16         * Multiple 'threads'. The library allows a builtin to make a duplicate of the current execution state, or to wipe the current state. This allows sleep commands and fork commands. How handy.
17
18         * Integrated QC compiler. FTEQCC comes as part of qclib. By setting up an interface with a specific value, you can cause it to always run, or run only if it detects a source change.
19
20         * Support for different sorts of progs. Namly Hexen2's, kkqwsv's bigprogs, and FTE's extended format with extra opcodes and possibly fully 32bit offsets. The use of kkqwsv's progs is not recommended - this might be removed at some point.
21
22
23
24
25 Quirks:
26         * don't use multiple instances of fteqcc at the same time. Compilation will fail.
27         * 64bit support requires all strings to be allocated by qclib itself, achivable via a method call. Compatability requires a certain ammount of caution.
28         * a fair number of methods are obsolete.
29         * An overuse of pointers in the API. There are some macros which you can use to hide some of the dereferences.
30         * kkqwsv progs are not reliable. Do not try saving the game. Avoid letting your users know of support.
31         
32         * Builtin structures are different from original quake. You'll need to convert the arguments to qclib style. This change was required for both multiple instances as well as addon support. It should be straightforward enough.
33         * Entity fields are accessed via a pointer from the edict_t structure. This was required to place entity fields within the 64bit accessable section. Changing a . to a -> is not a major issue though. However, there are a lot. do a find and replace of ->v. to ->v->
34         * FTE's entities are numbers not pointers. This fact is not made into a big feature as it's kinda incompatable with standard quake. Please do not use numbers directly to refer to ents but instead use the EDICT_TO_PROGS macro which will give protection. This is consistant with standard quake.
35
36
37 Basic usage:
38         * refer to test.c for a sample on how to set up the library.
39         * refer to progslib.h for the things that I've forgotten to mention.
40         * Call the InitProgs function to get a handle to the instance. It takes a parameter which should be set up with some fields. You'll require ReadFile, FileSize, Abort and printf for basic execution.
41         * Call the configure function to say how much memory to use, and how many progs/addons to support.
42         * Load your progs via LoadProgs. Use a crc of 0 to use any. Otherwise progs will be rejected if it doesn't match. Give it a list of progs-specific builtins too. :)
43         * Before calling the spawn builtin, call the InitEnts method. It's parameter stating how many maximum entities to spawn. Using a really large quantity is not much of an issue, as they are allocated as required.
44         * Before calling InitEnts, you can tell the VM which fields your engine uses (state all basic ones or none). This will place the entity fields in the same order as your engine expects for entvars_t.
45         * Obtain pointers to globals, or just use the globals structure directly.
46         * Call the ExecuteProgram method to start execution.
47         * Call the FindFunction method to find a function to run in the first place.
48         * Call the 'globals' method to retrieve a pointer to the globals (you should always use PR_CURRENT here). Set the parameters with the G_INT/G_FLOAT macros and friends. Use OFS_PARM0 - OFS_PARM7 to set params before calling or read inside a builtin. Use OFS_RETURN to read the return value. These macros are hard coded to use a 'pr_globals' symbol, so avoid renaming builtin parameter names.
49         * Ask me on IRC when it all starts keeling over.
50         * These are the C files that form qclib: pr_edict.c pr_exec.c pr_multi.c initlib.c qcc_pr_comp.c qcc_pr_lex.c qccmain.c qcc_cmdlib.c comprout.c hash.c qcd_main.c qcdecomp.c