3D FPS Example
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
3D FPS Example
Yet another 3D related example but with simple texturing and a first-person camera this time.

You do not have the required permissions to view the files attached to this post.
Last edited by LameGuy64 on December 12th, 2017, 12:05 am, edited 1 time in total.
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
-
Administrator Verified
- Admin / PSXDEV
- Posts: 2691
- Joined: Dec 31, 2012
- I am a: Shadow
- PlayStation Model: H2000/5502
Very impressive. I really need to get that DTL-H2000 out to you. I've sent you a PM.
Oh, for those that want to compile it with Psy-Q, here is the MAKEFILE:
Here is the compiled PS-EXE by the way with flight inversion (IE: down is up and up is down):
Oh, for those that want to compile it with Psy-Q, here is the MAKEFILE:
Code: Select all
# -----------------------------------------
# PlayStation 1 Psy-Q Makefile
# -----------------------------------------
all:
del fptest.map
del fptest.sym
del fptest.exe
del fptest.cpe
cls
ccpsx -Xm -Xo$80010000 fptest.c -ofptest.cpe,fptest.sym,fptest.map
cpe2x /ce fptest.cpe
You do not have the required permissions to view the files attached to this post.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.
PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.
PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.
- bizarro2011
- Serious PSXDEV User
- Posts: 118
- Joined: Mar 27, 2012
- Location: Brazil
very good 

-
Shendo Verified
- C Programming Expert
- Posts: 250
- Joined: Mar 21, 2012
- I am a: Programmer
- Motto: Never settle
- PlayStation Model: SCPH-7502
- Discord: ShendoXT
- Location: Croatia, EU
I agree, it's very cool. Tested on SCPH9002 and SCPH102 and works great.
Maybe you should add a widescreen toggle option
Maybe you should add a widescreen toggle option

Dev console: SCPH-7502, FreePSXBoot, CH340 serial cable.
- kirito1910
- Interested PSXDEV User
- Posts: 8
- Joined: Dec 09, 2014
- I am a: Developer
- Location: Italy
wow amazing example 
someone know how he obtained a .c file from a 3d mesh file?

someone know how he obtained a .c file from a 3d mesh file?
-
gwald Verified
- Net Yaroze Enthusiast
- Posts: 341
- Joined: Sep 18, 2013
- I am a: programmer/DBA
- PlayStation Model: Net Yaroze
- Contact:
This is very awesome!!!
Thanks for sharing the FPS code too
at the tile popping due to the fixed floating point GTE, I think making the tile a unit bigger fixes it.
I'd say it's just a bin2code conversion.


Thanks for sharing the FPS code too


kirito1910 wrote:wow amazing example
someone know how he obtained a .c file from a 3d mesh file?
I'd say it's just a bin2code conversion.
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
It actually just contains an array of 3D vertex coordinates for each quad... Thanks for the compliments though!gwald wrote:I'd say it's just a bin2code conversion.
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
-
gwald Verified
- Net Yaroze Enthusiast
- Posts: 341
- Joined: Sep 18, 2013
- I am a: programmer/DBA
- PlayStation Model: Net Yaroze
- Contact:
LOL,
I actually tried converting it to NetYaroze code
I am stuck at :
RotAverageNclip4:
I actually tried converting it to NetYaroze code

