Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 7th_zorro), 1,285 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
skills and frames per secs #182791
02/08/08 19:48
02/08/08 19:48
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
I have a player and an enemy action. Both are using the same skills(with different values...all in all 75 entity-skills!). now if I have 1-3 enemies at the same time, things are alright (function time per frame = 1.2). When I increase the enemy number to over 5...I get serious fps problems (function time per frame 20.00!).

I'm probable making some bad beginer mistakes in script design...can someone give me a clue of what I should take care of?

Thanks

Re: skills and frames per secs [Re: Loopix] #182792
02/08/08 20:08
02/08/08 20:08
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
there was a realy big list of things to avoid fps drop

the main stuff was as low ass possable

while loops
if()
hihg poly models
bone animation
c_updatehull //realy dont call this every less then sec
c_traces //keep trace distence als short ass posible
c_scan //same reasons

question where is the most fps drop
fnc
ent
geo
phy
enz.


"empty"
Re: skills and frames per secs [Re: flits] #182793
02/08/08 20:22
02/08/08 20:22
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hello,

20ms for code execution is indeed inordinately high.

You can rule out that the entity skills are responsible for your low FPS.

Perhaps you are calling slow commands in loops with many iterations per frame.
However, without knowing the code it is hardly possible to give a precise answer.

Re: skills and frames per secs [Re: flits] #182794
02/08/08 20:27
02/08/08 20:27
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Well...it's definately not a c_... problem. Everything seems alright exept from the function execution time with an increasing number of entities....can this be due to the amount of skills? Should I better use different skills for both the enemy action and the player action?

The enemy action looks like this:
Code:

