View previous topic :: View next topic |
Author |
Message |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Fri Jul 30, 2010 9:04 pm Post subject: [Server] numpr_globals |
|
|
Not sure if anyone else has posted this...
To extend a progs to support 64k globals instead of a mere 32k is fairly easy.
step 1:
pr_comp.h
find dstatement_t.
change the 'short a, b, c;' line to 'unsigned short a, b, c;'
Well that the gist of it. However, we broke the jump instructions. Those ones need to remain signed.
step 2:
go into pr_exec.c, find the PR_ExecuteProgram function.
find the OP_IF, OP_IFNOT, and OP_GOTO instructions.
OP_GOTO contains the line 's += st->a - 1;' replace it with 's += (signed short)st->a - 1;'
Add a similar cast to the OP_IF and OP_IFNOT instructions as well.
You can now run mods that require 64k globals.
No other changes are required. _________________ What's a signature?
Last edited by Spike on Sat Jul 31, 2010 1:55 pm; edited 1 time in total |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Sat Jul 31, 2010 1:07 pm Post subject: |
|
|
What an example of a situation where QC benefits from this?
/Weak in the QC department, especially when it comes to stuff like how the memory is used. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Sat Jul 31, 2010 1:44 pm Post subject: |
|
|
large mods benefit from this.
numpr_globals is the hard limit on a prog's size. If you exceed it, things just break. The other limits are hard to exceed.
back with the original qcc, each operation generated a temp.
fred = foo + 5;
basically generates foo+5 in a temp, then stores that temp into fred.
that temp is a 'global', just a hidden one. Okay, the naming is not the best, as globals includes locals, but whatever.
So that basically gives you a limit of 32k maths... Which is pathetic. Truely pathetic.
However...
FrikQCC and FTEQCC both do a decent enough job at optimising away temps. Globals is still the hard limit, however.
One example mod that still suffers despite optimising QCCs is trinca's frogbots mod. It contains a whole lot of hard coded vector coords. Each one of them takes 3 globals.
FTEQCC has special inefficient reworking of vector arguments to avoid using globals/constants, but its not pretty.
More practically though, even with frikqcc, you'll not easily exceed the globals until you start using arrays. With this feature you can make slightly bigger arrays.
Either way its nice to document it.
Useless info:
Hexen2 actually split its gamecode into two separate progs in order to keep below the globals limit.
CustomTF switched to the kkqwsv server and created a new progs format to increase their limit from 32k to 2 billion.
Neither can be compiled without optimisations/workarounds.
So yeah, for large mods, use a better qcc, or use this. :) _________________ What's a signature? |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|