Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Nymphodora), 1,592 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Weird effect with spline function #449828
04/01/15 07:36
04/01/15 07:36
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Hey guys,

I was working on changing the old "sword trail" code into something we could all use a bit easier, and for more than one intended purpose. I notice a really weird bug which makes the trail only viewable from selective angles. For example, if you were to move around the map while looking at the trail effect it will appear and disappear depending on how close/far you are from the center of the map. I am pretty sure its a pointer issue but I wanted someone to take a look to see if they have any solutions. Here is the code I am using, I am trying to keep the entire function as self contained as possible for future adaptation.

Click to reveal..

action trail()
{
ENTITY* afterimage = me;
set(afterimage,PASSABLE|BRIGHT|TRANSLUCENT);
afterimage.alpha=100;
ENTITY* cloner = ent_clone(afterimage);
vec_sub(afterimage.x,cloner.x);
while(afterimage.alpha>0)
{
afterimage.alpha-=time_frame*5;
wait(1);
}
ent_remove(afterimage);
}

void trail_ribbon(var vert1, var vert2, ENTITY* ent)
{
ent = me;
VECTOR trailpos1;
VECTOR trailpos2;
VECTOR trailpos3;
VECTOR trailpos4;
VECTOR oldpos;
ENTITY* trail1;
var sspeed = 0;
while(ent.active)
{
sspeed++;
if(sspeed%2==0)
{
trail1 = ent_create("trail1mdl.mdl",ent.x,trail);
vec_for_vertex(trailpos2,ent,vert1);
vec_for_vertex(trailpos1,ent,vert2);
vec_to_mesh(trailpos1,trail1,1);
vec_to_mesh(trailpos2,trail1,2);
vec_to_mesh(trailpos3,trail1,3);
vec_to_mesh(trailpos4,trail1,4);
vec_set(trailpos3,trailpos1);
vec_set(trailpos4,trailpos2);
vec_set(oldpos.x,ent.x);
wait(1);
trail1=NULL;
}
}
}


If anyone has any ideas let me know. If you want to know how I am implementing it, I am using multiple test environments with one being the most recent multiplayer tutorial from the AUM (for replication purposes).

Re: Weird effect with spline function [Re: exile] #449917
04/02/15 12:36
04/02/15 12:36
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan


On a side note I noticed something else. When this function is called the first model rendered looks like it is huge. When you run it try looking at it when youre at a good angle to see what I am describing. I will add pics later to highlight what i am referring to.

Re: Weird effect with spline function [Re: exile] #449941
04/03/15 13:40
04/03/15 13:40
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Quote:
it will appear and disappear depending on how close/far you are from the center of the map.


That sounds like a clip_far issue. Try increasing Clip far to a larger number.

Last edited by DLively; 04/03/15 15:26.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Weird effect with spline function [Re: DLively] #449950
04/03/15 18:41
04/03/15 18:41

M
Malice
Unregistered
Malice
Unregistered
M



@exile please package the models for testing and I have some errors trying to run the test script. "ent.active" unknown. There seems to be some code parts missing.

You provide a trail, and ribbon function, however a basic entity action and models to call all this would allow 'OTHERS" to run it.

I am using 3dgs free, however I wonder if this is better achieved with model particles and beam+streak effects. After all the old-old sword trail was written for the A5.

Re: Weird effect with spline function [Re: ] #449952
04/03/15 19:53
04/03/15 19:53
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Malice,

Hey thanks for the reply! You can actually just replace that with a while(my) if you want, its essentially doing the same thing. Here is a portable version of the code.

Click to reveal..

void trail()
{
set(my,PASSABLE|BRIGHT|TRANSLUCENT);
my.alpha=100;
ent_clone(me);
vec_sub(my.x,you.x);
while(my.alpha>0)
{
my.alpha-=time_frame*0.25;
wait(1);
}
ent_remove(me);
}

void trail_ribbon(var vert1, var vert2, ENTITY* ent)
{
ent = me;
VECTOR trailpos1;
VECTOR trailpos2;
VECTOR trailpos3;
VECTOR trailpos4;
ENTITY* trail1;
var sspeed = 0;
while(ent)
{
sspeed++;
if(sspeed%2==0)
{
trail1 = ent_create("trail1mdl.mdl",ent.x,trail);
vec_for_vertex(trailpos2,ent,vert1);
vec_for_vertex(trailpos1,ent,vert2);
vec_to_mesh(trailpos1,trail1,1);
vec_to_mesh(trailpos2,trail1,2);
vec_to_mesh(trailpos3,trail1,3);
vec_to_mesh(trailpos4,trail1,4);
vec_set(trailpos3,trailpos1);
vec_set(trailpos4,trailpos2);
wait(1);
trail1=NULL;
}
}
}


I am currently modifying the multiplayer code written by George and Superku to make it a bit more "visually appealing" for a bit of practive. I uploaded the stuff to my dropbox in case you want to download it.

https://www.dropbox.com/s/8ugywqd51sq89yt/mp_template_v0.1.zip?dl=0

The problem with using beam/streak effects is that, quite frankly, they look disgusting. As far as I am aware there isn't a way to get a "unified" or spline-like result which makes the trail look like its one singular "unit". Using particles, you will run into an issue where the trailing effect will look choppy based on the speed of the emitting entity. Which, as said earlier, looks gross lol. Here is a video showing the effect I am trying to achieve, minus the actual movement of the "smoke" or trail.

https://www.youtube.com/watch?v=vKAvvauNQ8M

Re: Weird effect with spline function [Re: exile] #449955
04/03/15 21:24
04/03/15 21:24
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Oh forgot, switch to the grenade (key_3) and left click to throw a grenade. the trail effect is connected to the grenade.

Re: Weird effect with spline function [Re: exile] #449956
04/03/15 22:37
04/03/15 22:37
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Sounds to me like a clipfactor problem.
Look into the manual about "clipfactor".
Sadly I can't help further since I'm on my phone right now.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Weird effect with spline function [Re: alibaba] #449957
04/03/15 22:45
04/03/15 22:45

M
Malice
Unregistered
Malice
Unregistered
M



@exile I can't test with the free version. However Alibaba seems on the case, so best luck.

Re: Weird effect with spline function [Re: ] #449959
04/04/15 00:34
04/04/15 00:34
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Quote:
Sounds to me like a clipfactor problem.


or clip_far!!! wink


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Weird effect with spline function [Re: DLively] #449960
04/04/15 00:37
04/04/15 00:37
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Guys,

Thanks for the tips! I figured it was something like that but I couldn't find the value I was looking for in the manual. It would be awesome if the manual had a better search function, like if you could use regex or something. I'll take a look at those values and get back with you on whether things improve. Thanks again.

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