Implemented pathfinding, island generator, LOD system and AO

Published October 05, 2016
Advertisement

[font=arial]Hey everyone,[/font]

[font=arial]Domen Koneski (game designer and programmer) has been working on island generator, he added every asset Andrej (3D artist) had for him - from a small firn to a huge tree. With this he also successfully implemented a LOD system and found a cool ambient occlusion system which was also added. That's it for the nature aspect. [/font]

[color=rgb(66,66,66)][font='Source Sans Pro']

ambient-occlusion-lowpoly-floatlands.png

[/font][/color]

[font='Source Sans Pro'][font=arial]Resource gathering system is now improved, you can now harvest wood, wool, experience points and rocks. What we will do with it is still a mystery since we are developing this game very iterative.[/font][/font]

[color=rgb(66,66,66)][font='Source Sans Pro']

nature-harvest-lowpoly-floatlands.png

[/font][/color]

[font=arial]Vili (programmer) explains the pathfinding and reasons why we need this in our game: [/font]

[font=arial]Common pathfinding is for ground mobs only. I wanted to have also mobs that fly and walk on walls / ceilings. For this we need special path-finding, if we wish that enemies find a way to their target. I was looking for a solution and there was none, so I programmed my own. I used oct-trees, which are really just an extension of quad-trees. I constructed oct-tree by casting cube to world for each node - if anything is hit by BoxCast, subdivide. Repeat this until you hit maximum depth of nodes. I used Unity3Ds function 'Physics.CheckBox'. I visualized my algorithm, and pretty pictures happened - what you see next is leafs of solid. You can see this can get quite heavy, because each subdivision generates 8 times more nodes.[/font]

[color=rgb(66,66,66)][font='Source Sans Pro']

pathfinding-solid-leafs-floatlands.png

[/font][/color]

[font=arial]If I wanted to have a proper graph, I needed to make it also topologically correct. This means I needed to do flood-fill algorithm to separate free-space from solid-space. This way mobs can exactly know where they can walk (and can't). [/font][font='Source Sans Pro'][font=arial]This is the result of flood-fill. I started from free-space (top most node) and searched through whole space. This way I could separate reachable and unreachable space.[/font][/font]

[color=rgb(66,66,66)][font='Source Sans Pro']

pathfinding-underground-floatlands.png

[/font][/color]

[font='Source Sans Pro'][font=arial]Did I mention before about the resolution problem? Well, there is a big problem. Each subdivision is 8x times more expensive. Time and space requirements grow exponentially. BoxCasting becomes expensive, so does flood-fill. But there is a simple solution: subdivide only parts that need to be subdivided. So I coded a simple trigger, which will mark space that needs to be detailed.[/font][/font]

[color=rgb(66,66,66)][font='Source Sans Pro']

Pasted-image-at-2016_06_09-16_31.png

[/font][/color]

[font=arial]Each prefab gets its own trigger. It can be a box or sphere collider. Now, we have proper nodes. Now I needed to generate points (with normals) for each node. I did it by raycasting from many directions (borders of node) and then averaging the points. Also I calculated the average normal - slope, so I can separate ground from wall/ceiling.[/font]

[font=arial]Now another step - connect the neighbor nodes, so we get a point graph. Here, I used 'moore neighborhood' for connections, this way I also get diagonals. Then all I needed to do is input this point graph into A* Pathfinding Project made by Aron. That's all for now.[/font]

[font=arial]http://floatlands.net[/font]

2 likes 2 comments

Comments

Navyman

Sometimes Low Ploy can look cheap, but your art style or maybe the choice of color give the screenshots a very stylized look and prevent the cheap thought from forming.

Keep up the great work!

October 05, 2016 08:53 PM
Ph4nt0m

Yeah, most games today have an oversaturated look and we don't want to go that way.

October 06, 2016 07:25 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement