playMaker

Author Topic: Group movement  (Read 6042 times)

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Group movement
« on: November 30, 2013, 06:11:33 PM »
Could u guys help me out where i can find a tutorial or similar in how i can create a group movement control such as that in syndicate. Sort of.  I'd want a team of four..maybe three units that can be selected using keypad numbers 1..4 so that nr.1 would be unit 1, nr.2 unit 2 and so on. All units selected perhaps a button of its own.

Id need the camera to focus on the selected unit/units while moving them with AWSD or my mouseclick. Meanwhile the unselected units should remain where they are unless they allready have a movement order from before.

I'm new to unity and i've gotten a huge interest in this add-on, but i just can't find a related tutorial. A lot of good stuff related to camera movement yes, but that movement part. Just bits and pieces..or i just don't get it :)

I'd really appreciate it if someone would lend a hand. I got this dream from since i was a kid, that i could some day make a game and trying to fullfill that dream.

Cheers!
« Last Edit: December 12, 2013, 05:26:13 PM by Tetsuo »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Group movement
« Reply #1 on: December 02, 2013, 02:17:52 AM »
Hi,

 Several ways to go.

-- either all your team reacts to the same user input

-- either you have a "master" in your team, that is controlled by the user, and then every one else in the team, simple follow that master.

so you need to cut down your problem.

-- can you have an object follow another,
-- can you switch the same user inputs between two object

when you solve the two questions above, doind your team will be ok.

bye,

 Jean

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #2 on: December 05, 2013, 03:34:29 PM »
Thanks for the answer, My objective would be the first one you implied. All units in the team reacts to the same user input, but they need to be so that they can be controlled individually.

So.. i assume my next question would be. How do i do it so that i can switch the same user inputs between two or more objects ?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Group movement
« Reply #3 on: December 09, 2013, 02:03:34 PM »
Hi,

 Your sentence is in contradiction ( or maybe I am just tired).

 you seem to say you want to control a group, yet control them individually. Either the group of object works as a group or individually, they can't really do both, especially with only one input source: the user input.

Can you refine your description or lift this misunderstanding?

bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Group movement
« Reply #4 on: December 09, 2013, 02:17:00 PM »
I think what he means is he wants to be able to for example press "1" and be sending orders to that specific agent, so numbers 1, 2, 3 and 4 control which unit you have selected to command, individually.

Then he wants a button, say "5" to send orders to all of them, so they all get the same command. It's still defining a state of either only one or all of them. (maybe i misunderstand too though, i'm sick and pretty medicated :p)

I would setup a state of [selected] and [not selected] for each agent and toggle those states for each agent with your selector keys, then use one key to put them all into the [selected] state so they all get the order. Next, depending greatly on your pathfinding solution, you might need to have them identify if there are other agents selected and give them slightly different destinations so they don't walk on top of each other.

There's some info floating around on how RTS games handle this. I messed with it a while back but don't have the links to the study articles anymore.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #5 on: December 10, 2013, 07:10:07 PM »
Much appreciated that you are trying to help me here, and sorry if i'm being hard to understand  :o

It is as Lane said what im trying to create here. I too found some little bits about RTS movement on youtube but still not enought to give me a complete idea on how it would be done with playmaker. That selected and not selected idea sounded quite simple and understandable, now only to figure out how to actually do that :)

Cheers!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Group movement
« Reply #6 on: December 10, 2013, 07:34:49 PM »
Do you have locomotion working yet? If so, its just a matter of getting out of the state that waits for input to provide locomotion. A Not Selected state with nothing in it would work fine and you could just use the number key to trigger entry into the Selected state. (well, I guess the Not Selected state would have a Get Key Down action then :P)

If you are having a hard time with it later this week bump the thread and I'll take some time to make an example.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #7 on: December 12, 2013, 04:54:22 PM »
Okay i got it working with a little help from a 3rd person movement tutorial and combined that with the advice given here.

https://dl.dropboxusercontent.com/u/73502848/liike/test.html

nr. 1 and 2 changes the unit

Thanks a bunch!


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Group movement [Solved]
« Reply #8 on: December 12, 2013, 05:01:34 PM »
Glad you got it working! =)

Link doesn't work though, did you put the file in the public folder?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #9 on: December 12, 2013, 05:30:47 PM »
Oops, my bad, the correct address should be:
https://dl.dropboxusercontent.com/u/73502848/liike/move.html

I actually thought of another question regarding this. I've now gotten it to change the unit  and trow the camera on the active one. How would i get the camera to slide over instead of just changing in straight out to the active unit?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Group movement
« Reply #10 on: December 12, 2013, 05:41:05 PM »
You can just tween between the two positions, current and target.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #11 on: December 15, 2013, 12:18:37 PM »
I just realized that this in not really relevant anymore to the original question entirely, but could you be a bit more spesific in how should i use the iTween. I tried the "Move to" command, but it jumps inside the unit in question. I'd need it to stay a bit further. I was wondering, should i create an invisible object that follows each of the units around and make the camera to "move to" that object, or is there a better way?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Group movement
« Reply #12 on: December 15, 2013, 05:55:26 PM »
 There's a few different options, i think the first i would try is doing a Get Position, store the variable, then add in the distance i want it to be from the object into that variable, then using a move to should work.

So agentPosition + cameraOffset = targetPosition

Make sense?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #13 on: December 16, 2013, 09:35:33 AM »
Not at the moment :D but i'll try to make sense of it by learning. Thanks!

Tetsuo

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Group movement
« Reply #14 on: March 01, 2014, 02:14:49 PM »
Well well, i got a bit sidetracked with other business but im back with this. Lane i tried your suggestion and failed miserably. The closest i can get is so that the camera zooms inside the unit and then it bounces back a bit (this would be the set distance ?) it also does this not by shifting from the other unit, but instantly switching to the other unit and then doing the ease in..which is pointless at that time since the camera is allready at the goal :P

I noticed that it does not flip out so much if i switch off the smooth follow option, but then i lose the control of the unit.

« Last Edit: March 01, 2014, 03:52:11 PM by Tetsuo »