0.051 Source Available
The source to 0.051 is available on the download page:
http://www.pocketmatrix.com/pocketquake/download.htmlCarpediem, if you have to make MIPS specific mods to correct any Casio issues, please note them so we can recombine the source. I already have 0.06 modifications going. Thanks!
Dan East
Last modification: Dan East - 03/14/01 at 08:42:33
Well pocketquake now runs in landscape, there's a minor issue to resolve yet, and that is that the darn taskbar still remains visible, but that should be easy enough to fix.
I'll post the sourcecode in a while. BTW, could you map the esc key in some corner of the screen in the next release?, because we use all the buttons on the device and can't afford to waste one on the esc key, so i can see that landscape mode works but can't get out of the video conf. screen
Carp:
Fix the ESC yourself

Bind one of the AUX keys to "togglemenu"
AUX10 - AUX15 are all onscreen buttons when in Landscape.
In my BOTConfig (soon to be released) I have assigned AUX3 to vid_mode 1, and AUX14 to vid_mode 0. This way, I can switch back and forth without need for the menu screen.
I didn't know the buttons were still there.
There are several virtual buttons mapped around the outside of the screen of landscape. I need to post a diagram showing where they are...
Dan East
I use the hell out of my configs, too. I switch buttons and configs about every hour to see which works best.
The esc key needs to be hardcoded though, in case someone accidently uses an "unbindall" command and kills the console (and everything else that was bound).
here's what i had to change dan:
void VID_Update (vrect_t *rects)
{
//Dan East:
//Here is where we lookup each quake pixel in the palette and blit it to the output.
#ifndef _X86_
//This is the Game API specific code
register unsigned short *cdst;
register byte *csrc, *rowEnd;//, *colEnd;
register int xPitch2=xPitch, nextRow2=nextRow, nextSrcRow2=nextSrcRow;
if (!pScreenBuf)
if (!VID_GetScreenBuf(0)) return;
cdst=pDrawStart;
csrc=vid.buffer;
if(vid_modenum != 0)
{
while (csrc<colEnd)
{
//Calculate the ending row pixel
rowEnd=csrc+320;
while (csrc<rowEnd)
{
//The next line is what actually sets the color value of the display pixel
*cdst=(short)vid_curpal[*csrc];
//Increment our source and display buffer pointers one pixel to the right
cdst+=xPitch2;
csrc++;
}
//Move down to the next row and all the way to the left
cdst+=nextRow2;
csrc+=nextSrcRow2;
}
}
else
{
while (csrc<colEnd)
{
//Calculate the ending row pixel
rowEnd=csrc+240;
while (csrc<rowEnd)
{
//The next line is what actually sets the color value of the display pixel
*cdst=(short)vid_curpal[*csrc];
//Increment our source and display buffer pointers one pixel to the right
cdst+=xPitch2;
csrc++;
}
//Move down to the next row and all the way to the left
cdst+=nextRow2;
csrc+=nextSrcRow2;
}
}
VID_ReleaseScreenBuf();
Also some minor changes to use the esc key in landscape.
It runs great at 7.9 fps with 999 config and particles at 200
Last modification: CARPEDIEM - 03/14/01 at 15:09:19
There are huge graphical glitches on this version, i don't think we should release it yet. i'll send 999 some pics so that he can post them on this thread.

Last modification: 999 - 03/14/01 at 16:04:42
Carpediem, you identified a major bug in the GAPI blit routine. The only reason that it worked on the iPaq is because the screen is oriented sideways, so if you run off the edge of the screen in landscape you wrap back around. Other devices crashed in this circumstance. I corrected the problem, while keeping all the logic precalculated in the VID_GetScreenBuf function. That way VID_Update has no mode-specific logic. I've uploaded the new source.
Note to anyone who downloaded PocketQuake0051_src.zip before 03-14-01 7:00PM EST: Redownload the source as it fixes a bug with the landscape mode.
Exactly what type of visual defects are you seeing? Which map, etc? This version works perfectly on the iPaq and emulator, with the only visual problem being the lack of perspective correction from Jacco's first optimization.
Dan East
Have you made any other modifications to the source besides those you posted in this thread? I just wondered because you did benchmarks, etc, and didn't notice the rendering problems at that time. Does anything seem to trigger them, or is it that way from the start?
Dan East
The first screenshot shows two rooms, the second one is what you see when you enter one.
that's just an example, i would say that about 40% of the levels are that way.
Last modification: CARPEDIEM - 03/14/01 at 16:18:55
Ummm.... Well, i think fixing this is going to be pretty hard. It works perfectly and somehow, for some reason, when you enter a specific room the "vertices" seem go crazy, but just the scenery.
You guys are my heroes, I'll be following this thread all night at work. I hope there's a MIPS release night!
Well, you won't be getting it from me.
:)
Well why not Carpe? Oh, everybody wear black tomorrow (3/15). It's the Ides of March, and like Pliny said- Beware Greeks bearing Ides! ~~~~~
Well... i don't know what's wrong but you can't get past the first level because on one area the map gets all messy and you can't see your way.
It really fast though!, i get 7.9 fps on the time demoo!!
So you get to a point, physically in the level, where a threshold is crossed and the rendering is distorted. Then if you go back to where you had already been, which previously rendered correctly, you still see the corruption. Is that right? If so, is it always triggered at the exact same place? Can you identify any object / effect that may be triggering it (like a weapon model, door, moving platform, etc)?
Dan East
Umm... Nope
It's like you KNOW the room is screwed up, you can see the entrance screwed, like in the screen shot, you get close the room and still see distortion, but just in that room, and when you enter it you see distortion everywhere.
If you somehow find your way out of the room everything get's back to normal.
Imagine the first screenshot, when you walk towards one of the doors you see that distortion getting bigger (but it's a stable distortion, it always remains the same, it doesn't move) then when you enter the area you can't see anything else other than distortion.
Okay, I'll think about this one tonight. Moose - is this the exact same thing you're seeing with your MIPS build?
Dan East
Without seeing the map firsthand it's pretty difficult to tell what is happening. In the screenshot, it looks like an HOM (Hall of Mirrors) effect in both doorways/hallways.
BOTH of those doorways have entities within them-
trigger_multiple and func_episodegate.
func_episodegate is at the entrance of both doorways and is initially invisible. It turns into a solid wall if that episode is completed.
trigger_multiple is on the landing at the top of the stairs and is ALWAYS invisible. It triggers the message that pops up, something about "the netherworld".
Trigger_multiple is far more common, often triggering events that the player isn't aware of.
Does this problem occur in other areas where a trigger might be? More screenshots of other locations could be helpful.
It happens too in level one, right after you get past the "open area" where the dog is, inside that building, to the right is a closed area that get's all messy to, to the right there's a grunt and right past him there's a switch to move a bridge, but the graphics get messed up a little after that explosive container you find in that building.
What size stack were you using for the builds that worked? Reserve: 0x3d090 Commit: 0x1000? Or did you use higher values?
Dan East
Well, i too suspect it might be a config problem, i tried that. At first reserve was at 0x3d090 and commit at 0x1000, then i saw that the arm build had a commit value of 0x3000 so i changed it and i saw no change.
Just so you know, the emulator shows no glitches on my pc too so the source code is correct.
If you suspect it might be a config problem, send me a build and i'll test it for you
Last modification: CARPEDIEM - 03/15/01 at 11:08:35
Try this to help narrow down the problem. In r_draw.c, around line 1000 (I've made changes to the source I have, so that's just a ballpark figure), you'll see:
// add the edge
#ifndef USE_PQ_OPT1
R_EmitEdge (pv0, pv1);
#else
R_EmitEdge_fxp (pv0, pv1);
#endif
Change it to the first line to:
#ifndef USE_PQ_OPT1_NOT
Rebuild and see if the rendering problems are still there.
Thanks.
Dan East
Dan, you've come across something there because with that modification EVERYTHING looks like what we were telling you about before.
CARPE, maybe you should underclock your Casio until we get this ironed out, or just to see if it IS an overclock problem. Because the general PQ public could be able to play this game normally because they haven't overclocked.Last modification: Moose Master - 03/15/01 at 12:08:40
Listen... there's no reason to believe it's an overclocking issue. If you have yours @ 180 then you are running at a supported frecuency and your device should be just faster with no side effects.
Mine has no side effects and im running at 200.
Anyway, dan i forgot to tell you this yesterday but i switched back to the old world recursive function and the problem still remained... so the problem surely is in emitedge, but since it's not an isolated function i couldn't easily revert back to the old one.
I did what you asked me to do, you can see for yourself what happens when you do in the emulator, just make the change and run the emulator, you'll get a very distorted scenery, that's not actually what we get, it's perfect at times and worse sometimes on my ppc.
Oops. The original R_EmitEdge had some code in it I forgot to take out that I used to write the fixed point routines. Try this one:
http://www.pocketmatrix.com/pocketquake/r_draw.c
Dan East
Well it works just fine now, it still runs at 7.8 so i think we can release it.
Perhaps an sh3 build could be released and see if the bug is still there. what do you think?
The other mips versions can be removed too since this one is much much better.
Last modification: CARPEDIEM - 03/15/01 at 14:06:30
Right on! Now, I guess we just have to wait until it's all posted. Dan, carpe (and everyone else), keep up the good work, you kick ass!
When can we expect a release? I'd like 7.3 +/- FPS.
Hmm. How fast was it with the other rendering routine? I hoped the problem was not with the new R_EmitEdge_fxp function, because it was very difficult to debug and convert to fixed point. It gains 1 fps on the iPaq. I would have to debug on a MIPS device to fine tune the precision.
Change the line in r_draw back to:
#ifndef USE_PQ_OPT1
Then go into quakedef.h and comment out:
#define USE_PQ_OPT1
You make pick up a fraction of a fps with that (cuts out some fixed point pre-conversions used by R_EmitEdge_fxp).
Dan East
Well, i already tried that and i didn't get a speed increase. But don't worry dan, using the emitedge function that we are using only slows it down by 0.1 fps so it's cool.
Dan, if i could change the audio routines so that we could get like 0.3 fps more, could you support it and use that extra speed increase to make a build with 22050 hz sound?. Of couse, at no noticiable sound quality loss.
Last modification: CARPEDIEM - 03/15/01 at 15:14:21
Yeah, those pre-conversions don't cost much.
I don't know how you're going to pick up .3 fps optimizing the sound routines, but if you can I won't complain! Of course if it sounds like an Atari 2600 when you're done then that would not be cool.

