Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Effect problem #125234
04/20/07 12:12
04/20/07 12:12
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
First a little introduction

I have a spaceship with laser and 3rd person camera.
Ship is rotating by:
c_rotate (me, vector(mose_hor *time_step,mouse_vert *time_step, 0), USE_AXISR);

moving by:
c_move(me,vector(my.speed *time_step *10,0,0),nullvector,GLIDE);

and targeting from player to ahead by:
temp.x = MOUSE_POS.x; temp.y = MOUSE_POS.y; temp.z = 1000;
vec_for_screen(temp,CAMERA); vec_set(my.x, temp); then trace.

Everything work very well and I have full freedom by moving ship in whole sphere with the mouse.

The problems are...
1. how to create effect (laser effect) with bmap using streak function and/or vel_x/y/z from player.pos to target.pos where this bmap is moving along this vector?!
I've tried with: vec_diff (along_vec,player.x,target.x) vec_add(my.vel_x,along_vec) but it doesn't work.

2. how to create good looking trail from player.x. I've tried create little sparkle.pcx in player.pos every while loop and then decrease the alpha, but the sparkles was separately. So i need streak in this case too, I think.

HELP!

Last edited by tompo; 04/20/07 12:21.

Never say never.
Re: Effect problem [Re: tompo] #125235
04/20/07 12:50
04/20/07 12:50
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
for the laser/shot: (note: you need com or pro version for this to work)

Code:


function delete_line()
{
my.alpha - = 2*time_step;
if(my.alpha < = 0)
{
my.lifespan = 0;
}
}

function draw_line_red()
{
my.bmap = red_line;
my.move = off;
my.streak = on;
my.alpha = 80;
my.bright = on;
my.transparent = on;
my.size = .75;
my.function = delete_line;
}

function draw_line_3d(&vec_from,&vec_to)
{
vec_diff(temp,vec_to,vec_from);
effect(draw_line_red,1vec_from,temp);
}




how to use:
draw_line_3d(my.x,target.x);

for the trail:
what i do is creating a particle every frame, with a random bitmap (either red or yellow). red ones are larger than yellow ones.
they all have a random, very slow velocity, so that the trail is not perfectly straight, but looks like fire burning or something along those lines.


Code:


function vec_randomize(&vec, Speed)
{
vec[0] = random(speed)- speed /2;
vec[1] = random(speed)- speed /2;
vec[2] = random(speed)- speed /2;
}




function thruster_fade()
{
my.alpha - = 20 *time_step;
my.size - = 1 *time_step;
if(my.alpha <= 0 || my.size <= 0)
{
my.lifespan = 0;
}
}


function thruster_particles()
{
my.lifespan = 100;
my.alpha = 50;
if(int(random(1)) == 1)
{
my.bmap = RedPart2;
my.size = 20 ;
}
else
{
my.bmap = yellow_part;
my.size = 10 ;
}
my.bright = on;
my.move = on;
my.transparent = on;
my.function = thruster_fade;
}



// in the ship's action, inside a while 1 loop:
vec_randomize(temp, 3 ;)
effect(thruster_particles,1,my.x,temp);




you can change all red values, I don't know how large your ship is/how long the trail should be... so fiddle around with some numbers.
please tell me if this works...
hope it does

Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: Effect problem [Re: tompo] #125236
04/20/07 12:52
04/20/07 12:52
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Why not use a model stretched from point A to B...?


xXxGuitar511
- Programmer
Re: Effect problem [Re: xXxGuitar511] #125237
04/20/07 13:12
04/20/07 13:12
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
I allready have a model from a to b by using this:
web page
but with bmaps and streak, vel_x it will looks much better I think like muzzle or something.

About trail... this is nice but this is like truster_engine and I'm intereesting in smooth looking and thin trails (two) created on wings edges. Like in almost all space games


Never say never.
Re: Effect problem [Re: tompo] #125238
04/20/07 13:24
04/20/07 13:24
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
no problem.
make the "3" a smaller number, instead of creating the effect at "my.x", create it at a vertex position, make my.size half as big, or even smaller (the 20 and the 10), and change:
my.alpha - = 20 *time_step;
my.size - = 1 *time_step;
into:
my.alpha - = 5 *time_step;
my.size - = .5 *time_step;
or something like that.

