Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
why is this texture swap code hitting frame rate so hard? #282100
07/30/09 11:49
07/30/09 11:49
Joined: Nov 2008
Posts: 215
V
vertex Offline OP
Member
vertex  Offline OP
Member
V

Joined: Nov 2008
Posts: 215
This is c-script code to make characters blink/swap one of two textures a small percentage of time. It's hitting frame rate hard by increasing the milliseconds of "functions" displayed on F11 during game play. I think it's making another huge hit even when taken out because all of the characters that utilize it need two instead of 1 map. Not sure about that though-- need more testing.

It is called within a while loop within another script that rotates the standing npcs to view the player. Help appreciated.


function blink()//called in viewPlayer
{
var blink;
while(1)
{
blink = random(100);

if(blink <= 98)
{
my.skin = 1;
}

else
{
my.skin = 2;

}
wait (1);

}
}


Last edited by vertex; 07/30/09 11:50. Reason: changed old comment to refer to proper function
Re: why is this texture swap code hitting frame rate so hard? [Re: vertex] #282103
07/30/09 11:53
07/30/09 11:53
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
If it's called from within another while loop, you shouldn't have a while loop in that function smile

Code:
function blink()//called in viewPlayer 
{
	var blink;
	blink = random(100);
	
	if(blink <= 98) 
	{
		my.skin = 1;
	}
	else
	{
		my.skin = 2;
	}
}



Re: why is this texture swap code hitting frame rate so hard? [Re: Claus_N] #282113
07/30/09 12:31
07/30/09 12:31
Joined: Nov 2008
Posts: 215
V
vertex Offline OP
Member
vertex  Offline OP
Member
V

Joined: Nov 2008
Posts: 215
Right after I sent that I started thinking about that issue but was going to test it by getting rid of blink.wdl moving the blink function code to operate within view player function. That probably would work, but could have been a big can of worms; removing a while(1) loop in blink was a lot easier.

Thanks again, Clause.

The effect has virtually no impact on frame rate now.

So folks there with the help of Clause_n is some fast texture swapping blink code to use.

It's funny how blinking eyes can bring somewhat static characters to life.

Re: why is this texture swap code hitting frame rate so hard? [Re: Claus_N] #282116
07/30/09 12:35
07/30/09 12:35
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try this. (I am assuming the function is set running once and left running, thats what your current code does)
Code:
function blink()  //called ONCE in viewPlayer (assumes ME = player-entity)
{
    my.skin = 1;
    while(me) 
    {
       my.skin = 2;
       wait(-0.5);  //eye closed for half a second
       my.skin = 1;
       var next_blink = 5 + random(5);  //blink somewhere between 5 to 10 seconds
       wait(-next_blink);
    }
}



[EDIT}missed your last post, Oh well....


Last edited by EvilSOB; 07/30/09 12:36.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

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