enemy "clumping" problem

Heya. I have been making progress with GameSalad but I have come across an issue while trying to create a very basic artificial intelligence for my enemy actor class. Basically I have the start of a space shooter game and I created an enemy spawner that spawns enemies randomly every few seconds using the faux timer setup (mod1 > self.Time%x). I also just have a setup to where every second the enemy ship will rotate to the players position giving it a "chasing" effect. The problem is when I have spawned multiple instances of the enemy they tend to just catch up with each other and clump together. I'm curious to know if there is a way to use the magnitude function on instances of actors so they would know how close together they are from each other? So far my attempts to figure that out have failed...

Here is a quick video showing what is happening and what I want to avoid: [url]
Don't mind the "0" on the enemy ships.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I don't think there is any way to do that. You might get it to work by constraining a radius actor (e.g. a circle) to each enemy that is larger than the enemy and when a radius collides with another radius, move a different direction.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • pnolandpnoland Member Posts: 36
    I was considering something like that...I will have to give it a shot and see. Thanks!

    One thing I've setup to kind of help is that the ships will not chase you until your are a certain distance away but after a little while they end up in the same clumped formation. I suppose once I implement the enemy ship damage it won't be as bad when you are destroying them but if there are a lot of them in the scene it can be a little hectic with a massive clump chasing you haha
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    There are a few things you could do. For instance when enemy ships collide you could have them:
    1) bounce off of each other
    2) combine into a mega boss enemy
    3) spawn tiny hornet ships
    3) just blow up and disappear

    Each of these game mechanics will cause the player to create a different survival/win strategy.
  • pnolandpnoland Member Posts: 36
    Well I just went ahead and set it so the enemy actor collides with itself and it seems to work out pretty well. The ships go into a formation of sorts instead of overlapping with each other. Thanks! ...I do like the idea of combining into a mega boss though ;)
  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    There are a few things you could do. For instance when enemy ships collide you could have them:
    1) bounce off of each other
    2) combine into a mega boss enemy
    3) spawn tiny hornet ships
    3) just blow up and disappear

    Each of these game mechanics will cause the player to create a different survival/win strategy.


    I always think this is the best way of working with limitations within a game system, when presented with a coding issue that's causing issues . . . . dress it up in nice graphics and sound and make it a feature !
  • pnolandpnoland Member Posts: 36
    If it doesn't work throw sparkles at it! :D ...anyway. It would be pretty cool if we had access to the index of the instanced actors for purposes such as this. I think what I have now will work just fine though since I'm not doing anything really advanced just basic AI.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2012
    If you unlock an actor on a scene, you can access other actor's attributes but I'm not sure it's worth the trouble in this case.

    Edit: nevermind. If you spawn instances, you can't access them without constraints.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • pnolandpnoland Member Posts: 36
    Right, in my current situation I have an actor that is spawning them I am not placing them manually into the scene. I'm in the early stages of the game still so I may change it up to where I place them in the scene though so I will continue to tinker with things to see what I can come up with.
Sign In or Register to comment.