Forum

Descriptive Modding: The PSP Engine

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Descriptive Modding: The PSP Engine

Postby Baker » Tue Jan 12, 2010 5:16 pm

I've been examining the PSP Quake engine and the Kurok engine and testing features and looking at various things ...

Here are some notes about the experience using the Sony Playstation Portable with Quake and/or Kurok.

and point out differences and making notes:

Image

The PSP

The PSP needs hacked to run Quake. Generally you buy a Pandora battery and it comes with instructions on how to do this. That isn't so hard. I bought mine from here for $24 +/- ( http://www.pandorasales.com/ )

The PSP has a small "memory stick" and with a USB to 5-pin cable plugged into the PSP, you can use it like a USB thumb drive.

Image

To run Quake or Kurok, you access the memory stick in the menu under Games and select the game and press "X".

Note: Whatever command line you want to use is controlled by a cmdline file.

Input

The Sony PSP runs Quake very well. It's like a mini-laptop. Since I'm also writing this for the benefit of people who don't have one.

Features:

1. No keyboard obviously
2. No mouse
3. Analog joystick built-in, effectively works as a substitute for the mouse.
4. Four directional buttons.
5. "Left" and a "Right" button at the top that you can't really see in a picture (sort of a Nintendo GameCube controller L and R buttons).
5. A set of 4 buttons: triangle, square, circle and cross ("X"). The Cross button is essentially Enter. The circle button is essentially escape. The Triangle button is often used for options.
6. Sound +/- buttons, start and select. And a couple of other ones.

Using the analog stick and whatever 4 directional buttons you choose to use for control, playing Quake on the PSP isn't bad at all. You won't be able to take on Travail in nightmare difficulty settings but fighting the monsters on easy is fine. Navigation is sub-mouse ease of use, but due to the analog stick, you can get around quite well.

Experience

Console. The Sony PSP has no keyboard but Kurok has a popup keyboard. It works, is functional but is not convenient but far better than no ability to type letters at all. Every PSP engine desperately needs a command history like JoeQuake (and Qrack and ezQuake).

