LOS - AI Hides From Player + Cover points

Post your own tutorials, guides and demos.

Post » Fri Dec 16, 2011 9:59 am

Hi!

First of all I want to thank everyone that have helped me with my previous subjects, you know who you are!

Please bear with me, english is not my native language.

Today I will share a little top-down demo I have made using Construct Classic.

In this demo the AI units will run for cover, prefering cover points distributed on the map. For each tile I have distributed a LOS node which is a sprite. Due to the fact that the tiles always have their hotspots in the top left corner.

In this demo I have the walls on the inside of the tile square. I realize now that I could have made them inside on the south and east walls and outside on the north and west walls. Maybe even using the same tile but putting the north and west wall in the outdoor tile next to the floor tile. Anyways...

Each LOS Node gets a "hide value" like so:

clamp(int((distance(player.x,player.y,los_node.x,los_node.y))) - (los_node.Value('in_los')*100000) + los_node('cover_point')*240,0,480)

You can get a very dynamic formula here if you play with the values and add more values like if there is a grenade thrown etc...

Well since alot of people have been so nice to me on this forum I feel that I want to give something in return, if this has any value to anyone that is.

Here it is:

Example file here!   

However for the love of all green jelly in the world, I can't make this work when using the nodes as tiles. Does anyone know how to do it?

It creates alot of overhead using sprites for such a simple task.

Have a nice day!
/MJOne
MJOne2011-12-16 10:03:52
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Fri Dec 16, 2011 1:10 pm

It wants "Dropshadow2" effect to open the file and I can't find it on the forum. Do you have a download link?
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Fri Dec 16, 2011 4:24 pm

Holy cow I forgott about that.

I will reupload a version without that effect...
MJOne2011-12-16 16:29:35
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Fri Dec 16, 2011 4:29 pm

Might work now, I deleted all the instances of the dropshadow 2 effect... I hope...
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Sat Dec 17, 2011 10:14 am

Looks good, thanks for the example. About using tiles, I think it'd be possible, but using sprites is easier. My idea is, that you would keep an array as a map, just a wild guess, didn't really think about it.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests