i toy with this 3d rasterizer and get some 3d ships (kinda like aeroplanes/jets but in space) and want to code them interesting flying behaviours
maybe some will have some thoughts on it (then i eventually my try some
ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example some basic algortihm that work is
void FlyPass2(int i)
{
float3 player_pos=PlayerPos();
float3 to_player=sub(player_pos,bag[i].p.pos);
float distance=length(to_player);
if(distance<0.001f) return;
normalize(&to_player);
if(bag[i].combat_state!='approach' && bag[i].combat_state!='pass'
&& bag[i].combat_state!='turn') bag[i].combat_state='approach';
if(bag[i].combat_state=='approach')
{
YawPitchAccelerate(i,to_player,30/3);
if(distance<20*150) bag[i].combat_state='pass';
}
if(bag[i].combat_state=='pass')
{
YawPitchAccelerate(i,to_player,60/3);
if(distance<20*70) bag[i].combat_state='turn';
}
if(bag[i].combat_state=='turn')
{
float3 direction=mul(to_player,-1.0f);
YawPitchAccelerate(i, direction, 45/3);
if(distance>20*600) bag[i].combat_state='approach';
}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its max accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see what is
the ground around that
ship eventually also can make 'roll' moves and strafe moves (though im
not sure those strafe moves i defined well, also by acceleration + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float arrival_distance)
{
if(!points || point_count<=0) return;
int point=(int)bag[i].mode;
if(point<0 || point>=point_count) point=0;
float3 destination=points[point];
float3 direction=sub(destination,bag[i].p.pos);
if(length(direction)<arrival_distance)
{
point++;
if(point>=point_count) point=0;
bag[i].mode=(unsigned)point;
destination=points[point];
}
FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to another
and it in fact looks well...but i need some more
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting flying
behaviours
maybe some will have some thoughts on it (then i eventually my try some
ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example some
basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙ float3 player_pos=PlayerPos();
˙˙˙˙ float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙ float distance=length(to_player);
˙˙˙˙ if(distance<0.001f) return;
˙˙˙˙ normalize(&to_player);
˙˙˙˙ if(bag[i].combat_state!='approach' && bag[i].combat_state!='pass'
&& bag[i].combat_state!='turn')˙˙˙˙˙˙˙ bag[i].combat_state='approach';
˙˙˙˙ if(bag[i].combat_state=='approach')
˙˙˙˙ {
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙ }
˙˙˙˙ if(bag[i].combat_state=='pass')
˙˙˙˙ {
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙ }
˙˙˙˙ if(bag[i].combat_state=='turn')
˙˙˙˙ {
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙ }
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and linear
acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its max
accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see what is
the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though im
not sure those strafe moves i defined well, also by acceleration +
dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to another
and it in fact looks well...but i need some more
The "Master Execution Scheduler" with about 250+ programs
is off a bunch of main-frame scheduling routines, about
the roll-ups and the parts in carts and takt-fully.
It doesn't even have a unit of time more granular than "day",
"mdays".
Not my business.
i toy with this 3d rasterizer and get some 3d ships (kinda like aeroplanes/jets but in space) and want to code them interesting flying behaviours[...]
it just take array of 3d points and if near some then it turn to another
and it in fact looks well...but i need some more
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting flying
behaviours
maybe some will have some thoughts on it (then i eventually my try some
ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example some
basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙ float3 player_pos=PlayerPos();
˙˙˙˙ float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙ float distance=length(to_player);
˙˙˙˙ if(distance<0.001f) return;
˙˙˙˙ normalize(&to_player);
˙˙˙˙ if(bag[i].combat_state!='approach' && bag[i].combat_state!='pass'
&& bag[i].combat_state!='turn')˙˙˙˙˙˙˙ bag[i].combat_state='approach';
˙˙˙˙ if(bag[i].combat_state=='approach')
˙˙˙˙ {
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙ }
˙˙˙˙ if(bag[i].combat_state=='pass')
˙˙˙˙ {
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙ }
˙˙˙˙ if(bag[i].combat_state=='turn')
˙˙˙˙ {
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙ }
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and linear
acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its max
accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see what is
the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though im
not sure those strafe moves i defined well, also by acceleration +
dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to another
and it in fact looks well...but i need some more
The "Master Execution Scheduler" with about 250+ programs
is off a bunch of main-frame scheduling routines, about
the roll-ups and the parts in carts and takt-fully.
It doesn't even have a unit of time more granular than "day",
"mdays".
Not my business.
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like[...]
aeroplanes/jets but in space) and want to code them interesting flying
behaviours
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
Just ask your AI to do it for you... Right? Why even think about doing
it yourself... Sigh...
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like[...]
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
Just ask your AI to do it for you... Right? Why even think about doing
it yourself... Sigh...
i can ask ai but i want to have people some chance for fun..
besides things need some proportion..and some need sometimes to go slow
and try something other etc ..usenet thinking resolves problems slower
but like more deep than talk with ai - and i need some slower and deeper thought
fir pisze:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like[...]
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
Just ask your AI to do it for you... Right? Why even think about
doing it yourself... Sigh...
i can ask ai but i want to have people some chance for fun..
besides things need some proportion..and some need sometimes to go
slow and try something other etc ..usenet thinking resolves problems
slower
but like more deep than talk with ai - and i need some slower and
deeper thought
one i could think is for example:
the most strightforward attempt for ship to fight is to just 100% aim at target (my ship) and shoot...ewentually slow speed up if im far and slow down if im close - i see the bullets incoming on hud (as a linear 3d
stream so i could try to dodge if im far)
(speed of bullets right now 150 m/s my ship speed like typically 60 m/s)
speeding up eventually makes sense as from far distance its harder to
hit, slowing down when close eventually yet more sense
some problem is some could say if incoming ship is fire'ing it only
shots in direct way stright of his flight so he cant dodge if its aiming
at me, coz if its turns the bullet stream points in another direction
(which in fact if turnings are small may be good, say tutning in some
area could make a trap of bullats, i mean wider bullet stream, cone
instead of line
eventually is ship want to aim me he could make strafe moves and
correct turning to˙ aim me atill strafe moves making him moves and
make it harder to hit
that could be a basic piece of theory
IN FACT i could run the bot vs bot space fights and obserwe ho will win
so this could b a good programming contest..alghoritm vs algorithm
and i can put a video which one wins ;c
also possible to run alghoritms for whole escadres fight
its not so hard though it need some focus
fir pisze:
fir pisze:here are basik video of this
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like[...]
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
Just ask your AI to do it for you... Right? Why even think about
doing it yourself... Sigh...
i can ask ai but i want to have people some chance for fun..
besides things need some proportion..and some need sometimes to go
slow and try something other etc ..usenet thinking resolves problems
slower
but like more deep than talk with ai - and i need some slower and
deeper thought
one i could think is for example:
the most strightforward attempt for ship to fight is to just 100% aim
at target (my ship) and shoot...ewentually slow speed up if im far and
slow down if im close - i see the bullets incoming on hud (as a linear
3d stream so i could try to dodge if im far)
(speed of bullets right now 150 m/s my ship speed like typically 60 m/s)
speeding up eventually makes sense as from far distance its harder to
hit, slowing down when close eventually yet more sense
some problem is some could say if incoming ship is fire'ing it only
shots in direct way stright of his flight so he cant dodge if its
aiming at me, coz if its turns the bullet stream points in another
direction
(which in fact if turnings are small may be good, say tutning in some
area could make a trap of bullats, i mean wider bullet stream, cone
instead of line
eventually is ship want to aim me he could make strafe moves and
correct turning to˙ aim me atill strafe moves making him moves and
make it harder to hit
that could be a basic piece of theory
IN FACT i could run the bot vs bot space fights and obserwe ho will
win so this could b a good programming contest..alghoritm vs algorithm
and i can put a video which one wins ;c
also possible to run alghoritms for whole escadres fight
its not so hard though it need some focus
https://www.youtube.com/watch?v=3k6OlNCLzE4
there are two drones and 2 lame fighters as enemy
drones have algorithm/procedure to sit on tail and they are too agile to dodge them they sitt on tail like flies - thoug here they exploded
probbaly catching the ranndom bullets or i got soem error in algorith
and they exploded on own bullets maybe (need to check it later)
two lame fighters are easy to shot (they use this algorithm fly near 500
m to 200 m if less than 200 m shoting go away 600 m and repeat)
o got not strong cpu so this video dropped many frames it seems
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding
-like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure,
maybe some in the middle)
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding
-like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding
-like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
Love it! :^)
I give the AI props. Btw, how many lines of code did it make for you?
Actually, you rendering all of this on the cpu, right? Did that ai use instancing for the asteroids?
Chris M. Thomasson pisze:
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding >>>> -like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure, >>>> maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
Love it! :^)
I give the AI props. Btw, how many lines of code did it make for you?
Actually, you rendering all of this on the cpu, right? Did that ai use
instancing for the asteroids?
its not exactly written by ai you see it wrong..ai is used to write some implemenations of functions i tell it to provide but i need to orgaanize
it in code test it and so on..invent design and more
its 40k lines of code all made in 2 months though i got a lot of
experience and i generated things i wrote myself years back also
(whole rasterizer/window setup/utility function and more)
its 40k lines but a lot of it its the code for 3d models i tested and
not use - i will use some only... so its much more code ai allows you to test than the final you use probbly few times more...
i dont know what is instancing but if you mean that given model is in
fact one array (in fat two vertex array and triangle aray) its rather obvious
its all cpu..and i got very old PC must buy new one and that will be fortinate becouse im afraid it can clow down not only becouse of
geometry (like it can handle about 100k triangles but it obviusly slows down) but also becouse of collision detection - wchich is square and
may make it all choke (esp if i will shot a lot of bullets need a lot of collision checks with everything..so it is even an option i will hit the wall and get a bit resigned...
though i have basic experience i collision detection optimisation but if
i will see it takes 10 ms of frame time or mor i may end up depressed ;c
though on positiveside i got some hope some things like coding 'flock'/ crowd of flying a bit synchronised entities may have good
look, so there is a potential in it and this is only a base
(2 months of coding , though i must say i began to feel weary so
maybe i will drop it and will return to it after some months eventually)
On 11/19/2026 1:06 PM, fir wrote:
Chris M. Thomasson pisze:
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding >>>>> -like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not
sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
Love it! :^)
I give the AI props. Btw, how many lines of code did it make for you?
Actually, you rendering all of this on the cpu, right? Did that ai
use instancing for the asteroids?
its not exactly written by ai you see it wrong..ai is used to write
some implemenations of functions i tell it to provide but i need to
orgaanize it in code test it and so on..invent design and more
its 40k lines of code all made in 2 months though i got a lot of
experience and i generated things i wrote myself years back also
(whole rasterizer/window setup/utility function and more)
its 40k lines but a lot of it its the code for 3d models i tested and
not use - i will use some only... so its much more code ai allows you
to test than the final you use probbly few times more...
i dont know what is instancing but if you mean that given model is in
fact one array (in fat two vertex array and triangle aray) its rather
obvious
its all cpu..and i got very old PC must buy new one and that will be
fortinate becouse im afraid it can clow down not only becouse of
geometry (like it can handle about 100k triangles but it obviusly
slows down) but also becouse of collision detection - wchich is square
and
may make it all choke (esp if i will shot a lot of bullets need a lot of
collision checks with everything..so it is even an option i will hit
the wall and get a bit resigned...
though i have basic experience i collision detection optimisation but
if i will see it takes 10 ms of frame time or mor i may end up
depressed ;c
though on positiveside i got some hope some things like coding
'flock'/ crowd of flying a bit synchronised entities may have good
look, so there is a potential in it and this is only a base
(2 months of coding , though i must say i began to feel weary so
maybe i will drop it and will return to it after some months eventually)
You need to ask AI what instancing is. Think of one model, and a buffer
to the vertex shader with say, a shit load of mat4's. The single model
can be placed in many places with one single shader pass.
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding
-like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
i toy with this 3d rasterizer and get some 3d ships (kinda like aeroplanes/jets but in space) and want to code them interesting flying behaviours
maybe some will have some thoughts on it (then i eventually my try some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙float distance=length(to_player);
˙˙˙˙if(distance<0.001f) return;
˙˙˙˙normalize(&to_player);
˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!='pass'
&& bag[i].combat_state!='turn')˙˙˙˙˙˙˙ bag[i].combat_state='approach';
˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙{
˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙}
˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙{
˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙}
˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙{
˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45 meters/s)
˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its max accalarations
i need good ideas what such ships can do..i not yet thought on this seriously (becouse it took me a time to build this setup and see what is
the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though im
not sure those strafe moves i defined well, also by acceleration + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float arrival_distance)
{
˙˙˙ if(!points || point_count<=0) return;
˙˙˙ int point=(int)bag[i].mode;
˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙ float3 destination=points[point];
˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙ if(length(direction)<arrival_distance)
˙˙˙ {
˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙ destination=points[point];
˙˙˙ }
˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to another
and it in fact looks well...but i need some more
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting flying
behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example
some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!='pass'
&& bag[i].combat_state!='turn')˙˙˙˙˙˙˙ bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and linear
acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its
max accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see what
is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though im
not sure those strafe moves i defined well, also by acceleration +
dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back when I
was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example
some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' &&
bag[i].combat_state!='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its
max accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see what
is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though
im not sure those strafe moves i defined well, also by acceleration +
dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back when
I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
fir pisze:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example
some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' &&
bag[i].combat_state!='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its
max accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see
what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though
im not sure those strafe moves i defined well, also by acceleration
+ dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back when
I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
i could say the diffetence is probably˙ such then when using stright
winai you will deal with quirks (or own˙ lack of experiance) of winapi
and with side library with quirks of this librarary
hovever im not saying people should write on cpu rasterisation
its for learning purposes if i owuld buiuld something, test a things i
will probbaly "port " to gpu just to have much more geometry
(gpu probably handle 10x more than cpu)
fir pisze:
fir pisze:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example >>>>> some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' &&
bag[i].combat_state!='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45 >>>>> meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its >>>>> max accalarations
i need good ideas what such ships can do..i not yet thought on this >>>>> seriously (becouse it took me a time to build this setup and see
what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though >>>>> im not sure those strafe moves i defined well, also by acceleration >>>>> + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
i could say the diffetence is probably˙ such then when using stright
winai you will deal with quirks (or own˙ lack of experiance) of winapi
and with side library with quirks of this librarary
hovever im not saying people should write on cpu rasterisation
its for learning purposes if i owuld buiuld something, test a things i
will probbaly "port " to gpu just to have much more geometry
(gpu probably handle 10x more than cpu)
i also only use one core
now im weirdly tired, and if i would not i probbaly should testing
routines for ships avoiding collisions..i only also have only
bullets-ships collisions and ships-asteroids and thosw collisions worry
me becouse rasterisation is linear but collisions are square and optimising it makes code much more rigit/stiff im afraid so this can be a worry
9also using more cores makes code imo more rigid/stfii so i also dont
want to do it unles maybe final stepp...now im only toying and experimenting)
fir pisze:
fir pisze:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example >>>>> some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45 >>>>> meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its >>>>> max accalarations
i need good ideas what such ships can do..i not yet thought on this >>>>> seriously (becouse it took me a time to build this setup and see
what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though >>>>> im not sure those strafe moves i defined well, also by acceleration >>>>> + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
i could say the diffetence is probably˙ such then when using stright
winai you will deal with quirks (or own˙ lack of experiance) of winapi
and with side library with quirks of this librarary
hovever im not saying people should write on cpu rasterisation
its for learning purposes if i owuld buiuld something, test a things i
will probbaly "port " to gpu just to have much more geometry
(gpu probably handle 10x more than cpu)
i also only use one core
now im weirdly tired, and if i would not i probbaly should testing
routines for ships avoiding collisions..i only also have only bullets-
ships collisions and ships-asteroids and thosw collisions worry me
becouse rasterisation is linear but collisions are square and optimising
it makes code much more rigit/stiff im afraid so this can be a worry
9also using more cores makes code imo more rigid/stfii so i also dont
want to do it unles maybe final stepp...now im only toying and experimenting)
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example
some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its
max accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see what
is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though
im not sure those strafe moves i defined well, also by acceleration +
dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back when
I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
On 11/20/2026 12:23 AM, fir wrote:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example
some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn') bag[i].combat_state='approach'; >>>>
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45
meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its
max accalarations
i need good ideas what such ships can do..i not yet thought on this
seriously (becouse it took me a time to build this setup and see
what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though
im not sure those strafe moves i defined well, also by acceleration
+ dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back when
I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
Ahhh. Okay. Thanks. For learning, that's neat. Almost like you are
trying to build the pipeline directly on the CPU. Do you have a
pipeline? You should model at least vertex shader to frag shader.
Chris M. Thomasson pisze:
On 11/20/2026 12:23 AM, fir wrote:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example >>>>> some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45 >>>>> meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its >>>>> max accalarations
i need good ideas what such ships can do..i not yet thought on this >>>>> seriously (becouse it took me a time to build this setup and see
what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though >>>>> im not sure those strafe moves i defined well, also by acceleration >>>>> + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
Ahhh. Okay. Thanks. For learning, that's neat. Almost like you are
trying to build the pipeline directly on the CPU. Do you have a
pipeline? You should model at least vertex shader to frag shader.
its much simpler than you think - its mainly triangle rasterization
routine (rasterizatio it is drawing with depth buffer also basic
cliping).. light you can count using triangle normal and lights you
define..
one of˙ the main advantages it is just get know how simple it is and how
it works..other advantage is in fact you can do what you want define thousand lights , defina routines for lightning like you want etc..try
to think on rasterisation not triangles but bezier patches etc ..you can
d what you want in pure c so its theretical freedom but ofc it will slow down
more hard than basic rasterisation is maybe the transformation and projection by camera and camera movement as it needs imo a carefull understanding of x y z coordinates
so this is kinda low level, simple transparent but you need to
understand those few functions well..overally it also should be no point
of focus more focus is higher layer of those ships and their
interactions (which need some work, rasterization in turn is well known
and not really hard problem, well resolved and described)
On 11/20/2026 12:33 AM, fir wrote:
fir pisze:
fir pisze:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try >>>>>> some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for
example some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20
(45 meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from >>>>>> 0.0..1.0 can be passed if ships qould be said only use parts of
its max accalarations
i need good ideas what such ships can do..i not yet thought on
this seriously (becouse it took me a time to build this setup and >>>>>> see what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves
(though im not sure those strafe moves i defined well, also by
acceleration + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float >>>>>> arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
i could say the diffetence is probably˙ such then when using stright
winai you will deal with quirks (or own˙ lack of experiance) of
winapi and with side library with quirks of this librarary
hovever im not saying people should write on cpu rasterisation
its for learning purposes if i owuld buiuld something, test a things
i will probbaly "port " to gpu just to have much more geometry
(gpu probably handle 10x more than cpu)
i also only use one core
now im weirdly tired, and if i would not i probbaly should testing
routines for ships avoiding collisions..i only also have only bullets-
ships collisions and ships-asteroids and thosw collisions worry me
becouse rasterisation is linear but collisions are square and optimising
it makes code much more rigit/stiff im afraid so this can be a worry
9also using more cores makes code imo more rigid/stfii so i also dont
want to do it unles maybe final stepp...now im only toying and
experimenting)
Well, is your engine multithreaded?
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding
-like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
It looks good to me.
On 11/20/2026 3:41 PM, fir wrote:
Chris M. Thomasson pisze:
On 11/20/2026 12:23 AM, fir wrote:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try >>>>>> some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for
example some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20
(45 meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from >>>>>> 0.0..1.0 can be passed if ships qould be said only use parts of
its max accalarations
i need good ideas what such ships can do..i not yet thought on
this seriously (becouse it took me a time to build this setup and >>>>>> see what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves
(though im not sure those strafe moves i defined well, also by
acceleration + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float >>>>>> arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
Ahhh. Okay. Thanks. For learning, that's neat. Almost like you are
trying to build the pipeline directly on the CPU. Do you have a
pipeline? You should model at least vertex shader to frag shader.
its much simpler than you think - its mainly triangle rasterization
routine (rasterizatio it is drawing with depth buffer also basic
cliping).. light you can count using triangle normal and lights you
define..
one of˙ the main advantages it is just get know how simple it is and
how it works..other advantage is in fact you can do what you want
define thousand lights , defina routines for lightning like you want
etc..try to think on rasterisation not triangles but bezier patches
etc ..you can d what you want in pure c so its theretical freedom but
ofc it will slow down
more hard than basic rasterisation is maybe the transformation and
projection by camera and camera movement as it needs imo a carefull
understanding of x y z coordinates
so this is kinda low level, simple transparent but you need to
understand those few functions well..overally it also should be no
point of focus more focus is higher layer of those ships and their
interactions (which need some work, rasterization in turn is well known
and not really hard problem, well resolved and described)
When you port over to say modern opengl, learning the raw pipeline might help you out?
Chris M. Thomasson pisze:
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding >>>> -like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not sure, >>>> maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
Love it! :^)
I give the AI props. Btw, how many lines of code did it make for you?
Actually, you rendering all of this on the cpu, right? Did that ai use
instancing for the asteroids?
its not exactly written by ai you see it wrong..ai is used to write some implemenations of functions i tell it to provide but i need to orgaanize
it in code test it and so on..invent design and more
its 40k lines of code all made in 2 months though i got a lot of
experience and i generated things i wrote myself years back also
(whole rasterizer/window setup/utility function and more)
its 40k lines but a lot of it its the code for 3d models i tested and
not use - i will use some only... so its much more code ai allows you to test than the final you use probbly few times more...
i dont know what is instancing but if you mean that given model is in
fact one array (in fat two vertex array and triangle aray) its rather obvious
its all cpu..and i got very old PC must buy new one and that will be fortinate becouse im afraid it can clow down not only becouse of
geometry (like it can handle about 100k triangles but it obviusly slows down) but also becouse of collision detection - wchich is square and
may make it all choke (esp if i will shot a lot of bullets need a lot of collision checks with everything..so it is even an option i will hit the wall and get a bit resigned...
though i have basic experience i collision detection optimisation but if
i will see it takes 10 ms of frame time or mor i may end up depressed ;c
though on positiveside i got some hope some things like coding
'flock'/crowd of flying a bit synchronised entities may have good
look, so there is a potential in it and this is only a base
(2 months of coding , though i must say i began to feel weary so
maybe i will drop it and will return to it after some months eventually)
fir pisze:
Chris M. Thomasson pisze:sadly now i feel an ability to code but the drive to invest myself into longer state of concentration and push forward decreased so it shows i
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal coding >>>>> -like normally you cut through and write it - turns into 'research'
where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not
sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
Love it! :^)
I give the AI props. Btw, how many lines of code did it make for you?
Actually, you rendering all of this on the cpu, right? Did that ai
use instancing for the asteroids?
its not exactly written by ai you see it wrong..ai is used to write
some implemenations of functions i tell it to provide but i need to
orgaanize it in code test it and so on..invent design and more
its 40k lines of code all made in 2 months though i got a lot of
experience and i generated things i wrote myself years back also
(whole rasterizer/window setup/utility function and more)
its 40k lines but a lot of it its the code for 3d models i tested and
not use - i will use some only... so its much more code ai allows you
to test than the final you use probbly few times more...
i dont know what is instancing but if you mean that given model is in
fact one array (in fat two vertex array and triangle aray) its rather
obvious
its all cpu..and i got very old PC must buy new one and that will be
fortinate becouse im afraid it can clow down not only becouse of
geometry (like it can handle about 100k triangles but it obviusly
slows down) but also becouse of collision detection - wchich is square
and
may make it all choke (esp if i will shot a lot of bullets need a lot of
collision checks with everything..so it is even an option i will hit
the wall and get a bit resigned...
though i have basic experience i collision detection optimisation but
if i will see it takes 10 ms of frame time or mor i may end up
depressed ;c
though on positiveside i got some hope some things like coding
'flock'/crowd of flying a bit synchronised entities may have good
look, so there is a potential in it and this is only a base
(2 months of coding , though i must say i began to feel weary so
maybe i will drop it and will return to it after some months eventually)
need some rest
though i maybe found some basic interesting ideas ..i will see after
some rest
fir pisze:
fir pisze:
Chris M. Thomasson pisze:sadly now i feel an ability to code but the drive to invest myself
On 11/19/2026 12:22 AM, fir wrote:
fir pisze:
this is overally all not hard but its such kind of things that
(for some not quite known for me reason) liek turns from normal
coding
-like normally you cut through and write it - turns into 'research' >>>>>> where you can research it for weeks or months
(and im not saying cutthrough or research are better ways, im not >>>>>> sure,
maybe some in the middle)
new version
https://www.youtube.com/watch?v=T0f6Hx_KrvI
Love it! :^)
I give the AI props. Btw, how many lines of code did it make for you?
Actually, you rendering all of this on the cpu, right? Did that ai
use instancing for the asteroids?
its not exactly written by ai you see it wrong..ai is used to write
some implemenations of functions i tell it to provide but i need to
orgaanize it in code test it and so on..invent design and more
its 40k lines of code all made in 2 months though i got a lot of
experience and i generated things i wrote myself years back also
(whole rasterizer/window setup/utility function and more)
its 40k lines but a lot of it its the code for 3d models i tested and
not use - i will use some only... so its much more code ai allows you
to test than the final you use probbly few times more...
i dont know what is instancing but if you mean that given model is in
fact one array (in fat two vertex array and triangle aray) its rather
obvious
its all cpu..and i got very old PC must buy new one and that will be
fortinate becouse im afraid it can clow down not only becouse of
geometry (like it can handle about 100k triangles but it obviusly
slows down) but also becouse of collision detection - wchich is
square and
may make it all choke (esp if i will shot a lot of bullets need a lot of >>> collision checks with everything..so it is even an option i will hit
the wall and get a bit resigned...
though i have basic experience i collision detection optimisation but
if i will see it takes 10 ms of frame time or mor i may end up
depressed ;c
though on positiveside i got some hope some things like coding
'flock'/crowd of flying a bit synchronised entities may have good
look, so there is a potential in it and this is only a base
(2 months of coding , though i must say i began to feel weary so
maybe i will drop it and will return to it after some months eventually) >>>
into longer state of concentration and push forward decreased so it
shows i need some rest
though i maybe found some basic interesting ideas ..i will see after
some rest
some idea made by me and ai is that maybe those moves can be composite like
moveShip(int i)
{
˙ ChaseTarget(i, j);
˙ AvoidObstacles(i);
˙ ShotIfAimed(i);
}
trying it a bit but the avoidance code dont quite work
https://www.youtube.com/watch?v=v1CIw4jFlik
overally sadli best is to code after longer break if someone code to
much its get slowa as snail..so maybe this is nonsense to code snail
mode (though i m also a bit interested in results)
Chris M. Thomasson pisze:
On 11/20/2026 3:41 PM, fir wrote:
Chris M. Thomasson pisze:
On 11/20/2026 12:23 AM, fir wrote:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like >>>>>>> aeroplanes/jets but in space) and want to code them interesting >>>>>>> flying behaviours
maybe some will have some thoughts on it (then i eventually my
try some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for
example some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state! >>>>>>> ='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 >>>>>>> (45 meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given >>>>>>> direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and >>>>>>> linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value
from 0.0..1.0 can be passed if ships qould be said only use parts >>>>>>> of its max accalarations
i need good ideas what such ships can do..i not yet thought on
this seriously (becouse it took me a time to build this setup and >>>>>>> see what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves
(though im not sure those strafe moves i defined well, also by
acceleration + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float
speed,float arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to >>>>>>> another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
Ahhh. Okay. Thanks. For learning, that's neat. Almost like you are
trying to build the pipeline directly on the CPU. Do you have a
pipeline? You should model at least vertex shader to frag shader.
its much simpler than you think - its mainly triangle rasterization
routine (rasterizatio it is drawing with depth buffer also basic
cliping).. light you can count using triangle normal and lights you
define..
one of˙ the main advantages it is just get know how simple it is and
how it works..other advantage is in fact you can do what you want
define thousand lights , defina routines for lightning like you want
etc..try to think on rasterisation not triangles but bezier patches
etc ..you can d what you want in pure c so its theretical freedom but
ofc it will slow down
more hard than basic rasterisation is maybe the transformation and
projection by camera and camera movement as it needs imo a carefull
understanding of x y z coordinates
so this is kinda low level, simple transparent but you need to
understand those few functions well..overally it also should be no
point of focus more focus is higher layer of those ships and their
interactions (which need some work, rasterization in turn is well known
and not really hard problem, well resolved and described)
When you port over to say modern opengl, learning the raw pipeline
might help you out?
ofc it helps you a lot
Chris M. Thomasson pisze:
On 11/20/2026 12:23 AM, fir wrote:
Chris M. Thomasson pisze:
On 11/16/2026 11:37 AM, fir wrote:
i toy with this 3d rasterizer and get some 3d ships (kinda like
aeroplanes/jets but in space) and want to code them interesting
flying behaviours
maybe some will have some thoughts on it (then i eventually my try
some ideas and post a video how it work)
the api you need to code such behaviour is quite simple for example >>>>> some basic algortihm that work is
void FlyPass2(int i)
{
˙˙˙˙˙float3 player_pos=PlayerPos();
˙˙˙˙˙float3 to_player=sub(player_pos,bag[i].p.pos);
˙˙˙˙˙float distance=length(to_player);
˙˙˙˙˙if(distance<0.001f) return;
˙˙˙˙˙normalize(&to_player);
˙˙˙˙˙if(bag[i].combat_state!='approach' && bag[i].combat_state!
='pass' && bag[i].combat_state!='turn')
bag[i].combat_state='approach';
˙˙˙˙˙if(bag[i].combat_state=='approach')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,30/3);
˙˙˙˙˙˙˙˙ if(distance<20*150) bag[i].combat_state='pass';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='pass')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i,to_player,60/3);
˙˙˙˙˙˙˙˙ if(distance<20*70) bag[i].combat_state='turn';
˙˙˙˙˙}
˙˙˙˙˙if(bag[i].combat_state=='turn')
˙˙˙˙˙{
˙˙˙˙˙˙˙˙ float3 direction=mul(to_player,-1.0f);
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
˙˙˙˙˙˙˙˙ if(distance>20*600) bag[i].combat_state='approach';
˙˙˙˙˙}
}
if c would have basic vector arithmetic it would look better
20*600 mean 600 meters as the world 1.0 unit is like 5 cm
45/3 means 45 m/s speed -as its about 60 fps so 45/3*60 = 45*20 (45 >>>>> meters/s)
˙˙˙˙˙˙˙˙ YawPitchAccelerate(i, direction, 45/3);
do most work it just make ship starting to yaw-pitch into given
direction and accelerate/deacce;erate for given speed
(it is handled by simple 'engine' which has limited angular and
linear acceleration and there is also dumping factor)..
here above it uses its max accelerations but eventually value from
0.0..1.0 can be passed if ships qould be said only use parts of its >>>>> max accalarations
i need good ideas what such ships can do..i not yet thought on this >>>>> seriously (becouse it took me a time to build this setup and see
what is the˙ ground around that
ship eventually also can make 'roll' moves and strafe moves (though >>>>> im not sure those strafe moves i defined well, also by acceleration >>>>> + dumping..it may be bad approach)
one of interesting tiny algorithm i tested it yet this
void Patrol(int i,float3 *points,int point_count,float speed,float
arrival_distance)
{
˙˙˙˙ if(!points || point_count<=0) return;
˙˙˙˙ int point=(int)bag[i].mode;
˙˙˙˙ if(point<0 || point>=point_count) point=0;
˙˙˙˙ float3 destination=points[point];
˙˙˙˙ float3 direction=sub(destination,bag[i].p.pos);
˙˙˙˙ if(length(direction)<arrival_distance)
˙˙˙˙ {
˙˙˙˙˙˙˙˙ point++;
˙˙˙˙˙˙˙˙ if(point>=point_count) point=0;
˙˙˙˙˙˙˙˙ bag[i].mode=(unsigned)point;
˙˙˙˙˙˙˙˙ destination=points[point];
˙˙˙˙ }
˙˙˙˙ FlyToward(i,destination,speed);
}
it just take array of 3d points and if near some then it turn to
another and it in fact looks well...but i need some more
For fun I closed my work and opened an old project of mine. Back
when I was experimenting with PBR:
https://i.ibb.co/bM0vxPRV/image.png
Btw, how are you drawing to the screen?
windows has a blitter and you have normal buffer i ram
unsigned* buf= NULL;
whuch you then alloc and blit
acces is buf[w*y+x] = color;
but if some want not use winapi but some librery that allows to
use this cpu/ram buffers it will be just about the same thing
(assuing they wrote this libs sensible and they probably did)
Ahhh. Okay. Thanks. For learning, that's neat. Almost like you are
trying to build the pipeline directly on the CPU. Do you have a
pipeline? You should model at least vertex shader to frag shader.
its much simpler than you think - its mainly triangle rasterization
routine (rasterizatio it is drawing with depth buffer also basic
cliping).. light you can count using triangle normal and lights you
define..
one of˙ the main advantages it is just get know how simple it is and how
it works..other advantage is in fact you can do what you want define thousand lights , defina routines for lightning like you want etc..try
to think on rasterisation not triangles but bezier patches etc ..you can
d what you want in pure c so its theretical freedom but ofc it will slow down
more hard than basic rasterisation is maybe the transformation and projection by camera and camera movement as it needs imo a carefull understanding of x y z coordinates
so this is kinda low level, simple transparent but you need to
understand those few functions well..overally it also should be no point
of focus more focus is higher layer of those ships and their
interactions (which need some work, rasterization in turn is well known
and not really hard problem, well resolved and described)
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 5 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 498678:05:28 |
| Calls: | 212 |
| Calls today: | 3 |
| Files: | 912 |
| D/L today: |
31 files (22,593K bytes) |
| Messages: | 69,856 |