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 3 of 3 1 2 3
Re: Number of functions affect fps? [Re: Superku] #421650
04/22/13 01:06
04/22/13 01:06
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 3run for the initial information, first of all.

and Thank you very much Superku, for writing it out in a fashion that I can sorta understand.. tongue I am going to try it our right away.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: Superku] #421651
04/22/13 01:32
04/22/13 01:32
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
just to be clear, incase im wrong, while i try to work this out, let me know if correct on this:

for(i = 0; i < flower_num; i++) flower_animate(ent_flowers[i]);

i dont think c-script uses for - but I think I can do this with a while loop, correct?


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

Joined: Apr 2007
Posts: 3,751
Canada
Disclaimer: My answer is for Lite-C!

The thing is, calling functions is expensive, you can tweak Superkus version a tiny bit by either inlining flower_animate() or by making flower_animate loop over the ENTITYs. And because we all love premature optimization, we can also do another thing: Since [] is just a substitution for the plus operator, we can take advantage of that by simply taking the pointer to the first flower entity and just incrementing it, thus maximizing cache hits on some older CPUs:

Code:
ENTITY *flowers[1024];
int numFlowers = 0;

action flower()
{
	flowers[numFlowers ++] = me;
}

void flower_animate()
{
	ENTITY *ent = *flowers;
	ENTITY *lastFlower = ent + numFlowers;
	
	while(ent < lastFlower)
	{
		ent->skill20 = (ent->skill20 + 3 * time_step) % 100;
		ent_animate(ent, "wobble", ent->skill20, ANM_CYCLE);

		ent ++;
	}
}



Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Number of functions affect fps? [Re: WretchedSid] #421653
04/22/13 02:12
04/22/13 02:12
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
what is ++ exactly?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: DLively] #421654
04/22/13 02:41
04/22/13 02:41
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
im just going to use a shader tongue because I can't store arrays in entities with c-script..


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: DLively] #421655
04/22/13 02:52
04/22/13 02:52
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
"++" simply increments the variable by 1.

You have var arrays, thus you can store the pointers in them and proceed as follows:

var ent_flowers[100];

ent_flowers[i] = ent_create(...);
...
you = (ENTITY*)ent_flowers[i];

Alternatively, as I've stated before (!), you can use handles if you don't want to use pointer arrays (but that's a worse and slower approach).


"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] #421656
04/22/13 07:02
04/22/13 07:02
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
just another hint:
I found earlier a speed increasing possibility, when you have many-many similar vertex animated models: use the same animation percentage value, i.e. use a global variable for it. significant difference can be sensed. someone could explain me why, because I don't know laugh


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Number of functions affect fps? [Re: sivan] #421657
04/22/13 07:36
04/22/13 07:36
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: sivan
someone could explain me why, because I don't know laugh

It's because the Engine doesn't have to send new data to the GPU for every model rendered but can re-use the old data from the previous draw call.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Number of functions affect fps? [Re: WretchedSid] #421674
04/22/13 19:51
04/22/13 19:51
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
a return(); wouldnt act the same way, right? if i was to have it set up to start the function and then repeat it without a 'loop'?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: WretchedSid] #421689
04/23/13 07:06
04/23/13 07:06
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
Originally Posted By: JustSid
It's because the Engine doesn't have to send new data to the GPU for every model rendered but can re-use the old data from the previous draw call.

thanks. poor man's instancing? laugh


Free world editor for 3D Gamestudio: MapBuilder Editor
Page 3 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