Dan East
Carpediem; I'm currently working on another fixed point conversion, which I expect to increase FPS substantially. It will require that R_EmitEdge_fxp be used. If you've got time to continue on this project, you may want to debug on the device and try to see what's up with R_EmitEdge_fxp failing. Again, I hope for a pretty big jump in FPS, and I don't want the MIPS devices to be left totally in the dust.
Dan East
I'll work on it tonight then and see what i can find.
A quick intro to fixed point conversions would help me a lot, I think im gonna have to understand this function this time so if you have the time i'd really like to learn.
Well, the actual fixed point math should be fine, as it works under both the emulator and on the iPaq. It is just integer math, so there won't be precision type problems unique to the processor.
Obviously there is some threshold that is being broken. From your description, rendering is perfect, except in certain rooms. If you can identify what occurs in those areas, opposed to the areas where the rendering is good, we can then fix the problem.
One thing to look for in particular is overflow. You'll recognize this if you get a negative or positive value when you shouldn't. Examples of overflow would be multiplying two large positive values and getting a negative result. Basically if the sign is not what it should be after an operation, overflow occured. That is the type of threshold event I imagine is occuring which distorts the rendering like flipping a switch.
Dan East
Does anyone know what causes the "warped wall" effect, and if so, is it going to be fixed eventually?
That warping is from some kind of perspective correction routine which was disabled. I'm not quite sure exactly what was done, but the trade off in speed was well worth it.
I've already converted the perspective correction routines to fixed point for 0.06. It slows the framerate down by 0.8. So unfortunately, Jacco's first optimization (the only one used by PQ) gained most of its performance by not doing something, as opposed to doing something better.
I've converted other routines to fixed point which increases FPS by at least 2, so that at least offsets the perspective correction addition.
Dan East
It looks like someone jacked d_subdiv16. Normally this is a [fairly ineffective] toggle that performs perspective correction every 16 pixels.
It looks like this was extended beyond 64 pixels, possibly 128, it's difficult to tell.
I know d_subdiv16 is just a console variable (toggle), but I don't have time to scour the source code for the function that actually performs the task.
Anyway, since we were previously discussing the GPL, does id software approve of this kind of optimisation?
Maybe I notice this more because of my playing style. I tend to "hug" the walls, something I learned while playing Infiltration (Unreal Tournament).
oh, Dan already responded before I got a chance to post my last response. So will the perspective correction be "correct"?
Great Dan.
Anyway... i've been going though some of the code and i really can't find anything wrong.
I'll tell you what. You release source 0.06 and i'll make the proper changes in emitedge (i hope that's the function that's giving trouble) so that it uses floats again. It really didn't give us a lot of speed increase so that should do.
My hands are really tied, i don't know how to fix this, i've spent a few hours trying this and trying that and no success.
Well, here's the problem. EmitEdge is the end of the road for an edge's floating point vertices. I've converted its parent function, R_ClipEdge, and all of its parents to fixed point. Now when the world model is loaded from the pak file, its vertexes are converted to fixed point, which follows all the way down the line to EmitEdge. Of course I have left in all the orginal routines, so they can be toggled for building with a single preprocessor definition. There should be around 4 fps improvement using that chain of functions (including EmitEdge).
If you do not see an improvement with EmitEdge_fxp, then I suspect that the graphical distortion you see also results in slower performance. It soulds like the edges are many times longer then they should be, thus they take longer to render (and overlap each other, run off the screen, etc). I got at least 1 additional fps using EmitEdge_fxp alone.
I'm not sure what can be done, besides debugging on a MIPS device myself.
Dan East
randall; yes, the walls are perfectly straight in 0.06.
Dan East
Well,but I couldn't open the source page
http://www.pocketmatrix.com/pocketquake/download.html it gives error message.Where to get the source.
quake.pocketmatrix.com
Would it be possible to compile the source so that I could test PQ on the PPC emulator?
Yes, it works perfectly under the Emulator. However, landscape modes are not supported with the emulator build.
Dan East
Hmm, is the only thing I need to do to compile PQ to open the vcw file and build pocketquake.exe (after selecting the x86em platform).
This is what I get (the end of it). Sorry, but I'm not familiar with this.
snd_mem.c
snd_mix.c
snd_win.c
sv_main.c
sv_move.c
sv_phys.c
sv_user.c
sys_win.c
D:\temp\PocketQuake\WinQuake\sys_win.c(26) : fatal error C1083: Cannot open include file: 'gx.h': No such file or directory
trees.c
Generating Code...
Compiling...
uncompr.c
vid_ppc.c
D:\temp\PocketQuake\WinQuake\vid_ppc.c(30) : fatal error C1083: Cannot open include file: 'gx.h': No such file or directory
view.c
wad.c
world.c
zone.c
zutil.c
Generating Code...
Error executing cl.exe.
PocketQuake.exe - 2 error(s), 0 warning(s)
Ok, I just found the sourcenotes.txt, maybe the solution is there
I forgot I even wrote that! Interesting to read it again...

Dan East
Ok, I built pocketquake.exe with 0 errors or warnings, but when I run it, it shows the GUI (movement arrows, console etc.) but then crashes "PocketQuake.exe has encountered a problem and needs to close."

Guess this could depend on my machine having too little RAM or something.