........................
Net Yaroze chat server:
http://netyaroze.com/chat
Chat and attachments archived:
https://archive.org/download/netyaroze-chat-archive
Channel: #programming-3d-graphics
Date: 2024-01-28
........................
@aionmagan#0 - 2024-01-25 14:57
Thanks, i was having problems with VSyncCallback so i removed the code but i will look into it again, callbacks are beautiful
Thank you for all the help man much appreciated!!!!
---------------
@molit#0 - 2024-01-25 15:11
VSyncCallback your function has to end during the frame, it is called 50 times per second in PAL, 60 in NTSC
---------------
@molit#0 - 2024-01-25 15:11
So your code has to be very fast
---------------
@molit#0 - 2024-01-25 15:11
I think everyone used frame based movements because for time based ones it implies divisions, which means CPU cycles being used
---------------
@molit#0 - 2024-01-25 15:12
so hardcoded values are faster
---------------
@molit#0 - 2024-01-25 15:12
That being said, this is in the doc:
Timings of V-blanks and H-blanks:
V-blanks:50 (PAL) or 60 (NTSC) vertical synchronisation interrupts per second
H-blanks: 311 per V-blank
---------------
@molit#0 - 2024-01-25 15:16
So what you have to do is call VSync per frame and get its returned value, divide it with 311 and sum 1, there you get number of fps, multiply to 20 and you get time in ms for PAL (16 or 17 for NTSC)
---------------
@molit#0 - 2024-01-25 15:17
but I think that frame based and try to keep stuck to an fps number is better
---------------
@aionmagan#0 - 2024-01-25 15:18
My problem is the fluctuations from 34 to 60 fps while movement is framerate dependent, so now i just want to lock it down to 30 fps
---------------
@aionmagan#0 - 2024-01-25 15:19
I am using ntsc at the moment as well, so thank you for the info Ill look into it
---------------
@aionmagan#0 - 2024-01-25 15:23
....Replying to....
molit#0
2024-01-25 15:16:39.249000
So what you have to do is call VSync per frame and get its returned value, divide it with 311 and sum 1, there you get number of fps, multiply to 20 and you get time in ms for PAL (16 or 17 for NTSC)
....Replying to....
Wait, this sounds like framerate independence tho, or am i thinking about this wrong ?
---------------
@molit#0 - 2024-01-25 20:46
It is, but you will be doing some maths to get it
---------------
@aionmagan#0 - 2024-01-25 20:47
Is there a way to lock the fps instead?
---------------
@molit#0 - 2024-01-25 20:47
If you want to stick to 30fps just call VSync(0), if it returns more than 311 you are safe, otherwise call it again
---------------
@aionmagan#0 - 2024-01-25 20:50
Mmmmm
---------------
@molit#0 - 2024-01-25 20:57
According to docs it is 311 H lines per frame
---------------
@molit#0 - 2024-01-25 20:57
Maybe it is different or it depends on video mode
---------------
@mike.garcia#0 - 2024-01-25 23:08
311 Hlines, thats it! I see it in the user guide page 35 in the Synchronizing with Vertical Synchronization Interrupts section
---------------
@mike.garcia#0 - 2024-01-25 23:11
....Replying to....
molit#0
2024-01-25 20:47:35.482000
If you want to stick to 30fps just call VSync(0), if it returns more than 311 you are safe, otherwise call it again
....Replying to....
you would call VSync(1); to get the hlines (Returns absolute time from program start in VSync units.)
then VSync(0); to wait (Blocks until vertical synchronization occurs )
---------------
@mike.garcia#0 - 2024-01-25 23:26
and I think if(VSync(1)311) then you would call VSync(0) to get to 30FPS, then again before the buffswap
---------------
@mike.garcia#0 - 2024-01-25 23:44
did old commercial games lock down the frame rate like that? seems like a waist of CPU cycles to bother
---------------
@aionmagan#0 - 2024-01-26 01:02
....Replying to....
mike.garcia#0
2024-01-25 23:44:42.134000
did old commercial games lock down the frame rate like that? seems like a waist of CPU cycles to bother
....Replying to....
yeah a lot of commercial games have physics tied to framerate in those cases they lock the fps to make sure physics didnt break, actually frame independent physics wasnt common practice until late ps2 era of games
---------------
@mike.garcia#0 - 2024-01-26 01:06
....Replying to....
aionmagan#0
2024-01-26 01:02:21.347000
yeah a lot of commercial games have physics tied to framerate in those cases they lock the fps to make sure physics didnt break, actually frame independent physics wasnt common practice until late ps2 era of games
....Replying to....
Cool
---------------
@mike.garcia#0 - 2024-01-26 01:10
like car racing physics... I dont check FPS, so Ill take your word that its locked
---------------
@aionmagan#0 - 2024-01-26 01:11
car racing physics ?
---------------
@aionmagan#0 - 2024-01-26 01:12
this is also why tomb raider runs at 30 ntsc and 25 pal (the different region ps1 are exactly the same, its the limitation of the tvs of that time)
---------------
@aionmagan#0 - 2024-01-26 01:13
....Replying to....
mike.garcia#0
2024-01-26 01:10:12.794000
like car racing physics... I dont check FPS, so Ill take your word that its locked
....Replying to....
i think you believe physics to be the very complex stuff, but all types of movement, bounding volumes, collision checks jumping and all those movements also fall under physics
---------------
@mike.garcia#0 - 2024-01-26 01:14
....Replying to....
aionmagan#0
2024-01-26 01:13:14.979000
i think you believe physics to be the very complex stuff, but all types of movement, bounding volumes, collision checks jumping and all those movements also fall under physics
....Replying to....
yeah, I wouldnt call it physics, thats simple maths, physics isnt simple
---------------
@aionmagan#0 - 2024-01-26 01:16
....Replying to....
mike.garcia#0
2024-01-26 01:14:10.714000
yeah, I wouldnt call it physics, thats simple maths, physics isnt simple
....Replying to....
physics has variating meanings, physics covers a lot of topics which are all math, physics includes mechanics, heat, light and other radiation, sound, electricity, magnetism ect.
so its both very easy or very hard depending on what you are trying to accomplish
---------------
@mike.garcia#0 - 2024-01-26 01:17
simple math is called pre calc, TMK, physics isnt pre calc
---------------
@mike.garcia#0 - 2024-01-26 01:17
....Replying to....
aionmagan#0
2024-01-26 01:12:25.462000
this is also why tomb raider runs at 30 ntsc and 25 pal (the different region ps1 are exactly the same, its the limitation of the tvs of that time)
....Replying to....
Yeah, but is it locked manually via code as in adding an extra vsync, or is the base running at 30fps sometimes with slow down and speeds up... I know some speed runs they look down, because it speeds up the FSP and it isnt locked.
---------------
@mike.garcia#0 - 2024-01-26 01:18
Ie golden eye, and it also has physics
---------------
@aionmagan#0 - 2024-01-26 01:19
....Replying to....
mike.garcia#0
2024-01-26 01:17:31.619000
Yeah, but is it locked manually via code as in adding an extra vsync, or is the base running at 30fps sometimes with slow down and speeds up... I know some speed runs they look down, because it speeds up the FSP and it isnt locked.
....Replying to....
yeah, which means the physics part of the game is tied to the framerate, so when it slows down so those the way the game reacts such as it moves slower, it jumps and lands slower and such
i dont want that in my game and since my framerate is very high but dips quite often and makes everying thing go from 60fps to 34fps it makes the game feel weird of off
---------------
@aionmagan#0 - 2024-01-26 01:20
....Replying to....
mike.garcia#0
2024-01-26 01:18:16.259000
Ie golden eye, and it also has physics
....Replying to....
golden eye was just build different, that doesnt have physics, it has a little miracle in a chip XD lmao, have you ever tilted the cartriage ? XD
---------------
@aionmagan#0 - 2024-01-26 01:21
a tilted cartiage made it a whole other game and gave you super man powers
---------------
@mike.garcia#0 - 2024-01-26 01:24
....Replying to....
aionmagan#0
2024-01-26 01:19:36.419000
yeah, which means the physics part of the game is tied to the framerate, so when it slows down so those the way the game reacts such as it moves slower, it jumps and lands slower and such
i dont want that in my game and since my framerate is very high but dips quite often and makes everying thing go from 60fps to 34fps it makes the game feel weird of off
....Replying to....
I guess you would calculate two physics passes when over 30FPS and then probably skip the next frames physics?
---------------
@mike.garcia#0 - 2024-01-26 01:25
Im not sure, I would just keep the slow down
---------------
@aionmagan#0 - 2024-01-26 01:25
i would but not in this case, i will simply skip execution of everything
---------------
@aionmagan#0 - 2024-01-26 01:26
an now i know that VSyncCallback doesnt thread which could be the perfect place to try it
---------------
@aionmagan#0 - 2024-01-26 01:26
ill see after i finish the whole game because thats more important then framerate
---------------
@aionmagan#0 - 2024-01-26 01:27
i literally just got audio working after finishing a VectorMoveTowards function in assembly (which i believe i could optimize it further)
---------------
@aionmagan#0 - 2024-01-26 01:27
so now i need to nag a few of my friends to make music for me XD
---------------
@mike.garcia#0 - 2024-01-26 01:28
midi or CD-DA?
---------------
@aionmagan#0 - 2024-01-26 01:28
most likely midi but ill see, because i dont want to use the CDrom feature i want to load everything into the 2mb ram
---------------
@aionmagan#0 - 2024-01-26 01:29
this is the most abitious game i have build in terms of gameplay, how many levels and size (personal challange of mine)
---------------
@mike.garcia#0 - 2024-01-26 01:29
....Replying to....
aionmagan#0
2024-01-26 01:28:39.175000
most likely midi but ill see, because i dont want to use the CDrom feature i want to load everything into the 2mb ram
....Replying to....
I would recommend using the VB/VH (sound fonts/voice banks) thats on the NY boot disk, audio is pretty big
---------------
@mike.garcia#0 - 2024-01-26 01:30
digital audio is easier for everyone
---------------
@aionmagan#0 - 2024-01-26 01:30
if the audio gets out of control i will consider it, am trying to reuse most of the textures just change vertex data which that part is very cheap but am also stupid enough to want to build 10 levels XD
---------------
@aionmagan#0 - 2024-01-26 01:31
the game is not hard tho or complicated i just wanted to build something cool for NY for my first 3d, next round im going very incognita inspired XD
---------------
@aionmagan#0 - 2024-01-26 01:31
but this one is very metal gear inspired
---------------
@aionmagan#0 - 2024-01-26 01:32
(just the camera tho )
---------------
@mike.garcia#0 - 2024-01-26 01:32
thats cool
---------------
@mike.garcia#0 - 2024-01-26 01:33
how do you do your 3D animation?
---------------
@aionmagan#0 - 2024-01-26 01:33
....Replying to....
mike.garcia#0
2024-01-26 01:33:02.515000
how do you do your 3D animation?
....Replying to....
the lazy way XD jajaja
---------------
@aionmagan#0 - 2024-01-26 01:33
different meshes no lerp
---------------
@mike.garcia#0 - 2024-01-26 01:34
yup, thats the best approach IMO
---------------
@aionmagan#0 - 2024-01-26 01:34
yeah, later i may consider lerp but this is my first attempt at ps1 3d
---------------
@mike.garcia#0 - 2024-01-26 01:35
try it, but from my testing it slows it down substantially, but it depends on how many verts
---------------
@aionmagan#0 - 2024-01-26 01:35
ill try it next game jam
---------------
@aionmagan#0 - 2024-01-26 01:35
.....Attachment....image.png - 13210B
https://cdn.discordapp.com/attachments/827473349357207572/1200252747073736714/image.png?ex65c5817a&is65b30c7a&hm4273e8ca3ed8911a7dd3d74ff21b09f89daf448bdbbb80ba8cb6856f4c49c0a4&
.....Attachment....
---------------
@aionmagan#0 - 2024-01-26 01:36
this is that code i said, but i believe i can remove around 6 more instruction
by using SILT + XORing the value i need
---------------
@aionmagan#0 - 2024-01-26 01:36
but ill leave it at that unless i need more speed because all enemies use this to move around
---------------
@aionmagan#0 - 2024-01-26 01:38
oh and i also removed multiplication which was heavily used and it was very slow
---------------
@mike.garcia#0 - 2024-01-26 01:39
removed muls? I dont understand asm, is the #else C code? lol
---------------
@aionmagan#0 - 2024-01-26 01:39
yeah the else is C code
---------------
@aionmagan#0 - 2024-01-26 01:40
im leaving all the C code behind for anyone who wants to read it
---------------
@aionmagan#0 - 2024-01-26 01:40
or see what the function does in a more readable way
---------------
@mike.garcia#0 - 2024-01-26 01:41
I use the Peter Passmore 3D course code
// move the model nD steps in the direction it is pointing
void y3dforwardvector( yarmicospoint3Dt rotateVector, long speed, yarmicopoint3Dt forwardVector)
// Moves the model nD units in the direction of its rotation vector
MATRIX matTmp;
SVECTOR startVector;
SVECTOR currentDirection;
// set up original vector, pointing down the positive z axis
startVector.vx 0; startVector.vy 0; startVector.vz ONE;
// RotMatrix sets up the matrix coefficients for rotation
RotMatrix((SVECTOR) rotateVector, &matTmp);
// multiply startVector by mattmp and put the result in currentDirection
// which is the vector defining the direction the player is pointing
ApplyMatrixSV(&matTmp, &startVector, ¤tDirection);
// currentDirection components have a maximum value of 4096 so we
// scale nD to 4096 /nD then when we add the amount of
// translation we divide by nD. This ensures that we will translate
// the number of units originally specified by nD
// nD 4096 /nD ;
forwardVector-vx (currentDirection.vx speed) 12; // div by 4096;
forwardVector-vy (currentDirection.vy speed) 12; // div by 4096;
forwardVector-vz (currentDirection.vz speed) 12; // div by 4096;
---------------
@mike.garcia#0 - 2024-01-26 01:42
I found out three doesnt format anything inbetween it
---------------
@mike.garcia#0 - 2024-01-26 01:42
ie the key
---------------
@aionmagan#0 - 2024-01-26 01:45
oh this moves something forward in its local object space,
my code is a bit different, it moves a point between 2 other points (vectors)
like getting a point in a line between two vectors since my enemies rotate none-stop
i would have used your approached if i had a more complex enemy (mine are just simple geometry
---------------
@aionmagan#0 - 2024-01-26 01:45
.....Attachment....image.png - 32044B
https://cdn.discordapp.com/attachments/827473349357207572/1200255261332471900/image.png?ex65c583d1&is65b30ed1&hm81b3df4d3a9a4be7d1b099d9359d666ca66354eee596e6efd880fafdaee7b4e6&
.....Attachment....
---------------
@aionmagan#0 - 2024-01-26 01:45
thats my enemy
---------------
@aionmagan#0 - 2024-01-26 01:46
if i was good at 3d art i would have done a better job but i suck, your model took me like 3 days to get it XD jajaja
---------------
@mike.garcia#0 - 2024-01-26 01:54
....Replying to....
aionmagan#0
2024-01-26 01:45:18.760000
oh this moves something forward in its local object space,
my code is a bit different, it moves a point between 2 other points (vectors)
like getting a point in a line between two vectors since my enemies rotate none-stop
i would have used your approached if i had a more complex enemy (mine are just simple geometry
....Replying to....
Oh cool I see, nice
---------------
@molit#0 - 2024-01-26 07:15
If you use MIDI bank from Sony it uses 400KB, so only 100KB for your SFX
---------------
@humanhead#0 - 2024-01-26 07:24
....Replying to....
mike.garcia#0
2024-01-26 01:41:44.794000
I use the Peter Passmore 3D course code
// move the model nD steps in the direction it is pointing
void y3dforwardvector( yarmicospoint3Dt rotateVector, long speed, yarmicopoint3Dt forwardVector)
// Moves the model nD units in the direction of its rotation vector
MATRIX matTmp;
SVECTOR startVector;
SVECTOR currentDirection;
// set up original vector, pointing down the positive z axis
startVector.vx 0; startVector.vy 0; startVector.vz ONE;
// RotMatrix sets up the matrix coefficients for rotation
RotMatrix((SVECTOR) rotateVector, &matTmp);
// multiply startVector by mattmp and put the result in currentDirection
// which is the vector defining the direction the player is pointing
ApplyMatrixSV(&matTmp, &startVector, ¤tDirection);
// currentDirection components have a maximum value of 4096 so we
// scale nD to 4096 /nD then when we add the amount of
// translation we divide by nD. This ensures that we will translate
// the number of units originally specified by nD
// nD 4096 /nD ;
forwardVector-vx (currentDirection.vx speed) 12; // div by 4096;
forwardVector-vy (currentDirection.vy speed) 12; // div by 4096;
forwardVector-vz (currentDirection.vz speed) 12; // div by 4096;
....Replying to....
Where is this from
---------------
@mike.garcia#0 - 2024-01-26 07:52
....Replying to....
humanhead#0
2024-01-26 07:24:45.505000
Where is this from
....Replying to....
https://github.com/gwald/netyarozedemo/blob/17b67e292a7abf54bb21d156d315d8f36b37fca1/User%20Created%20Guides/Peter%20Passmore%203D%20course/STEP10/MAIN.C#L415
---------------
@mike.garcia#0 - 2024-01-26 07:54
....Replying to....
molit#0
2024-01-26 07:15:17.094000
If you use MIDI bank from Sony it uses 400KB, so only 100KB for your SFX
....Replying to....
Thats a good point, it is big, not leaving much from the 512kb Sound RAM size.
but it is midi compatible and it does sound good.
---------------
@molit#0 - 2024-01-26 08:01
....Replying to....
mike.garcia#0
2024-01-26 07:54:40.259000
Thats a good point, it is big, not leaving much from the 512kb Sound RAM size.
but it is midi compatible and it does sound good.
....Replying to....
Yes, bank quality is really good. Music sounds awesome, but then you dont have space for your own sound
---------------
@molit#0 - 2024-01-26 08:03
You can create a version with only the instruments you use, but it has to be loaded from auto file
---------------
@molit#0 - 2024-01-26 08:03
Haha
---------------
@mike.garcia#0 - 2024-01-26 08:07
yes, I think there might be a way to recreate the VAB file (or VAG samples) from the VH/VB files and remove (shorten to zero size) the sounds not used, then recreate the VAB and VH/VB with the original order and settings
---------------
@mike.garcia#0 - 2024-01-26 08:08
working with the PS audio tools I found really hard the first time doing it
---------------
@molit#0 - 2024-01-26 08:08
Yes, you can edit banks with VAB editor
---------------
@molit#0 - 2024-01-26 08:09
Actually what Ive done is put sounds double speed and then find with it the note for playing it properly
---------------
@molit#0 - 2024-01-26 08:10
It has worse sound but uses half space
---------------
@mike.garcia#0 - 2024-01-26 08:20
speeding up samples it a good compression trick
---------------
@molit#0 - 2024-01-26 08:21
It is the only way with NY
---------------
@mike.garcia#0 - 2024-01-26 08:22
The UK OPSM did that with the background music
---------------
@mike.garcia#0 - 2024-01-26 08:22
You can use saw/square/sine wave samples in a VAB and make retro sound FX too
---------------
@mike.garcia#0 - 2024-01-26 08:23
or chip tunes
---------------
@molit#0 - 2024-01-26 08:23
Yes, I am using this web for generating them
---------------
@molit#0 - 2024-01-26 08:24
https://sfbgames.itch.io/chiptone
---------------
@mike.garcia#0 - 2024-01-26 08:26
I saw that app, its pretty good
---------------
@molit#0 - 2024-01-26 08:42
Yeah, its really easy and nice to generate retro Sound effects
---------------
@molit#0 - 2024-01-26 08:42
haha
---------------
@mike.garcia#0 - 2024-01-28 00:50
....Replying to....
aionmagan#0
2024-01-25 05:58:44.322000
Mmmmm, also why is no$pro so fast when emulating?, it doesnt slow down like real hardware and its annoying to try an optimize things
....Replying to....
.....Attachment....image.png - 17243B
https://cdn.discordapp.com/attachments/827473349357207572/1200965993736982699/image.png?ex65c819bd&is65b5a4bd&hm1e8828f46ad85c9553af3b0c23f50f83951a093170d18af3020adbbcea09dfad&
.....Attachment....
enable perf indicator in the Other tab, it shows the speed and fps on the title bar
---------------
@mike.garcia#0 - 2024-01-28 00:50
.....Attachment....image.png - 16765B
https://cdn.discordapp.com/attachments/827473349357207572/1200966084963078235/image.png?ex65c819d3&is65b5a4d3&hm9d25f314212f48e9248ea313adb42fc896a221a8c69657ba045790e0d2493272&
.....Attachment....
these are the other settings I have
---------------
@mike.garcia#0 - 2024-01-28 00:50
I find Dark is more realistic
---------------