Jump to content

Monster free roaming?


Bomberman
 Share

Recommended Posts

Yes, I would like the monster to visit one specific area more then the other specific areas. However I still would like him to just walk around the map randomly, until the monster feels he needs to go to that specific area. (He might hear a noise and want to check it out)

Or he might catch the player off guard and randomly walk into that specific area.

Example: Specific location (Time visited) 65% of the time.

Randomly wandering: 35% of the time.

Link to comment
Share on other sites

At this point, you'll need to program that behavior. I recommend copying the monster script into a new one and making your changes in that. It sounds like you have a good idea of how the logic should work.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Random wandering can be tricky to get right and make it look good/real. You can either place waypoints around your map and have the monster walk to a waypoint in which you randomly picked which waypoint for him to go to.

 

Or you can randomly pick a point above the world and raycast downward until it hits something that is reachable by the monster and then have him walk there.

 

The first method you know will work without issues. The second method has more checks to make sure you are picking places the monster can actually get to and while less setup work (no need to define waypoints (pivots)) could lead to unknown bugs.

  • Upvote 1
Link to comment
Share on other sites

I just have the problem of adding multiple waypoints for him to patrol around.

Always get some error.

What kind of errors?

 

Are the way-points saved as part of the scene or added later?

 

In the latter case I'd expect the only issue would be if the way-point was out of bounds for the nav-mesh.

 

In the former it may be that you are not finding the way-point entities in the scene properly.

content over form, game play over all.

Link to comment
Share on other sites

I actually have done this in my game. The way I did this was that I parented pivots to the entity that I attached the script to. Then, I renamed those pivots to something like Pivot0, Pivot1, Pivot2, etc.

 

In my code, I got the global position of all of those points, and then I stored their position values in a Lua table. Finally, I iterated through the points (so I would make the character head towards one Pivot0, and then once he came in a certain radius of Pivot0, he goes to Pivot1, and this continues).

 

I would post my code, but it's a rather large and complex file, so I think it would confuse you more than it would help.

Link to comment
Share on other sites

If not can you tell me a simple way to get these waypoints working.

I couldn't find any tutorial on this.

I have not really looked at it but isn't there a video tutorial associated with the AI and Events map that goes over this?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

For example: Alien Isolations Alien ai. I need something like that. If he hears a noise he checks it out. If he senses someone nearby he'll check it out. If he sees the player he will run like a madman at him and kill him, unless player hides, or the monster gets distracted by another noise.

 

Link to comment
Share on other sites

So where exactly would I put this? I'm very new to leadwerks and lua. So sorry if I'm a trouble.

 

Lol, your not a trouble! This is what forums are for!

 

Alright, here's a tutorial I created, anyone let me know what other information you want. I can't upload my whole code files because there are a lot of interdependencies that make the files not work in most situations.

 

http://www.leadwerks.com/werkspace/page/tutorials/_/script/waypoints-and-reactionary-ai-r120

Edited by nick.ace
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...