Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by EvanTJ. 11/28/26 18:19
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
3 registered members (Quad, EvanTJ, AndrewAMD), 4,218 guests, and 2 spiders.
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 2 of 3 1 2 3
Re: Number of functions affect fps? [Re: sivan] #421371
04/16/13 09:51
04/16/13 09:51
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: sivan
very true words!
I have not known this is because of wait(), but [...] it really does matter!

This isn't really surprising. JCL was so kind to share some more insight about wait a few months ago: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=410383#Post410383

They way wait() works is inherently counter productive for any modern processor, aside from the fact that it might have to copy a non trivial amount of data. The real pain is the jumping around, while in theory it's not that bad to use a jump (or function call), it is bad if the CPU can't predict it. CPUs like to use otherwise unused time trying to predict the future, which is a little bit of black magic vodoo, a lot of caching, and juggling with heuristics. I have briefly mentioned this in my last blogpost, and there is a famous StackOverflow question about this very thing.

The problem is, executing your actual function might not even take long, in fact, it's probably incredibly fast. A vec_dist() here, some more math there, peanuts for a modern CPU. But the real killer is the jump that has to be done in and out of your function, the CPU is unable to predict the target and thus when the jump occurs, it has to empty more or less the complete cache. Cache misses are incredibly expensive, and working with a cold cache for most of the time is a horrible performance killer.


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] #421477
04/18/13 00:47
04/18/13 00:47
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 everyone for all your input - Number of functions running is now 144. I just removed the functions altogether. I dont need animated flowers tongue


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

Joined: Apr 2007
Posts: 3,751
Canada
You can use a shader for these kinds of things.


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] #421479
04/18/13 06:58
04/18/13 06:58
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
...I thought you are making a gardener game where it is important grin


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Number of functions affect fps? [Re: sivan] #421482
04/18/13 08:22
04/18/13 08:22
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Or you animate all flowers with a single function as suggested multiple times before.


"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] #421530
04/18/13 22:13
04/18/13 22:13
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 am using wdl, so void doesnt work wink
But like I said, I don't need animated flowers tongue
I'm accually working on a lookdown style game, and although it does look
good with animated flowers, its not needed if it means I can add different kinds of effects instead.


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

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
What? This is independent of lite-C and wdl.
ENTITY* ent_flowers[500];
Fill array on level load, then iterate over array and execute your flower function or even integrate its content in the loop (you can even use handles if you are more comfortable using them).


"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] #421532
04/18/13 23:40
04/18/13 23:40
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 know your spoon-feeding me how to do this, but I still dont understand. can you please elaborate, superku?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Number of functions affect fps? [Re: DLively] #421619
04/21/13 16:34
04/21/13 16:34
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 wanted to Note that my FPS went back to 60-66 FPS when I disabled my secondary monitor - I think. That seems to help anyway.


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

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
In lite-C it could look as follows, should be almost the same with C-Script:

Code:
var flower_num = 0; //reset this variable before level_load

action flower()
{
ent_flowers[flower_num] = me; // fill the array on level initialization
flower_num++;
... // some settings such as PASSABLE but no while
}

void flower_animate(ENTITY* ent)
{
ent.skill20 += 3*time_step;
ent.skill20 %= 100;
ent_animate(ent,"wobble",ent.skill20,ANM_CYCLE);
}

void flower_handle() //
{
while(1)
{
for(i = 0; i < flower_num; i++) flower_animate(ent_flowers[i]);
wait(1);
}
}



Alternatively you can write the content of flower_animate into the for loop in flower_handle.


"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
Page 2 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