for creating the effect at 2 vertecies, change:
vec_randomize(temp, 3
effect(thruster_particles,1,my.x,temp);
to:
var temp_pos[3];
vec_randomize(temp, .2
vec_for_vertex(temp_pos,10)
effect(thruster_particles,1,temp_pos,temp);
vec_randomize(temp, .2
vec_for_vertex(temp_pos,20)
effect(thruster_particles,1,temp_pos,temp);

the 10 and 20 need to be the numbers of the vertecies you want the effect to be at: find those numbers in MED, by clicking selecting a vertex and looking at the bottom of the window, where it should give you the number.

does that work for you`?


~"I never let school interfere with my education"~
-Mark Twain
Re: Effect problem [Re: tompo] #125239
04/20/07 13:26
04/20/07 13:26
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
laser fire something like this:
laser
and I supposed that this bmap is moving along this vector

trails... look at this ships and his trails
trails
look at this ship in deph field (the turning one) and those beutifull smooth trails behind this ship towads to player position:D

thruster and trails
next one

Last edited by tompo; 04/20/07 23:41.

Never say never.
Re: Effect problem [Re: tompo] #125240
04/20/07 14:39
04/20/07 14:39
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
And.... hard nut to crack?!
I don't really use models becouse:
1. its impossible (I think) to make such trails with models
2. f.e. 20 (only 20) ships in battle with 3 trails models (1 for thruster and
2 on wings) and with 3 laser models = (3+3)*20 +20 = 140 models to calculate in one loop! Not to render ofcourse but number of running functions will kill frame_rate I'm affraid

Last edited by tompo; 04/20/07 14:58.

Never say never.
Re: Effect problem [Re: tompo] #125241
04/20/07 15:37
04/20/07 15:37
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
I'll try and create a demo with these 3 effects later on. I won't promise anything, these thrusters are pro effects, but I think I can get something along those lines. Stay tuned... I'll just finish watching Les Miserables, and then I'll get to work, these effects look great, and you got me interested in this

Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: Effect problem [Re: Germanunkol] #125242
04/20/07 15:52
04/20/07 15:52
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
These effects (thrusters and trials) are from old Microsofts game "Freelancer"
I've made something like this (laser and thruster) with flare.tga decresing alpha and size by time_step but I have a problem with streak and vel_x along vec_diff(player.pos,target.pos).
But I have no idea how to create these trials with bmp and streak or vel_x along player move vector becouse I have full freedom to rotate around 360 degree


Never say never.
Re: Effect problem [Re: tompo] #125243
04/21/07 00:13
04/21/07 00:13
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
I've made something like this:

in player loop
Code:
 
a = cos(player.pan); b= sin(player.pan); c= sin(player.tilt);
effect(dummy_funkcja,1,my.pos,vector(a,b,c)); //the same direction as player



dummy_funkcja

Code:
 
my.bmap = wstega; //image above
my.passable = on; my.transparent = on; my.overlay = on;
my.alpha = random(30); my.flare = on;
my.size = random(1); my.bright = on;
my.move = on; my.streak = on; my.beam = on;
vec_add(my.vel_x,vector(a *2, b *2, c *2)); //to increase speed or with -2 to change dierection
my.function = dummy_f;



dummy_f
Code:

my.size = clamp(my.size,0,1);
my.size -= 0.1 * time_step;
my.alpha -= 0.1* time_step;
if(my.alpha <=0){my.lifespan = 0;}



Everything looks fine until ship is not moving. When I increase speed by c_move function spaces between bmps just split/spread/separate (my english)

If ship is not moving...
- increase speed, set +n in vel_x, increase lifespan and we'll have good lookin laser.
- decrease size, set -n in vel_x, set size and alpha to not random and we'll have nice trails towards to player.

Any sugestions?

Last edited by tompo; 04/21/07 00:17.

Never say never.
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1