I am stuck at :
Code: Select all
t=0; NumPrims=0;
for (i=0; i<quad_count; i++) {
myPrimTempT = (POLY_FT4*)myPrimPtr;
nclip = RotAverageNclip4(
&quad_mesh[t], &quad_mesh[t+1], &quad_mesh[t+2], &quad_mesh[t+3],
(long*)&myPrimTempT->x0, (long*)&myPrimTempT->x1,
(long*)&myPrimTempT->x3, (long*)&myPrimTempT->x2,
&p, &OTz, &Flag);
if ((nclip > 0) && (OTz > 0)) {
SetPolyFT4(myPrimTempT);
quad_color[i].cd = myPrimTempT->code;
OTc = OTz>>(14-OT_LENGTH);
// High LOD level (subdivided)
if (OTc < 15) {
if (OTc > 5) div.ndiv = 1; else div.ndiv = 2;
DivideFT4(
&quad_mesh[t], &quad_mesh[t+1], &quad_mesh[t+3], &quad_mesh[t+2],
(u_long*)&tp[0], (u_long*)&tp[1], (u_long*)&tp[2], (u_long*)&tp[3],
&quad_color[i],
myPrimTempT, &myOT[ActivePage][OTc],
&div);
// Increment primitive list pointer
myPrimPtr += POLY_FT4_size*((1<<(div.ndiv))<<(div.ndiv));
NumPrims += ((1<<(div.ndiv))<<(div.ndiv));
// Low LOD level (no subdivision)
} else if (OTc < 48) {
myPrimTempT->u0 = tp[0].u; myPrimTempT->v0 = tp[0].v;
myPrimTempT->u1 = tp[1].u; myPrimTempT->v1 = tp[1].v;
myPrimTempT->u2 = tp[2].u; myPrimTempT->v2 = tp[2].v;
myPrimTempT->u3 = tp[3].u; myPrimTempT->v3 = tp[3].v;
myPrimTempT->clut = tp[0].page;
myPrimTempT->tpage = tp[1].page;
DpqColor(&quad_color[i], p, &ColTemp);
setRGB0(myPrimTempT, ColTemp.r, ColTemp.g, ColTemp.b);
addPrim(&myOT[ActivePage][OTc], myPrimTempT);
myPrimPtr += POLY_FT4_size;
NumPrims += 1;
}
}
t+=4;
}
*/
The rest looks familiar.. I'm sure the yaroze SDK can do it.. I remember doing custom TMD stuff.RotAverageNclip4
Perform a coordinate transformation and perspective transformation for four points; find an interpolation
value, average of Z values, and outer product.
Library
libgte.lib
Header File
libgte.h
Introduced
2.x
Syntax
long RotAverageNclip4(
SVECTOR *v0, SVECTOR *v1, SVECTOR *v2, SVECTOR *v3,
long *sxy0, *sxy1, *sxy2, *sxy3,
long *p,
long *otz,
long *flag)
Documentation Date
12/14/98
Pointer to vectors (input)
Pointer to coordinates (output)
Pointer to interpolation value
(output)
Pointer to OTZ value (output)
Pointer to flag (output)
Explanation
A coordinate transformation of four points v0, v1, v2, and v3 is performed using a rotation matrix. Next a
perspective transformation is performed and four screen coordinates sxy0, sxy1, sxy2 and sxy3 are
returned. An interpolation value for depth cueing on v2 to p is also returned. Finally, we also receive 1/4 of
the Z value of the screen coordinates for v2 to otz.
v0, v1, v2, v3 -> vx, vy, vz
sxy0, sxy1, sxy2, sxy3
p
otz
flag
: (1, 15, 0)
: (1, 15, 0), (1, 15, 0)
: (0, 20, 12)
: (0, 32, 0)
: (0, 32, 0)
When the return value is negative, SX, SY, etc., are incorrect. When SX and SY are required, use
RotAverage4().
Return value
Outer product of (sx0, sy0), (sx1, sy1), (sx2, sy2).
See also
RotAverage4(), RotAverageNclip3()
Hi! Can you please upload the "Makefile" i'm using another SDK and without it i can't compile! Thank you very much 

-
Administrator Verified
- Admin / PSXDEV
- Posts: 2691
- Joined: Dec 31, 2012
- I am a: Shadow
- PlayStation Model: H2000/5502
Uhm, the MAKEFILE is shown in my first post. It uses CCPSX, but you can get away with using GCC if you know how.Aquilus wrote:Hi! Can you please upload the "Makefile" i'm using another SDK and without it i can't compile! Thank you very much
Code: Select all
ccpsx -Xm -Xo$80010000 fptest.c -ofptest.cpe,fptest.sym,fptest.map
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.
PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.
PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.
Ah,i'm a stupid xD! Sorry i didn't see the message hahahaha.
PS thanks for the response
PS thanks for the response