action act_enemy_fight
{
ent_enemy = my;

wait(5);//this is needed to have a valid "you" pointer when using the enemy generator

if(my.use_entity_type_settings == on){
entity_type_settings();
}
else{
////set default values
if(my.entity_type_id == 0){my.entity_type_id = 1;}//0 is reserved for player entity
if(my.initial_health == 0){my.initial_health = 100;}
if(my.do_damage_factor == 0){my.do_damage_factor = 0.5;}
if(my.attack_range == 0){my.attack_range = 400;}
if(my.close_attack_dist == 0){my.close_attack_dist = 50;}
if(my.attack_push_force == 0){my.attack_push_force = 5;}

if(my.attack_seeze_sleep == 0){my.attack_seeze_sleep = 0.3;}
if(my.attack_seeze_random_sleep == 0){my.attack_seeze_random_sleep = 0.4;}

if(!my.entity_move_speed){my.entity_move_speed = 4;}

if(!my.norm_state_move_ai){my.norm_state_move_ai = 1;}

if(!my.entity_walk_run_animspeed){my.entity_walk_run_animspeed = 8;}
if(!my.entity_attack_hurt_animspeed){my.entity_attack_hurt_animspeed = 8;}
if(!my.entity_stand_idle_animspeed){my.entity_stand_idle_animspeed = 5;}
if(!my.entity_crouch_jump_animspeed){my.entity_crouch_jump_animspeed = 6;}
if(!my.entity_death_animspeed){my.entity_death_animspeed = 7;}

if(my.path_start_node_f == 0){my.path_start_node_f = 1;}
my.path_number_f = 001;

my.entity_reusable_weapons = on;
my.allow_weapon_pickup = on;

my.use_tilt_f = 0;
my.use_roll_f = 0;
}


////flag/skill settings to start with
my.weapon_do_damage_factor = 0;
my.health = my.initial_health;
my.is_attacking = off;
my.is_under_attack = off;
my.has_path = 0;
my.rh_weapon = off;
my.lh_weapon = off;


////show healthbar for boss enemies or normal enemies (above head)
if(my.health_bar_type > 0){

if(my.health_bar_type == health_bar_boss_type){
health_bar_boss();
}
if(my.health_bar_type == health_bar_above_head_type){
ent_create (bmp_health_bar_seg, my.pos, health_bar_above_head);
}
}

my.passable = off;

////collision hull stuff
// my.fat = on;
// my.narrow = off;
c_setminmax(me);
wait(1);
// my.polygon = on;

////enable events
my.enable_scan = on;
my.event = enemy_search_event_fight;

entity_initial_weapons();

while(my && my.health > 0)
{
handle_animation(my,1);

////if player exists
if(player != null)
{
////if player is alive
if(player.health > 0)
{
////if player is in range
if(vec_dist(my.x,player.x) < my.attack_range)
{
randomize();
var attack_mode;
attack_mode = int(random(2))+1;
////if is in attack range...and not not in event (being hit)
if(vec_dist(my.x,player.x) < my.close_attack_dist)
{

//look at player
vec_set(temp,player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);
my.tilt = 0;

if(my.is_attacking == off && my.is_under_attack == off){// && player.is_attacking == off

////perform the attack
if(attack_mode == 1){

enemy_attack_a();
}
if(attack_mode == 2){
enemy_attack_b();
}
}
}
else{

avoid_obstacle(player.x);

////play run animation...
if (my.f_animblend != f_run)//if our current animation is not the one we want...
{
my.f_blendframe = f_run;
}

my.speed_x = (my.entity_move_speed * 1.6) * time_step;
}

}
else
{
////different move ai options when out of attack_range (selectable trough skill15)
if(my.norm_state_move_ai == stand_ai){

if (my.f_animblend != f_stand)//if our current animation is not the one we want...
{
my.f_blendframe = f_stand;
}
my.speed_x = 0;
}
if(my.norm_state_move_ai == free_walk_ai){

avoid_obstacle(player.x);

if (my.f_animblend != f_walk)//if our current animation is not the one we want...
{
my.f_blendframe = f_walk;
}
my.speed_x = my.entity_move_speed * time_step;
}
if(my.norm_state_move_ai == use_path_ai){
if (my.f_animblend != f_walk)//if our current animation is not the one we want...
{
my.f_blendframe = f_walk;
}
my.speed_x = my.entity_move_speed * time_step;

walk_path();
}
}
}
else{
////switch to stand animation when player is dead
if (my.f_animblend != f_stand)//if our current animation is not the one we want...
{
my.f_blendframe = f_stand;
}
}
}

////do not float in the air!
attach_to_ground();

////perform movement
move_friction = 0.1;
c_move(my,vector(my.speed_x,my.speed_y,0),vector(my.pushback_speed_x,my.pushback_speed_y,my.speed_z),ignore_passable + ignore_passents + ignore_me + glide);

////clear movement vector...ready for next frame
vec_set(my.speed_x,nullvector);
vec_set(my.pushback_speed_x,nullvector);

wait(1);
}

////reset event/triggers
my.enable_scan = off;
my.event = null;

snd_play(aah_wav,40,0);

wait(1);

////play death
my.skill50 = 0;
while(my.skill50 < 100){
ent_animate(my,"die",my.skill50,0);
my.skill50 += my.entity_death_animspeed * time_step;
wait(1);
}
////clear movement vector...ready for next frame
vec_set(my.speed_x,nullvector);

my.alpha = 100;
my.transparent = on;
while(my.alpha > 0)
{
my.alpha -= time_step;

if(my.alpha < 90){
my.passable = on;
}

wait(1);
}
boss_health_bar.visible = off;
ent_remove(me);
me = null;
dead_enemies += 1;
num_enemies -= 1;
if(dead_enemies == 5)
{
wait(-2);
// exit;
}
}



Re: skills and frames per secs [Re: Loopix] #182795
02/08/08 21:05
02/08/08 21:05
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
The amount of used entity skills does not matter. They don't have an impact on the FPS.

At a first glance nothing in your code should cause such a slow code execution.

Perhaps the slowdown is caused by one of the functions which are called in your code (avoid_obstacle, attach_to_ground, handle_animation etc).
You could comment out these function calls one by one to track down the troublemaker.
Well, I hope this helps!

Re: skills and frames per secs [Re: Fenriswolf] #182796
02/08/08 21:36
02/08/08 21:36
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Hey...it was indeed the attach_to_ground function. Thanks for pointing me to that


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