Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by JeyKey II. 11/29/26 10:01
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (JeyKey II, EvanTJ), 8,242 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Number of functions affect fps? #421287
04/14/13 23:54
04/14/13 23:54
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Hi everyone.

I have a simple question.
When I set an entities' flag to invisible, does the engine still process its faces?

Or in other words.. If I have 100's of models adding up to 10k+ polys but not all seen on the screen at the same time. If I set them to invisible when they are not in the cameras view does that help anything?

Thanks.

Last edited by DevoN; 04/15/13 18:06.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Invisible flag [Re: DLively] #421289
04/15/13 01:40
04/15/13 01:40
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
No. When they are not inside the view frustrum they don't get culled anyways. So setting the INVISIBLE flag won't make them any more invisible than they already are. Chances are pretty high you make the situation even worse by optimizations of this kind.


Always learn from history, to be sure you make the same mistakes again...
Number of functions affect fps? [Re: Uhrwerk] #421334
04/15/13 18:05
04/15/13 18:05
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
thank you Uhrwerk.

Another question, do the amount of functions i have running effect my fps rate? my fps idles at 66 and then drops to 50 for a moment every once and a while..

I have many animated flower models each sharing an action. I have 666 (I dont like that number as much as anyone else does) functions running in my 1 level so far.

is that not bad? terrible? average?

Thanks guys!
Love this forum tongue


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: DLively] #421337
04/15/13 18:31
04/15/13 18:31
Joined: May 2009
Posts: 5,378
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,378
Caucasus
Try to decrease that, it affects on the speed of course. F.e. use one loop, cycle throw all entities, find those animated flowers and stuff (use a skill for this, check it while cycling throw all entities via for loop), and animate with a single function. Plus, be aware to use loops correctly, so you don't call a function, which contains a loop, inside of the other loop f.e. that will lead that your number of functions will increase till you'll get crash/error or whatever.

Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Number of functions affect fps? [Re: 3run] #421339
04/15/13 18:47
04/15/13 18:47
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
DevonN, please keep in mind that optimization is a higly complex topic. Statements as "666 actions are too much / ok" are almost always nonsensical, because it's the context that is important. A screenshot with the debug panel on it is absolutely required to draw any conclusions. Why are you even caring about optimization when your game runs stable at 50 - 60 frames per second?


Always learn from history, to be sure you make the same mistakes again...
Re: Number of functions affect fps? [Re: Uhrwerk] #421342
04/15/13 19:30
04/15/13 19:30
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I did try to decrease it by altering the action a couple ways. I am only using 1 loop and cycling the animation at 100%.
On the other hand there are 2 if statements which check to see if the entity is on screen or not for LOD purposes.

The reason that optimization is important to me now, is because I dont want to get further into my project an realize that I could have saved memory somewhere. THis way my project is optimized perfectly from 1 - 100%

The reason my fps dropping from 66 - 50 is because I've created many projects before where my fps just dropped all of a sudden and never went back up.. ever. so the project was finished. I've wasted days trying to find a bug that isn't even findable it seems.. so now I take my time and make sure that my project is optimized all the time.

And how can you say it runs stable? it lags like you wouldnt beleive. why anyone want their project to do that, in a common area of the game? wink

Quote:

Statements as "666 actions are too much / ok" are almost always nonsensical, because it's the context that is important.


What do you mean by that?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: DLively] #421343
04/15/13 19:46
04/15/13 19:46
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: DevoN
The reason that optimization is important to me now, is because I dont want to get further into my project an realize that I could have saved memory somewhere. THis way my project is optimized perfectly from 1 - 100%

The reason optimization should be important to you is when there is an actual need for optimization. DON'T try to be smart about things and optimize anything that appears to be slow. If there is an actual performance bottleneck, track that down and optimize it (and do it by actually looking what is slow, not guessing).
KISS is the concept you would most likely want to follow.

Also, performance and saving memory are usually two contradicting things. You can speed an awful lot of things up by dedicating more memory to them, or you put some more work on the CPU and save memory in return.

Quote:
On the other hand there are 2 if statements which check to see if the entity is on screen or not for LOD purposes.

This sounds like you are potentially doing more work than you should do. If something isn't on the screen, it is either clipped during the frustum check or send to the GPU and then discarded (don't worry about sending a few thousand polygons to the GPU, the bus is extremely fast and the GPU won't waste any fragment processing on invisible polygons)


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Number of functions affect fps? [Re: DLively] #421344
04/15/13 19:46
04/15/13 19:46
Joined: May 2009
Posts: 5,378
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,378
Caucasus
Originally Posted By: DevoN
I did try to decrease it by altering the action a couple ways. I am only using 1 loop and cycling the animation at 100%.
I can't really understand this one..
Originally Posted By: DevoN
On the other hand there are 2 if statements which check to see if the entity is on screen or not for LOD purposes.
Can you explain this one as well? Why do you need to check, if entity on the screen or not?

My solution, to have one loop for 666 (more/less) flowers and stuff:
Code:
void animateEnt(ENTITY* ent, STRING* scene, spd){
	// change this skill here, if you use it somewhere else:
	ent.skill1 += spd * time_step;
	// animate the entity with a CYCLE (100 %):
	ent_animate(ent, scene, ent.skill1, ANM_CYCLE);
}

void actGrass(){
	// make me passable (speed up collusions):
	set(my, PASSABLE);
	// make me static (consume less memory and CPU resources):
	reset(my, DYNAMIC);
	// give me a unique value:
	my.skill99 = 999;
}

void main(){	
	// load level etc:	
	// main game loop:
	while(1){
		// cycle throw all entities:
		for(you = ent_next(NULL); you; you = ent_next(you)){
			// if we've found a vegetation:
			if(you.skill99 == 999){
				// animate it:
				animateEnt(you, "frame", 5);
			}
		}
		// wait one frame:
		wait(1);
	}
}

It's not tested, but should work (at least, it gives you an idea, of how it should work).


Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Number of functions affect fps? [Re: 3run] #421348
04/15/13 21:18
04/15/13 21:18
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
To answer your question in the most simple way: Yes, 600+ functions is a little too much as wait(1) is not as fast as one could assume, thus it's wasted resources which could easily be saved in this case. Optimization is important and the fact that your game may run above 50fps on YOUR machine is only a valid reason to not optimize your game when you have the worst (or one of the lowest) computer(s) the game is supposed to run on.
However, the question obviously is where and HOW to optimize your game. Setting entities INVISIBLE manually and esp. individually oftentimes only leads to a lower framerate (only try to disable the rendering of big regions, buildings, and the like).
You can safely use let's say 100 wait(1) loops (neglecting their content for now), but if you have f.i. 500 little insects or leafs or grass models in your level and should they need an action/ loop, use lists, arrays or something like 3run's approach and thus only one wait(1) loop for all those entities.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Number of functions affect fps? [Re: Superku] #421366
04/16/13 08:13
04/16/13 08:13
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
very true words!
I have not known this is because of wait(), but I just transformed my code (accidently finished 5 minutes ago) from actions into a loop cycling throughout my units, and calling the same update function based on similar suggestions (it requires some more data storage to keep them over updates, but neglectable), and I got +10fps as an average, but what is a more exact measure, function processing time dropped from 31ms to around 18ms! it really does matter! I used 980 moving/colliding/pathfinding/animated units.
I'll post my result in another thread, where I will say: thanks guys!


Free world editor for 3D Gamestudio: MapBuilder Editor
Page 1 of 3 1 2 3

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