command and conquer movement

Hi guys,

Im planning on creating a realtime strategy game like command and conquer but im stuck with a certain problem...
I want to tap on a unit and then tap on a destination and the unit start walking to its destination, ok thats kinda easy.. but what if the way to the destination isn't straight and during the way, theres for example a tree or the unit has to find the easiest/ shortest way by itself?
do you have some advice for me? :)

thaaaaaaaanks

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    You will probably run into some other problems like managing groups of units.

    Our C&C template might help.



    http://www.deepblueapps.com/selection-box-template/

    Also check out our free drag around template.



    http://www.deepblueapps.com/drag-around/

    Darren.
  • lukas.bao@o2.pllukas.bao@o2.pl Member Posts: 11
    thankyou Darren, but thats actually the problem. The command and conquer template lets the soldier go a straight line to the point you tapped. Im searching for a solution where the soldier can go to the destination even if there is a barrier by going around it.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    I don't know if this is even possible in Gamesalad but you'd likely need to incorporate something like it.

    http://en.wikipedia.org/wiki/A*_search_algorithm
  • UtopianGamesUtopianGames Member Posts: 5,692
    edited November 2013
    Couldn't you have the barrier spawn some waypoints for the hero to follow?

    Hero collides with barrier, barrier then spawns a set of way points around itself using the heroes X and Y in relation to find the quickest way around and onto the destination.

    Darren.
  • lukas.bao@o2.pllukas.bao@o2.pl Member Posts: 11
    thanks Darren ill try that
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    How about colliding with a circular actor?
  • lukas.bao@o2.pllukas.bao@o2.pl Member Posts: 11
    first of all: im very surprised about your help guys! thanks for helping me that much :) RThurman your proposal is good but the part from the start till the point where the actor collides with the barrier and goes around it looks very unnatural if you play a realtime strategy game, imagine that the barrier is some kind of long mountain and several units go first to the mountain and then decide to go around it instead of knowing right from the start that theres a mountain and taking the shortest way to the destination... i thought about finding a solution with this search algorithm that jamie c posted, or if i can't find a way to let the unit find its own best short/best way to the destination, then to guide it by pointing its way like here: (sorry for my bad english..)
  • How complex of maps are you going to use? If you are going to have things like mountains and lakes randomly throughout the map it may be very difficult to make a smooth way for the character to find a way around them. However many rts games I play have barriers that break the map into sections. Such as a long river between two sections of the map with two bridges on the river. Or a long mountain range with two valleys to walk through. You could break your map into different sections, the more the more complex but still doable. Say your characters are in section one and you click for them to move to section two and a river separates section one from two, the game could tell the character it first needs to walk to one of the bridges, whichever is closest, then walk to the point you clicked in section two. If you were in section one and wanted to go to section three that has a mountain range between it and section two, it would tell the players to first go to a bridge then a valley then the point in section three. Many rts games I play have pretty simple maps that this type of a system would work for,
  • blue_elephantblue_elephant Member Posts: 505
    Heres a click to move template by @StormyStudio http://www.stormystudio.com/game_templates/shooter.html


    It does't have the actor avoidance but you might be able to use this demo by @KevinCross which follows winding paths if you wanted to do the waypoints like @DeepBlueApps suggested.
    http://forums.gamesalad.com/discussion/52494/spare-code-dump-it-here/p8
    https://www.dropbox.com/s/uzul514osg7yzow/GameSalad-Follow-A-Winding-Path.zip

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • lukas.bao@o2.pllukas.bao@o2.pl Member Posts: 11
    @erockross: my maps will be pretty complex i think, so there will be many barriers like lakes mountains trees and so on. I do understand what you mean with dividing the map into sections but i don't think this will be the best solution for the map.

    @blueelefant: the top down shooter template i pretty much the same like the CandC template. It creates a linear path for the unit and doesnt let it find its own way through a barrier.

    I decided to let the player create an individual path for the units every time he clicks on them, I think this would more fun for the player and guarantee the "strategic factor" for this game, just like in :


    problem is if someone could guide me how to code this...
  • blue_elephantblue_elephant Member Posts: 505
    Elephant is spelled elephant. Look at the last links I posted. That's a path follower.

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • lukas.bao@o2.pllukas.bao@o2.pl Member Posts: 11
    ok sorry @blue_elephant, I downloaded the "mouse in the house" template and implemented the coding in my template. Thanks at all.
  • blue_elephantblue_elephant Member Posts: 505
    Ok, good to hear.

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited November 2013
    @lukas Thanks for the support its a very nice template and will serve you well.

    As you can see i fill the templates with step by step guides via notes but if you do get stuck we offer a free support service for paid templates.

    Darren.
  • lukas.bao@o2.pllukas.bao@o2.pl Member Posts: 11
    thankyou Darren
Sign In or Register to comment.