Set the seed at game startup and then dont change it, unless you have a specific need for it... which you probably dont.
When I don't seed the different enemies' RNG values each time they move, they all move in the same directions at each loop iteration. I seed with the index variable so each seed number is different and each of them moves at a different time in a different direction.
I don't know what you mean by number of messages, or even what you mean by messages.
If I set the seed for each of the enemies, I think that would be good for eliminating the need for the second parameter though. This seems like a pretty dead simple solution.
It sounds like you're doing something wrong. If you seed the RNG once at startup, then every number you get after that from the rand() function will be pseudorandom. In other words, any character that uses it to determine their movement should move in a different direction.
Maybe you can include some code so we can see what you're doing.
By "messages" I mean something like this:
enum MESSAGE
{
MSG_DO_SOMETHING,
MSG_DO_SOMETHING_ELSE,
};
class ENEMY
{
public:
virtual void move(void){}
virtual void handle_message(MESSAGE msg) = 0;
}
class RED : public ENEMY
{
public:
virtual void move(void);
virtual void handle_message(MESSAGE msg)
{
if(msg == MSG_DO_SOMETHING)
{
do_something();
}
}
private:
void do_something(void);
}
class BLUE : public ENEMY
{
public:
virtual void move(void);
virtual void handle_message(MESSAGE msg)
{
if(msg == MSG_DO_SOMETHING_ELSE)
{
do_something_else();
}
}
private:
void do_something_else(void);
}
This method has its problems, but it's also an easy thing to implement if you want to call different functionality in your derived class objects through a pointer to their base class.