Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Weird effect with spline function [Re: exile] #449961
04/04/15 00:48
04/04/15 00:48
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
Update: Confirmed, it is a clipping issue. Now comes another question. More than likely its related to clipping because the entity, regardless of where it is, still has a position of (0,0,0). To confirm this I added a few debug vars and sure enough the entity's "x,y,z" position was 0,0,0. The question now becomes how can I work around this? Any ideas? Just so you know, I am not looking for specific code, just some ideas. if you have code you wanna share I will always welcome it, but I don't wanna put you guys through that if it can be avoided lol.

Re: Weird effect with spline function [Re: exile] #449962
04/04/15 01:23
04/04/15 01:23
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
try clipfactor then, as alibaba said laugh setting that value to 999999 should keep the entity from being clipped.

////

Code:
action my_unclipped_ent()
{
  my.clipfactor = 999999; // never clip this entity
  ...
}



also, pressing ctrl+f in the online manual will bring up a search bar for you laugh

Last edited by DLively; 04/04/15 01:24.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Weird effect with spline function [Re: DLively] #449963
04/04/15 01:43
04/04/15 01:43

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
also, pressing ctrl+f in the online manual will bring up a search bar for you laugh


Thank you!!!

Re: Weird effect with spline function [Re: ] #449968
04/04/15 08:34
04/04/15 08:34
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
exile@ just off the topic, related to the code you've posted in the first post. I'm not trying to be a smart ass, but make sure that you delete/reset (ent_remove and pointer = NULL) those 'afterimage' and 'cloner' entity pointers in 'trail' action. Maybe you just simplified the code, for us to read more ealisy, I don't know.


My best regards (btw keep your awesome multiplayer game up! laugh )

Edit: BTW, try this code, I tried to make smoke effect with particles, and it works pretty good, but it needs to be framerate independent... I tried what manual said, but it doesn't work for me:
Quote:
For keeping the particle number independent of the frame rate on continuous particle generation, multiply the number of generated particles with time_step (see example).


Just run it, press ENTER and you'll see how how the number of particles goes up.
Code:
// fade smoke away:
function fadeSmokeTrailPar(PARTICLE* p){
	// decrease alpha:
	p.alpha -= p.skill_x * time_step;
	// if we don't have alpha, kill particle:
	if(p.alpha <= 0){ p.lifespan = 0; }
}

// smoke trail particle:
function smokeTrailPar(PARTICLE* p){
	// set color to white:
	vec_set(p.blue, COLOR_GREY);
	// set size:
	p.size = 4;
	// set gravity:
	p.gravity = -0.4;
	// set alpha:
	p.alpha = 30;
	// set fading speed:
	p.skill_x = 1;
	// set flags:
	set(p, MOVE | BRIGHT | BEAM | TRANSLUCENT);
	// set event:
	p.event = fadeSmokeTrailPar;
}

// main function:
void main(){
	// set framerate limit:
	fps_max = 500;
	// empty level:
	level_load("");
	// wait 3 frames:
	wait(3);
	// set camera positions/angles:
	vec_set(camera.x, vector(-140, 0, 90));
	vec_set(camera.pan, vector(0, -13, 0));
	// vectors:
	VECTOR vectexVec;
	// reset vectors:
	vec_fill(vectexVec.x, 0);
	// create smoke emmiter:
	ENTITY* smokeEnt = ent_create(CUBE_MDL, vector(200, 0, 0), NULL);
	// scale it down:
	vec_fill(smokeEnt.scale_x, 0.35);
	// set it's flags:
	set(smokeEnt, PASSABLE | TRANSLUCENT);
	// save position:
	vec_set(smokeEnt.skill1, smokeEnt.x);
	// loop:
	while(1){
		// reset framerate limit:
		fps_max = 500;
		// if ENTER is pressed:
		if(key_enter){
			// decrease framerate limit:
			fps_max = 60;
		}
		// show framerate:
		DEBUG_VAR(fps_max, 30);
		DEBUG_VAR(num_particles, 50);
		// show text:
		draw_text("PRESS <ENTER> TO LOWER FRAMERATE!", 10, 10, COLOR_WHITE);
		// rotate smoke emitter:
		smokeEnt.pan = cycle(smokeEnt.pan + 30 * time_step, 0, 360);
		// move it:
		smokeEnt.z = smokeEnt.skill3 + fsin(total_ticks * 8, 64);
		smokeEnt.y = smokeEnt.skill2 + fcos(total_ticks * 8, 64);
		// get position of upper left vertex:
		vec_for_vertex(vectexVec.x, smokeEnt, 3);
		// create smoke trail with particles:
		effect(smokeTrailPar, maxv(1, 40 * time_step), vectexVec.x, nullvector);
		// wait one frame:
		wait(1);
	}
}



Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Weird effect with spline function [Re: 3run] #449996
04/04/15 13:47
04/04/15 13:47
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
@3run
Yea, I thought of doing it like that too and ran into the same problem. I then tried to do it where it would calculate where you were one frame ago versus where you were in the current frame, then draw a particle line between the two positions. Unfortunately it was really slow and didn't work out too well. As your movement speed gets closer to the framerate you start to notice bigger and bigger "gaps" between the particles. You would need something to "connect" the particles or iterate the distance traveled. Also, yes, those pointers were made to make reading the code a bit easier.

@alibaba and DLively
Unfortunately setting my.clipfactor to 999999 completely blacks out my screen (sorting error). Can still walk around and stuff but no objects will render on the screen. If I set ot to a relative small number, like 1000, it works.

@all
Ok so I think I know what it is now. When the afterimage is first made the first model is generated really huge, which affects the clipping/sorting system.

Page 2 of 2 1 2

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

Gamestudio download | 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