Jump to content


Photo

Random Movement


  • Please log in to reply
2 replies to this topic

#1 Atamagaokashii

Atamagaokashii

    GMC Member

  • New Member
  • 513 posts
  • Version:GM8

Posted 23 January 2012 - 12:59 PM

Hey Guys,

So for the zombie survival game I'm making I've decided to tackle the enemies next. I'm not too fussed about sprites etc but I want the engine to work first.

The problem is, I've no idea where to start on making these zombies move randomly and seem "zombified" in their movement strategies.

I don't want to use paths as that all seems too central, they'd be picking from the same set and some of them doing exactly the same path, which would look odd.

So my question is this: How can I make zombie movement AI in a top-down game?

Many Thanks and Votes Up as always ;)
  • 0

#2 GameDevDan

GameDevDan

    YoYo Games Staff

  • Administrators
  • 1256 posts
  • Version:GM:Studio

Posted 23 January 2012 - 02:14 PM

IMO it's always better in a zombie survival game if they move towards the player, not randomly, for which you would want to use something like the "Step towards" function while avoiding solid objects.

For random movement, Try to come up with a system like this (although this is kinda iffy and simple)

ZOMBIE OBJECT

CREATE EVENT
- Set alarm[0] to 90
- Set direction to round(random(360))
- Set speed to 1

ALARM[0] EVENT
- Set direction round(random(360))
- Reset alarm[0] to a random no. of steps


As I said that's kind of a basic way of doing it that will have issues (it's not entirely random and changing direction won't look fluidly animated), but I think it's a good start.
  • 1

#3 Atamagaokashii

Atamagaokashii

    GMC Member

  • New Member
  • 513 posts
  • Version:GM8

Posted 23 January 2012 - 03:32 PM

IMO it's always better in a zombie survival game if they move towards the player, not randomly, for which you would want to use something like the "Step towards" function while avoiding solid objects.

For random movement, Try to come up with a system like this (although this is kinda iffy and simple)

ZOMBIE OBJECT


CREATE EVENT
- Set alarm[0] to 90
- Set direction to round(random(360))
- Set speed to 1

ALARM[0] EVENT
- Set direction round(random(360))
- Reset alarm[0] to a random no. of steps


As I said that's kind of a basic way of doing it that will have issues (it's not entirely random and changing direction won't look fluidly animated), but I think it's a good start.


I'm fairly certain I've used a system like that before in an animal RPG I ended up shelving. I want the zombies to move randomly unless they notice the player. I can manage to make them move towards but I'd rather the player wasn't always being shafted by zombies ;) It's re-emerged the original idea though which I was struggling to remember so thank you on that part.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users