Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Complex chase system XP

Okay, this ones a doozy.

I'm after a combination of this I believe

1) an enemy chasing system with intelligent path finding that causes an enemy to chase the player, even for a small while when it cant see the player.
however I would like the enemy to not keep chasing after so long of losing the player, instead having it move towards the nearest unlocked door and de-spawning (exiting the room).

2) a spawning system that makes an enemy occasionally spawn at a random unlocked door in the room with the player and begin to search for the player.

3) a hiding system where the player can enter lockers, hide under beds, etc. to lose the enemy, but have the enemy still find the player if they could see him when he began hiding.

honestly, i dont know if this is even achievable in RPG XP, but I figured some genius will have figured it out by now if it is.

any help would be muchos appreciated :D
 
An interesting idea. The only major hurdle I can really see with this is getting the enemy event to 1. cross maps and 2. process on a map that isn't loaded.
Investigation could be controlled by events to indicate locations of interest, and vision is pretty straight forward.

I'll have a bit of a fiddle and keep you posted.
 
okay, I think I can help with those 2 issues.

the 1st isnt a problem, as once the enemy leaves the room, I just want it to disappear. I dont need it to cross maps at all.
the spawning just needs to be random "peekaboo" and then disappear if you aren't chased style. although, the idea of being CHASED through rooms is interesting, though I would have to figure out safe rooms too.

the 2nd should actually not be a worry either as I pretty much wanted to use the doors as spawners (at random intervals, to keep you on your toes) unless again, I had it so that the enemies could chase you through rooms.

I did find this, which might give a good starting point, but Im only a rookie with scripting
http://rmrk.net/index.php?topic=49541.0

hope it helps and thanks for offering to look into my issue :D
 
Alright, well I've designed this so it's able to chase you through rooms as well. Obviously configurable, and it'll go based on distance. If it's too far away or you're a room over, it wont follow you. If it clearly sees you go through the door however, it will follow suite.

Right now I'm working on the interaction between maps, but it's not particularly complex.
I'll let you know after I've progressed further.

EDIT: So the concept:
The idea is that when the monster is enabled, it will spawn in a random room (configurable) that isn't the room you're in, and walk around the place until it finds the player. It will inspect objects in the area and when finished, head towards a door it hasn't been through yet (ideally).
If the player encounters the monster, and manages to escape, it will be despawned and will not spawn for another set period of time.
After this, it can be spawned into a specific room or a random room if you choose, and will begin inspecting and moving between rooms again until it spots the player.
The monster cannot see behind itself; you can walk past it unnoticed.
 
I'm investigating the best way to get pathfinding to work on a map this isn't currently loaded.
Other than that, I just need to work on chasing; inspecting and moving from room to room is working.
 
I'm doing uni stuff at the moment and I can't guarantee when things will be done. At the moment I've managed to get virtual maps working, but persistent pathfinding between maps is being a bit tricky.

The monster will be fully automated while still able to be triggered by action button and a monster will be visible when a switch is enabled. So a single event will be placed on each map with the name 'monster' and will behave like the monster while a switch is enabled. It will move to the correct position on its own though, so the placement of the event on the map is its spawn after death, which isn't seen because it can't spawn on the map the player is currently on.

So an event setup should have page one as blank, then a second page where it has a graphic and the monster switch is enabled as a conditional. The rest of the processing is up to you. Using script commands you can enable and disable the monster AI as well, for cutscenes etc.
 
I've paused for a little bit, for the last few weeks. Uni's picked up hardcore and will be going pretty hard until exams. Once we're in July, I should have all the time in the world to work on it.
 
sounds good mate. good luck with uni.

on another note. This script is going to be very important to the game... so how would you like to be not only credited, but also get in on the alpha test when the game is finished?
 
I bombed one exam but still managed to pass, fortunately enough.
What I'll do is I'll send you a WIP version that functions but isn't technically 100% accurate. I'll keep working on refining it, but you'll be able to continue as I work.
Sorry about these mad delays, if anyone else was doing it I'm sure they'd have been done within a few days, but my motivation has been running really thin lately.

Here's a WIP version.

Basically, call '$game_system.monster.spawn(<mapID>)' to spawn it into a map and start the processing. The MONSTER_SWITCH_ID will be active on whatever map the monster is on.
Make sure to make the eligible maps allowed in the script by adding the map IDs to the array.

Name a transfer event 'door <mapID> <x> <y>' to allow the monster to walk through it, provided there's an event somewhere on the other side with the name 'monster'.
Name an event 'inspect' to have the monster walk to it and look at it.
It is planned to have the monster run the event when it gets there, if you're on the same map.

Problems at the moment:
- Visible after transfer when it shouldn't be
- Walking towards doors doesn't work yet
- Pathfinding doesn't transfer between map instances, so you can't walk in on it mid path
- Activating events isn't setup yet
- The player chasing is broken. Fixing the door issue should help progress towards this fix as well.

I also added some things you can use, like "get_ev" in script calls to get the current running event ID, and "event.triggerer_id" is going to return the ID of the event that started the event (ie. the monster) once that functionality is implemented.
If you're interested, turn DEBUG_MESSAGES on to be notified whenever it completes an action.
 
okay, I'll have look at the WIP version as soon as my son has gone for a nap, sounds pretty awesome.

and I'm pretty sure if anybody else were doing this they wouldn't have finished in a few days, its a bloody complicated script to make... most people would have said it cant be done and quit.
 
already sorted the visible for the 1st frame when you enter a new room issue. my common event for doors opening and closing uses a fade to/fade from black, so you cant actually see the 1st few frames :)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top