.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...

Forum Thread
  Posts  
Test cases and operating code: vectors (Groups : qc : Forum : hard_code() : Test cases and operating code: vectors) Locked
Thread Options
numbersix
numbersix quake-c coder++
Nov 29 2016 Anchor

In: Moddb.com , I made a test set for every conditional case; float, string, vector and void.

--- logic tests - vector: ' 0.0 0.0 0.0' if (v) false if (! v) true if (v != '0 0 0') false if (v == '0 0 0') true
--- logic tests - vector: ' 7.0 0.0 7.0' if (v) true if (! v) false if (v != '0 0 0') true if (v == '0 0 0') false

I wanted to see how logic evaluates for various forms of (conditional) logic statements.

Thus - if (logic == 0) then {do stuff}; vs. if (!logic) then {do stuff};

I see this as mainly an aesthetic choice. Some few compsci professors would likely disagree.

(logic == 0) clearly shows logic to be numeric and tested against 0. (!logic) is less clear.

I know for certain that how you write quake-c affects to size of progs.dat.

	if (self.angles) // != '0 0 0')
		SetMovedir ();

//	Writing progs.dat
//	778804 TOTAL SIZE

vs.

	if (self.angles != '0 0 0')
		SetMovedir ();

//	Writing progs.dat
//	778812 TOTAL SIZE

To put this in perspective; if a mod has a dozen lines of code, or adding experimental /

debug / warning code this likely has little impact. A few bytes here and there wont matter.

This case saves 8 bytes. Even if there are 1024 of those, 8K is not a big deal now. My system has 16G mem.

Still, when you have thousands of lines of code in a major mod that is for all practical reasons

an entirely new game - progs.dat bloat is a consideration.

Also, not every system is a high end gaming pc. Some people have older hardware.

Portable players, raspberry pi, and other mini systems are also a possibility.

And when you are trying to do this: Moddb.com

Todays systems can easily handle a map with 500 entities that would crash the 4Mb pentium 100 system

quake was designed for. But, what about 5000 entities? Or even 15000.


I was doing some testing and discovered trigger_push fails!

What? It works on the Archon MkII code with darkplaces. Surely it cant be the engine? No.

It turns out that while that logic test I referenced says the two cases I show are equivalent,

operating code says otherwise.

"if (self.angles)" does NOT operate the same as "if (self.angles != '0 0 0')"

So far this only seems to be the case for the '0 0 0' vector negative test.

Take note of this if you have made my code aesthetic a focus.

Later, after some up coming releases, I might do further testing on this case.

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.