Network. I connected Kurok to my PSP and vice-versa. Works both as client and as server. No current PSP engine is NAT fixed. The PSP has wireless and only wireless; wireless uses routers; routers use NAT. Ugh! (NAT fix tutorial). Desperately needs a server browser for sure (a server list is a good start, but that'll suck quick enough.) Fortunately, there is libcurl for the PSP so a ProQuake type server browser should be within reach.

Image

(But unlike DarkPlaces and Quakeworld's true serverbrowser via heartbeat, the ProQuake 4.10 draws from a URL and actually requires infrastructure-- aka it pulls from the QuakeOne.com server feed developed by EFESS).

Music. Kurok has MP3 support via hardware.

Network Notes. The Sony PSP can either connect PSP to PSP or via a wireless access point (your router) via "Infrastructure". Kurok has a nice little built in thing to active this.

Graphics

It looks like GLQuake and you wouldn't be able to tell the difference. Except the resolution is going to be 480x272.

Image

The Differences From a Code Standpoint

Different floating point math functions, uses PSPGU instead of OpenGL, you have about 20 MB to play with on the PSP 1000 series since it has 32 MB but about 12 MB is overhead. The 2000 series "Slim" has 64 MB total so maybe about 40-50 MB.

Texture memory is a concern. I noticed in Kurok it deletes unused textures on each new level. Not surprising.

Input controls obviously. The network code is Linux-like/OS X-like in the non-operating system specific parts, obviously.

Other than that, compiling and working with the code base is for me (as someone who likes Windows the best for coding due to WinMerge and hating OS X cursor keys) is easier with the PSP in Cygwin than anything short of MSVC6.

No doubt some PSP by-products will be forthcoming soon. Plus I'm going to help the Solitude guys make their engine available in the same or similar form on Windows [Mac OS X version will probably automatically happen too] and I intend to hit ProQuake then Kurok and then Solitude to do this in the best manner.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Tue Jan 12, 2010 8:43 pm

More notes:

timedemo demo1: 74.7 frames per second
timedemo demo3: 61.3 frames per second

/Important because I need to have a base "metric" to determine if I've made any detrimental changes as I make changes.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Team Xlink » Tue Jan 12, 2010 8:44 pm

Baker, no publicly announced quake engine for the psp has a nat fix. My engine does, along with a lot of other necessities.

Also, the psp Quake engine has a keyboard, Kurok isn't using the PSP Quake V2 kurok uses PSP Quake V1.1 as a base which is non related to the sourceforge project. The PSP Quake V2 isn't the best choice of engine to play Quake on.

This provided an interesting read. Thank you for sharing.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby Baker » Tue Jan 12, 2010 11:17 pm

Team Xlink wrote:Kurok isn't using the PSP Quake V2 kurok uses PSP Quake V1.1 as a base ...


Yep, I know that :D


Team Xlink wrote:This provided an interesting read. Thank you for sharing.


I try to be verbose because modding is more than about features, but also about having context and being able to visual information and educating whoever happens to read it.

.
.

After several tests and experiments I'm going to incrementally upscale the PSP Quake engine over the course of a few hours ... combining it with ProQuake and Kurok.

Rapid succession works best because if I break something I can locate where and fix it. If I do it all at once, I could spend hours trying to locate the source of something broken. And uploading the source after each revision is just good practice ensuring I can fall back on it and don't have a way of losing all my work.

Version 0: Source

Connects to a server (no NAT fix). Timedemo gets 60-70 fps on demo1/demo3. Lightmaps do not work. It compiles.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Team Xlink » Tue Jan 12, 2010 11:58 pm

Great work so far.
Last edited by Team Xlink on Tue Jan 19, 2010 9:19 pm, edited 1 time in total.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby Baker » Wed Jan 13, 2010 12:04 am

Thanks for all the info.

I would love to work with you on the ProQuake psp engine.

Thank you.


If ProQuake for the PSP isn't done before I go to sleep, I'll be disappointed in myself. :D :D I morphed FlashQuake in just 4 hours.

Revision 1: source

Killed all strcmp, memset, strcpy and the other redundancies in string manipulation in the source.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Wed Jan 13, 2010 12:18 am

Revision 2: (source)

No more sprintf or vsprintf - targets for string buffer overflow

DarkPlaces source code has the following comments in the code, I thought it was hilarious when I first saw it and DarkPlaces is a great resource for learning and studying good coding practices:

Note LordHavoc actually undefines the string functions, hehe.

DarkPlaces common.h wrote:// A bunch of functions are forbidden for security reasons (and also to please MSVS 2005, for some of them)
// LordHavoc: added #undef lines here to avoid warnings in Linux
#undef strcat
#define strcat DO_NOT_USE_STRCAT__USE_STRLCAT_OR_MEMCPY
#undef strncat
#define strncat DO_NOT_USE_STRNCAT__USE_STRLCAT_OR_MEMCPY
#undef strcpy
#define strcpy DO_NOT_USE_STRCPY__USE_STRLCPY_OR_MEMCPY
#undef strncpy
#define strncpy DO_NOT_USE_STRNCPY__USE_STRLCPY_OR_MEMCPY


I only addressed sprintf and vsnprintf ... eventually sometime I'll get around to bothering to "proof" all the string concatenation and string copy functions in ProQuake, but I haven't taken the time yet.
Last edited by Baker on Wed Jan 13, 2010 12:51 am, edited 1 time in total.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Team Xlink » Wed Jan 13, 2010 12:33 am

Well, I am a little late because you already posted a new version but:

http://www.megaupload.com/?d=UUAVDXIY

It includes Adhoc support and the Nat fix. All changes are properly commented. The only part I didn't comment was the changes in the makefile because I didn't want to clutter the makefile.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby Baker » Wed Jan 13, 2010 12:44 am

Revision 3: (source)

FitzQuake style cvar system with operator callback, sorted cmdlist and cvarlist.

Operator callback is very important, without it you have to write a lot of crappy little places to detect if a cvar has changed.

Plus the FitzQuake style cvar system actually allows you to have the "Reset to Defaults" in the menu actually do exactly that. As far as I know, the only NetQuake that resets all cvars properly to the default value as specified in the quake.rc values is DarkPlaces. Well, and after discovering that ... ProQuake 4.

@XLink: I'll take a look at the Adhoc support, but ironically have no way of testing it since I don't have 2 PSPs :? Would you have the ability of testing Adhoc support?

(For those that don't know, Adhoc network support allows 2 PSPs to play each other peer-to-peer without the need for a wireless access point.)
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Team Xlink » Wed Jan 13, 2010 12:49 am

The Adhoc support fully works.

All changes are commented except for the makefile (reason stated above) and two files were renamed, the infrastructure files were renamed to network.psp because it is no longer just for infrastructure.

Also, you can play adhoc with more then two PlayStation portables.

EDIT: Well I was going to wait until you reply to post more stuff but I will just edit this post.

I have tested the adhoc support and it fully works.

I have noticed you are using Quakev2 as your base, I noticed thsi because of the lack of the osk code in the engine.

You see, even tho the onscreen keyboard isn't that good and efficient, it is a must and a modder and a person who wants to do any console commands must have some way of test input.

As for this, if I setup an svn somewhere mind if I upload each source base separately so its easy to keep track of the changes?

The problem I for see is this:

Somewhere down the road someone is going to find this thread and want the source code in an svn way, some of these links might be dead or this may be long forgotten or surpassed by greater things for the same concept.

Also, since you plan on finishing this project tonight, do you mind if I continue to work on it after your done?
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby MDave » Wed Jan 13, 2010 3:24 am

I believe I optimised how it renders alias models in Kurok compared to Quake v1.1, so don't forget to check that code out. I might be wrong on this but I'm pretty sure of it :) Maybe it was to do with interpolated animations, which should render just as fast as non interpolated animations.
User avatar
MDave
 
Posts: 76
Joined: Mon Dec 17, 2007 7:08 pm

Postby Downsider » Wed Jan 13, 2010 3:32 am

Team Xlink wrote:Well, here are a few things you should know.


PSP Kurok can't play online in Quake servers. Even when it is in its "Quake" mode.

I beleive this stems from MDave's autoaim which he implemented to psp users.

it is a modification done in the function dealing with sv_aim. I am not sure this is the stem of the problem or not.

Another thing you should know, Kurok can't proporly run Quake out of the box even though it was said it could.

There is an explosion bug that causes it too crash when the stock quake explosions.

The fix for that is this:

Mini bug fix tutorial:

Step 1.

Open up cl_tent.c

find the CL_ParseTEnt function

Where it says this:

Code: Select all
   case TE_GUNSHOT:         // bullet hitting wall
      pos[0] = MSG_ReadCoord ();
      pos[1] = MSG_ReadCoord ();
      pos[2] = MSG_ReadCoord ();
      if(!kurok)
         R_RunParticleEffect (pos, vec3_origin, 0, 20);
      break;


Remove the if(!kurok) part.

That line is used in standard Quake so I am unsure why the if(!kurok) was even put there as it is also in standard quake, and is needed for quake to run correctly. I suspect it was a typo.

Another thing, I have been interested in ProQuake for the psp for some time now.

If possible could you maybe setup an svn in sourceforge (Anywhere its your choice. That was just an example.).

I would love to work with you on the ProQuake psp engine.

Thank you.


I've never experienced any of these problems, and the autoaim is done by the server and doesn't effect the client's ability to connect to a server.

And I can also connect to vanilla NetQuake servers fine on my PSP.Ee
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Baker » Wed Jan 13, 2010 3:46 am

Team Xlink wrote:Also, since you plan on finishing this project tonight, do you mind if I continue to work on it after your done?


It's GPL. Of course I don't mind.

"the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users."

I don't plan on making frequent enough changes to ProQuake to use an SVN. I still haven't fully integrated version 4 and the type of work needed on the engine requires very broad platform knowledge to finish that integration (I've spent the last couple of years using DarkPlaces, Fruitz of Dojo, SDL source code and such as learning tools for interoperating system code and practices).

Feel free to play with the source and share any experimentation you do. I'd wait until I finish the PSP integration first, though .. heh. :P
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Wed Jan 13, 2010 5:40 am

Revision 4: source

Revision 5: source

Revision 6: source

Some of this is coming along slower than I would prefer. Mostly because I ended up with an unexplained "blackscreen" boot with a revision when I made seemingly a trivial change [twice as odd that I have a version with the change from last week that runs fine].

Oh well ... that's how it goes sometimes ... I'm sure as I proceed that little mystery will unravel itself.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby r00k » Wed Jan 13, 2010 5:54 am

Oh sweet! PSPQrack! :P

R_simpleitems style 24bit hires sprites, remake of original quake models.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Next

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest