playMaker

Author Topic: Detecting when something is connected through a path [SOLVED]  (Read 957 times)

DennisJensen

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Hi PlayMakers,

I got a question for you, and I hope this community can help me out as it has done so many times before. Sorry about the confusing title let me explain.

We have a game, where you can build a castle. It's seen from the side and it's pretty simple you just place a block and that's your wall. See the attached picture.

However we would like to define if you create a room. Meaning you have side walls, and a celling. Currently we are storing info about where blocks are placed and which type they are in a hash table.

Kinda like the opposite of when a tower defense game detects if there is a clear path for the mobs, maybe the solution would be to detect if there is a path where the wall is connected to the ground and then fill in the backplate of the room.

I hope it makes sense, I'm not sure how I would do this so any inputs is appreciated.

Thanks.
« Last Edit: April 06, 2017, 03:39:22 AM by DennisJensen »
Game Designer, CEO, Artist
http://2ndStudio.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15205
  • Official Playmaker Support
    • View Profile
Re: Detecting when something is connected through a path
« Reply #1 on: March 30, 2017, 11:09:53 PM »
Hi,

 Yes, I would explore detecting cleared path because if the room shape is complex, then you will be challenged if you used raycasting to scan around, so pathfinding is the best way to do this. have a destination far away from the castle and try in each potential room. you may be challenged to find where to start your tests though... I would experiment with placing your start point in the middle of a wall , one on each side.
 
Bye,

 Jean

DennisJensen

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Detecting when something is connected through a path
« Reply #2 on: March 31, 2017, 10:38:03 AM »
Hi,

 Yes, I would explore detecting cleared path because if the room shape is complex, then you will be challenged if you used raycasting to scan around, so pathfinding is the best way to do this. have a destination far away from the castle and try in each potential room. you may be challenged to find where to start your tests though... I would experiment with placing your start point in the middle of a wall , one on each side.
 
Bye,

 Jean

Hi,

Thanks for the reply. I managed to get this working today. Phew... However I think I'm gonna need to check both sides of the wall and the top and button, because it can connect from all sides.

A quick extra question. I'm not currently using a pool manager, should I? We have a lot of objects and we keep adding, but I don't experience any lag when I build the game and run it. So I thought maybe Unity fixed the issue.

I already own pool manager so it shouldn't be a big problem.

Cheers
Game Designer, CEO, Artist
http://2ndStudio.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15205
  • Official Playmaker Support
    • View Profile
Re: Detecting when something is connected through a path
« Reply #3 on: April 05, 2017, 10:46:16 PM »
Hi,

 Unity might have improved things but, using a pool manager for large amounts of objects is still something to consider, this issue will never go away: it's better to reuse something than create it and destroy, especially at high rate and during the gameloop.

if you don't experience any issue, don't use a pool, but if you profile and see pikes when you instantiate objects, then pooling may help ( tho it could be something you do arou d the instantiation that's causing the issue and not necessarly the instantiatation per say, so you need to really pin down the issue before).

 Bye,

 Jean

DennisJensen

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Detecting when something is connected through a path
« Reply #4 on: April 06, 2017, 03:39:02 AM »
Thank you for helping, I did change to pool manager yesterday and i did improve the performance :) But there is other things I need to look into optimizing as well.
Game Designer, CEO, Artist
http://2ndStudio.com