Crystal Space
Welcome, Guest. Please login or register.
November 26, 2014, 01:56:34 pm

Login with username, password and session length
Search:     Advanced search
9026 Posts in 2046 Topics by 9137 Members
Latest Member: Matouwski
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Game Content Creation
| | |-+  need some help with aggro
« previous next »
Pages: 1 [2] Print
Author Topic: need some help with aggro  (Read 11033 times)
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #15 on: August 06, 2007, 10:53:33 pm »

Sad Now the only problem is

Quote
if (cdsys->Collide(cd1, &trans1, cd2, &trans1))
                        csPrintf("hit!");

CHEWS up the frame rate. It doesn't matter if I check every frame or with each step. I'd like to have this kind of real time check for all the enemies in a level.

I'm not sure if I can place this check anywhere else to boost performance??
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #16 on: August 07, 2007, 05:17:39 am »

There is no reason that that should eat up framerate. That function is called constantly in many CS apps to collide the actor/player against the world. Are you very sure that that is the function that eats your framerate? Did you try to use a profiler?

Greetings,
Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #17 on: August 07, 2007, 03:24:12 pm »

Quote
That function is called constantly in many CS apps to collide the actor/player against the world.

Yeah, that's what I figured. I'm positive that this is the function causing the slow down. If I comment it out, framerate goes back up to normal. I haven't used a profiler, it just got noticeably choppy when I tried to check CD using the ->Collide function. I even tried making a second CD System just for 'aggro CD' but that too was just as choppy. I call a Handle function that gets processed each frame. It is within that Handle function that I check for CD, I also tried to do each for each step the player took forward but both had the same result.
Logged
genjix
Jr. Member
**
Posts: 53


View Profile
« Reply #18 on: October 07, 2007, 04:27:22 pm »

Sad Now the only problem is

Quote
if (cdsys->Collide(cd1, &trans1, cd2, &trans1))
                        csPrintf("hit!");

CHEWS up the frame rate. It doesn't matter if I check every frame or with each step. I'd like to have this kind of real time check for all the enemies in a level.

I'm not sure if I can place this check anywhere else to boost performance??

Maybe check if thats getting like called a thousand times per frame or something?

http://www.csulb.edu/~tstevens/b-anger.htm
Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #19 on: October 13, 2007, 11:42:15 pm »

Quote
Maybe check if thats getting like called a thousand times per frame or something?

Hmm, good idea. I'll test it out.

Thanks!

EDIT - Well it was only being processed once per frame but it still was chewing up the frame rate.
However, this does not:
Code:
// Aggro for level 1
if (activeLevel == "Map1")
{
csReversibleTransform trans1 = hero->GetMovable()->GetFullTransform();
csReversibleTransform trans2 = aggro1->GetMovable()->GetFullTransform();

csRef <csColliderWrapper> hero_collider_wrapper =
csColliderWrapper::GetColliderWrapper (hero_object);

if(hero_collider_wrapper->Collide(col_aggro1, &trans1, &trans2))
{
//Print("aggro collide");
engine->RemoveObject(col_aggro1);
}

}

This is the quick and dirty to say collide with an untextured spherical mesh, attached to a parent mesh (enemy) with accurate per-polygon collision detection. Once the sphere is collided, I remove it and tell the enemy to start attacking me.

Thanks for all the help Smiley
« Last Edit: October 17, 2007, 10:32:09 pm by Panch » Logged
Pages: 1 [2] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.168 seconds with 17 queries.