Jump to content

  • Log In with Google      Sign In   
  • Create Account

too_many_stars

Member Since 29 May 2013
Offline Last Active May 10 2016 01:48 AM

Posts I've Made

In Topic: call to new SomeClass() in func parameter

19 February 2016 - 05:05 PM

One more question that I have been wondering about.

 

Are there any practical differences between this...

void func(){
 ents.push_back(new Ent());
}

and this

void func(){
 Ent *ent=new Ent();
 ents.push_back(new Ent());

}

if in the destructor we delete all ents?

 

Thanks,

 

Mike


In Topic: call to new SomeClass() in func parameter

19 February 2016 - 03:57 PM

Thanks a bunch Josh. I will try that out.

 

Mike


In Topic: call to new SomeClass() in func parameter

19 February 2016 - 03:35 PM

Thanks again for the greatly detailed (and invaluble) response Josh.

 

I did think of using your method, for example Entity* MyClass::addEnt(), but then I considered the following problem.

class MyClass{
std::vector<Ents*> ents;

~MyClass(){
 for(auto it=ents.begin();it!=ents.end();it++)
 delete *it;
}

void addApple();
void addPear();
void addCucumber();
void add...
void addZuchini();


};

This is not my problem, just a hypothetical  one. .

 

How does one avoid bloating the functions? For example we have 200 different types of entities (just a hypothetical) is there a way to avoid 200 void addSomethings()?

 

Thanks,

 

Mike


In Topic: squad implementation

20 January 2016 - 10:19 PM

Thanks for the links guys, I will check them out.

 

I have two AI books. Mat Buckland's Programming Ai by example and Artificial intelligence for games by Ian Millington. I know it's only scratching the surface but we all have to start somewhere.

 

Mike


In Topic: squad implementation

20 January 2016 - 09:53 AM

Thanks for the reply guys,

 

Please keep in mind this is my first attempt at this sort of thing, so if my ideas sound crazy or unhinged, I apoligize.

 

What sorts of things do you want this squad to do?

 

I want to start with something simple. An enum perhaps with "orders" such as "FIND_COVER", "ADVANCE_FORWARD", and "RETREAT". I would like for this to be set through the squad leader through a function such as void setOrder(unsigned int order_type); which would then be relayed to the grunts, and they would act accordingly.

 

 

What are the design requirements for how squad members should behave?

 

These are simple. A pointer to a path manager class, A pointer to a steering behaviour class, and a pointer to a state machine/goal oriented architecture. The order given by the leader should route through say the grunts finite state machine class to turn on/off "arrive" or "flee" or whatever among other things.

 

What kinds of challenges do you foresee?

 

This is the tough one. Efficient communication between the squad leader and the grunts. I need the squad to act in unison. I may need tiered Ai where the squad has a state, along with every member. For example, a squad state might have to rotate 90 degrees, but each squad member is still in a state called "looking for cover."

 

I must say, I have never heard of this "blackboard" method (among many other things). Could you guys explain it to me or give me some useful links?

 

Thanks,

 

Mike


PARTNERS