Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


heh65532

Member Since 08 Apr 2010
Offline Last Active May 27 2013 02:21 PM

Posts I've Made

In Topic: how to do this in c++

26 May 2013 - 01:06 PM

So the tower needs to tell pathfinder the ground door can be used if there's ground and not water for example or some other obstacle and the top doors can be used if there's some connection like walls/platform next to the doors

 

I'm not sure the why the tower would care that there are walls or water blocking the doors. It should just say "I have a door that opens here, a door that opens here, and a door that opens here", and provide some description of the kind of objects that can travel through the tower.

 

The pathfinder would then be responsible for examining each of those routes, and checking to see if there is a wall or water blocking the way (as it would be if there were open land immediately outside each of those doors, but which was then discovered to be walled or watered in a short distance from the doors).

 

Also, you can reduce the complexity of your multiple dispatch problem if you can attempt to categorize your buildings and other objects as to the kind of things they let pass through.

 

yes i very much agree. problem is with the complexity. but i'm going to use common attributes for each object (both path traveler and geometry) to determine in single function can the path go through an tile.

this can get probably quite complex but at least there's no duplicated code or any other problems. 


In Topic: how to do this in c++

17 May 2013 - 07:27 PM

I'm guessing your portal would be like ours. A portal has some number of lanes (usually 1), and the routing system automatically routes near the portal, waits for a lane to become free, marks the lane as in use, then travels across it. Only certain units can travel across particular lane types. There is an animation that plays (very similar to the basic walking cycle) when a unit travels between the portal endpoints. And finally, you can place multiple portals together end-to-end and have them work continuously.

We have many kinds of portals. They include bridges, ramps, stairs, doors, and elevators.

For us, we simply add a portal component to a game object, fill in a few functions that the interface requires such as the portal type and the animation names, and routing automatically picks up whatever new portal type we added.

 

that sounds like a good way. but the thing is i added access logic to each building so they can tell the pathfinder in which various ways they can be traveled through. for example there maybe a tower with one door on ground level and two doors at the top leading outside where a wall can be. So the tower needs to tell pathfinder the ground door can be used if there's ground and not water for example or some other obstacle and the top doors can be used if there's some connection like walls/platform next to the doors. 

this seems to require rather complex set of portals. so i might use some kind of portal component system or try to do better OO design. 


In Topic: how to do this in c++

17 May 2013 - 01:13 AM

Buildings are game objects that exist in the world. Buildings are not the only object that exists in the world. The building should know what world it belongs to.

Individual game objects should know nothing about routing and navigation of the world. That isn't their responsibility.

The world should usually maintain the collection of objects within it, and it should also work with a routing system.

Perhaps it will look something like:

Route r = World.CreateRouteToObject( this, pDestinationBuilding );if(r.IsValid()){  activeUnit.SetRoute(r);  // Use the route}else{  activeUnit.ShowRouteFailure(); // Make the unit play its annoyed animation and sound }

thanks frob. So you say better OO approach is to let the world logic tell what accessibility there is between buildings? the reason for each building to have this information is because if there's a wooden bridge then humans can travel across it, but heavy donkey carts cannot because the bridge might collapse so they need to use stone bridge instead. 

every time i add new type of these buildings the pathing possibilities increase.

so i might be moving the conditional code outside the class but that seems to require keeping a list of class vs class accessibilities.


In Topic: c++ syntax error

03 April 2013 - 10:41 AM

i found the problem. the new was actually overrided and that caused the problem.

 

#define DEBUG_NEW new(_NORMAL_BLOCK,__FILE__, __LINE__)_)
#define new DEBUG_NEW

 

for the memory leak detecting code. not sure if there's better way overloading the new.

 

thanks in anycase


In Topic: c++ syntax error

03 April 2013 - 09:26 AM

Did you try removing the scope operator :: from the new call?

 

did now but it didn't help.

thanks


PARTNERS