-
NITROYUASH Verified
- Extreme PSXDEV User
- Posts: 127
- Joined: Jan 07, 2018
- I am a: Game Designer
- PlayStation Model: SCPH-7502
- Contact:
good stuff, but what about collision between camera and model(s)?
- MrQuetch
- Active PSXDEV User
- Posts: 42
- Joined: Apr 01, 2018
- I am a: Programmer and artist.
- Motto: You can accomplish anything.
- Location: United States
Hi, Lameguy64.
This is a really cool example of 3D on the PS1 - there is a lot to learn here. I have figured out my texture problem; so, thanks for your help with that.
This is a really cool example of 3D on the PS1 - there is a lot to learn here. I have figured out my texture problem; so, thanks for your help with that.
- MrQuetch
- Active PSXDEV User
- Posts: 42
- Joined: Apr 01, 2018
- I am a: Programmer and artist.
- Motto: You can accomplish anything.
- Location: United States
There are many methods of getting collision "data". What you can do is use simple trigonometry to check the sides of the camera (player), and check the distance between yourself and the walls, floors, ceilings, and if it is too close - tell it to stop moving. If you can get all of the "boxes" in the scene, you could use AABB collisions to check and see if you are within the bounds of one of those "boxes". AABB is meant for 2D, but if you add the other axis (I'll call it AABBCC), you could get the same variant in 3D.NITROYUASH wrote: ↑January 13th, 2018, 9:16 pm good stuff, but what about collision between camera and model(s)?
Hopefully this helps.

-
NITROYUASH Verified
- Extreme PSXDEV User
- Posts: 127
- Joined: Jan 07, 2018
- I am a: Game Designer
- PlayStation Model: SCPH-7502
- Contact:
I am here again.
Quadmap.c is still confusing me, how i can export 3D data to this type? ._ .
Thanks for the answers c:
So, i have a test level (TIM, RSD and TMD) and i want to test it with this example code.It actually just contains an array of 3D vertex coordinates for each quad... Thanks for the compliments though!
Quadmap.c is still confusing me, how i can export 3D data to this type? ._ .
Thanks for the answers c:
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
quadmap.c just contains an array of quad coordinates and colors. The rendering method I used in this example is a quick and dirty one when I was still learning how to do 3D graphics on the console.
For TMD stuff, here are some examples I made a long time ago: http://www.psxdev.net/forum/viewtopic.php?f=64&t=626
For TMD stuff, here are some examples I made a long time ago: http://www.psxdev.net/forum/viewtopic.php?f=64&t=626
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
-
NITROYUASH Verified
- Extreme PSXDEV User
- Posts: 127
- Joined: Jan 07, 2018
- I am a: Game Designer
- PlayStation Model: SCPH-7502
- Contact:
So, i think a TMD format is perfect for basic 3D objects (characters, decorations, etc), but not for level geometry, right?
-
gwald Verified
- Net Yaroze Enthusiast
- Posts: 341
- Joined: Sep 18, 2013
- I am a: programmer/DBA
- PlayStation Model: Net Yaroze
- Contact:
TMD is a dirty word around hereNITROYUASH wrote: ↑November 6th, 2018, 4:14 am So, i think a TMD format is perfect for basic 3D objects (characters, decorations, etc), but not for level geometry, right?

It's not really perfect for anything apart from a menu or non playable screens, it's way to big of a format!
But if you like using it, that's cool

The thing with TMD you don't want to have too many calls,
I mean textured quads in a TMD individually draw, is pretty crappy, (Net Yaroze SDK - the FPS on my recording is crap but notice the number of quads on screen and Hlines Vsyncs!) :
[BBvideo=560,315]https://www.youtube.com/watch?v=mkC_L2sHWtY[/BBvideo]
Compared to a single draw:
[BBvideo=560,315]https://www.youtube.com/watch?v=8uCgLuGif5o[/BBvideo]
-
NITROYUASH Verified
- Extreme PSXDEV User
- Posts: 127
- Joined: Jan 07, 2018
- I am a: Game Designer
- PlayStation Model: SCPH-7502
- Contact:
Sooooo, if TMD (oh, sorry for that word
) isn't nice, what are my other options?
Also, how it looks like (PSY-Q v4.7):

Also, how it looks like (PSY-Q v4.7):
You do not have the required permissions to view the files attached to this post.
-
gwald Verified
- Net Yaroze Enthusiast
- Posts: 341
- Joined: Sep 18, 2013
- I am a: programmer/DBA
- PlayStation Model: Net Yaroze
- Contact:
That looks cool!
Like I said, TMD is ok if used in few draw calls, but it's not really good for fast/action games, IMO anyway.
I don't know much about PSY-Q but I think there's a primitive library? ie it doesn't start with GS.
Ie: addPrim mentioned in above ZIP file
Which looks like it uses the TMD's types (POLY_FT4 etc) but without the overhead of the complete TMD/GS bloat.
Like I said, TMD is ok if used in few draw calls, but it's not really good for fast/action games, IMO anyway.
I don't know much about PSY-Q but I think there's a primitive library? ie it doesn't start with GS.
Ie: addPrim mentioned in above ZIP file
Which looks like it uses the TMD's types (POLY_FT4 etc) but without the overhead of the complete TMD/GS bloat.
Who is online
Users browsing this forum: No registered users and 1 guest