Thread View: comp.lang.c
33 messages
33 total messages
Started by fir
Mon, 16 Nov 2026 19:37
[p.i.c] ships flyin and faitin
Author: fir
Date: Mon, 16 Nov 2026 19:37
Date: Mon, 16 Nov 2026 19:37
103 lines
4162 bytes
4162 bytes
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
Re: [p.i.c] ships flyin and faitin
Author: Ross Finlayson
Date: Mon, 16 Nov 2026 20:10
Date: Mon, 16 Nov 2026 20:10
116 lines
4890 bytes
4890 bytes
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.
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Mon, 16 Nov 2026 21:06
Date: Mon, 16 Nov 2026 21:06
121 lines
5207 bytes
5207 bytes
On 11/16/2026 12:10 PM, Ross Finlayson wrote:
> 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.
Huh?
>
> It doesn't even have a unit of time more granular than "day",
> "mdays".
>
> Not my business.
>
>
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Mon, 16 Nov 2026 21:08
Date: Mon, 16 Nov 2026 21:08
11 lines
1649 bytes
1649 bytes
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...
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Mon, 16 Nov 2026 21:57
Date: Mon, 16 Nov 2026 21:57
120 lines
5271 bytes
5271 bytes
Ross Finlayson 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
>
>
> 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.
>
>
are ou here to troll? if so trolls are not so easy welcome imo
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Mon, 16 Nov 2026 22:00
Date: Mon, 16 Nov 2026 22:00
19 lines
2053 bytes
2053 bytes
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
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Mon, 16 Nov 2026 23:33
Date: Mon, 16 Nov 2026 23:33
54 lines
3495 bytes
3495 bytes
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
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Mon, 16 Nov 2026 23:53
Date: Mon, 16 Nov 2026 23:53
72 lines
4251 bytes
4251 bytes
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 >>> [...] >>>> 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 > here are basik video of this 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
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Mon, 16 Nov 2026 23:56
Date: Mon, 16 Nov 2026 23:56
84 lines
4655 bytes
4655 bytes
fir pisze: > 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 >>>> [...] >>>>> 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 >> > here are basik video of this > > 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) > those drones though very agile but has lesslinear speed so the option is to speed up left them behind turn on them and shoot them in front until they jump on tail - though if they approaching they shoot ofc (they literally never escape..unlike lame fighters) > 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
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Tue, 17 Nov 2026 10:59
Date: Tue, 17 Nov 2026 10:59
7 lines
1776 bytes
1776 bytes
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)
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Thu, 19 Nov 2026 08:22
Date: Thu, 19 Nov 2026 08:22
12 lines
1883 bytes
1883 bytes
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
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Thu, 19 Nov 2026 20:37
Date: Thu, 19 Nov 2026 20:37
20 lines
2131 bytes
2131 bytes
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?
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Thu, 19 Nov 2026 21:06
Date: Thu, 19 Nov 2026 21:06
57 lines
3965 bytes
3965 bytes
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)
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Thu, 19 Nov 2026 22:01
Date: Thu, 19 Nov 2026 22:01
62 lines
4300 bytes
4300 bytes
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.
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Thu, 19 Nov 2026 22:03
Date: Thu, 19 Nov 2026 22:03
70 lines
4619 bytes
4619 bytes
On 11/19/2026 2:01 PM, Chris M. Thomasson wrote: > 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. Depending on the buffer, one single model, can be in many places each with different scales, rotations, etc. Also, it works with models that have bones.
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Thu, 19 Nov 2026 22:11
Date: Thu, 19 Nov 2026 22:11
15 lines
1960 bytes
1960 bytes
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.
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Fri, 20 Nov 2026 05:57
Date: Fri, 20 Nov 2026 05:57
111 lines
4895 bytes
4895 bytes
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?
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Fri, 20 Nov 2026 08:23
Date: Fri, 20 Nov 2026 08:23
125 lines
5451 bytes
5451 bytes
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)
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Fri, 20 Nov 2026 08:28
Date: Fri, 20 Nov 2026 08:28
136 lines
6073 bytes
6073 bytes
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)
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Fri, 20 Nov 2026 08:33
Date: Fri, 20 Nov 2026 08:33
149 lines
6790 bytes
6790 bytes
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)
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Fri, 20 Nov 2026 08:42
Date: Fri, 20 Nov 2026 08:42
162 lines
7448 bytes
7448 bytes
fir pisze:
> 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)
computers are to slow now:
it is like you do some thing here and it cost 5-7 ms (say so)
if your frame budget it 15-20 ms (its more 15 ms as i need to put some
sleep for cpu not to run it 80%-100%) so you cant put to much
BUT IF cpu would be 10x faster then you can put much more of it
ad that would be a big difference
(probably more new cpu than mi old i3 are like twice faster
so at least if i buy some i will have some more space)
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Fri, 20 Nov 2026 23:04
Date: Fri, 20 Nov 2026 23:04
152 lines
7020 bytes
7020 bytes
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?
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Fri, 20 Nov 2026 23:07
Date: Fri, 20 Nov 2026 23:07
131 lines
5820 bytes
5820 bytes
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.
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Fri, 20 Nov 2026 23:41
Date: Fri, 20 Nov 2026 23:41
156 lines
7123 bytes
7123 bytes
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)
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Sat, 21 Nov 2026 00:23
Date: Sat, 21 Nov 2026 00:23
161 lines
7461 bytes
7461 bytes
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?
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Sat, 21 Nov 2026 00:47
Date: Sat, 21 Nov 2026 00:47
156 lines
7384 bytes
7384 bytes
On 11/20/2026 3:04 PM, Chris M. Thomasson wrote:
> 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?
One core on the CPU. Fine. Yes there is a way to multithread the CPU
side. Learning about a proper pipeline is good as well.
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Sat, 21 Nov 2026 01:37
Date: Sat, 21 Nov 2026 01:37
20 lines
2128 bytes
2128 bytes
On 11/19/2026 2:11 PM, Chris M. Thomasson wrote: > 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. For sheer inspiration! https://youtu.be/SIxi2uqFVmc?list=RDcRAmtrnOXWc
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Sat, 21 Nov 2026 07:14
Date: Sat, 21 Nov 2026 07:14
165 lines
7720 bytes
7720 bytes
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
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Sat, 21 Nov 2026 12:03
Date: Sat, 21 Nov 2026 12:03
64 lines
4315 bytes
4315 bytes
fir pisze: > 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) > > 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 need some rest though i maybe found some basic interesting ideas ..i will see after some rest
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Sat, 21 Nov 2026 19:20
Date: Sat, 21 Nov 2026 19:20
91 lines
4924 bytes
4924 bytes
fir pisze:
> fir pisze:
>> 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)
>>
>>
> 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
> 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)
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Sat, 21 Nov 2026 19:23
Date: Sat, 21 Nov 2026 19:23
98 lines
5185 bytes
5185 bytes
fir pisze:
> fir pisze:
>> fir pisze:
>>> 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)
>>>
>>>
>> 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 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
>
in case it is 3d it is kinda tedious tod ebug as you dont see easily
whole 3d space
> 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)
>
>
>
Re: [p.i.c] ships flyin and faitin
Author: Chris M. Thomasson
Date: Sat, 21 Nov 2026 22:36
Date: Sat, 21 Nov 2026 22:36
168 lines
7931 bytes
7931 bytes
On 11/20/2026 11:14 PM, fir wrote:
> 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
>
;^D
Re: [p.i.c] ships flyin and faitin
Author: fir
Date: Sun, 22 Nov 2026 05:07
Date: Sun, 22 Nov 2026 05:07
163 lines
7513 bytes
7513 bytes
fir pisze:
> 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)
>
>
i found a page that allows me upload executable ,
https://lord-fir.itch.io/
here it can be checked (its for win32 but is working in linux wine afaik)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads