Advanced RTS mechanics

0 favourites
  • 8 posts
From the Asset Store
Create a boss fight with this easy to follow game pack. Recreate the classic attacks of Mutoid Man from Super Smash TV
  • Hi,

    I've used Unity in the past and have just come across Construct2, which I'll definitely be using from now on.

    I'm working on a RTS game and I've got SO many questions, hopefully you can address them one at a time. I've already figured out how to click around and order units thanks to the very nice RTS tutorial, but these are more specific to the individual game I'm making:

    1. Timers - my game will be heavily dependant on timer actions. I need firstly a countdown timer of when a unit will arrive at it's destination in real hours and minutes, as it's a slow paced game that takes place over many days. There will also be actions that are "locked" for certain amount of hours like changing orders and construction. What is the best way of implement this on Constructor?

    2. A lot of pop up menus for issuing orders, so when you right click on a location you have Move to option, right click on a unit you get other options. I can do this easy enough in the corner of the screen, but how do I make the menu appear where the mouse has been clicked (or closeby)?

    3. The map. I can make a map easily enough and define land/sea as walls for respective units for pathfinding. How do I make the map zoomable with the mouse wheel and able to click and scroll?

    4. Smooth movement. The RTS tutorial allows smooth accelerated movement but not so on the turning. When I change the path of a flying plane for example, I want it to slowly curve on an axis to it's new position. How to do this?

    5. Instant variables - can someone tell me more about these? Say for example I've got 20 cities with a "population" do they each need a new variable?

    Thanks for all your help.

  • Lots of the answers are in the manual.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 1. Have a look at the timer behaviour.

    2. The position of your mouse is mouse.x,mouse.y pop up your menu's relative to that.

    3. search the forums for many zoom examples, some of them might suit you.

    4. Read up about movement in the manual and or tutorials. You could for instance try adding an event for changing directions if you want total control over the effect.

    5. An instance value can hold many different values under the same name, so population would be the name and the value itself could be 100 or 1000 or 10000 or even 264.75 ..

    You should probably follow some more tutorials and read the manual more intensively. Using the search feature this forum has could also help. Also there is this topic called FAQ, which means frequently asked questions, many basic (and not so basic) features are in the topics linked in that topic.

  • Hi thanks for the replies, but I think you have dismissed something by accident here.

    I want a timer that counts down to when the unit will arrive at it's destination, including pathfinding. That seems to me to be a bit trickier than what is covered in the tutorials etc.

    This will need to calculate the speed of the unit divided by the distance after pathfinding and return me with a time, how do I do this?

  • You should create some kind of formula in which you compare the speed with the distance left to travel.

    Time = distance/speed

    if I'm correct.

  • I did this just the other day:

    Set speed to: (unit.speed/10)*(distance(leftMarkX,0,rightMarkX,0)/60)

    Sets the speed to a formula that means the UNIT SPEED DIVIDED BY 10 IS THE DELTA TIME to travel the distance. So, if the unit's speed is 600, it will take 1 second to reach its destination (600/10=60). 300 will take 2 seconds, 1200 half a second etc.

    Hope that helps!

    EDIT: Actually sorry, this is a little different, I wanted them to always take the same time to travel between points regardless of distance. Sorry for that, maybe you can still get some understanding from it though.

  • There are no limitations in C2. It is about about having the talent to do it.

    But I'll answer your timer question for you.

    Locking the object action

    ObjectToLock.nextTime = time + locktime

    attempt at object ability

    ObjectToLock.Do Ability

    if ObjectToLock.nextTime < time

    -->then do action

    Id you need big hours or time for concepts of coming back. Then you need to use

    var ObjectToLock.nextTime = Browser.execJS("Date.getTime() + TIME_IN_MS")

    FYI I don't recall the exact JS function for this right now.

    The same principle is applied for checking to do the action.

    I know this because I have a game POC that actively needs to do real time in the possible use of days.

  • Q4. use the action "turn to angle" the lower the amount the longer it will take for the plane to reach the specified angle. Should give you the effect your after :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)