Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Intoccabile on November 20, 2012, 11:22:23 PM

Title: RTS Selection Box[SOLVED]
Post by: Intoccabile on November 20, 2012, 11:22:23 PM
Hi all,

I have been working on an rts design for shits and giggles. I have it so that you can individually select and move units. I need to be able to select multiple units though. To do this I need to be able to draw a selection box on screen and everything in that box gets selected.

I have absolutely no idea how to even start looking at this.

Any help would be greatly appreciated.

Regards,

Intoccabile
Title: Re: RTS Selection Box
Post by: jeanfabre on November 21, 2012, 01:51:20 AM
Hi,

 Indeed, this is already pretty involving.

you need to cut down the problem into digestable chunks:

1: drawing a rectangle on screen: for this, Vectrosity is just perfect, and I created a bridge so you can work it out in PlayMaker:
https://hutonggames.fogbugz.com/default.asp?W948 (https://hutonggames.fogbugz.com/default.asp?W948)

2: Selecting objects within screenspace:
You would simply go trhough all gameObjects in the scene ( likely filtered by tag or layer) and then verify if their position is within the selection.

3: Storing the selection:
I would go with ArrayMaker anyway:
https://hutonggames.fogbugz.com/default.asp?W715 (https://hutonggames.fogbugz.com/default.asp?W715)

You could store all your selected gameObjects into an Array as you scan them in point 2.

This is an interested question, and I feel this could win with some custom Actions for this process to be easy for PlayMaker users, so allow me few days to come up with a working example. Can you bump this thread next week if I haven't had time to look at this? thanks,

Bye,

 Jean
Title: Re: RTS Selection Box
Post by: geoquav on March 01, 2013, 08:49:50 PM
I know this thread has died but there was never a followup. I recently obtained Vectrosity for this exact purpose and am having trouble figuring out how to not only draw a rectangle that changes as I drag it but also how to be able to add objects that are selected into an array. Thanks for any help you guys can provide.
Title: Re: RTS Selection Box
Post by: jeanfabre on March 15, 2013, 10:35:24 AM
Hi,

 ok, keep bumping this thread. it's very important, and definitly something I want to add to ArrayMaker as a sample.

 Please bump this next week ok? I need to first make a new version of arrayMaker to take full advantages of the new cool features of playmaker, and I'll do that selection system as well.

bye,

 Jean
Title: Re: RTS Selection Box
Post by: geoquav on March 19, 2013, 10:24:21 AM
Thanks Jean. Here is the bump you requested.
Title: Re: RTS Selection Box
Post by: parallel on March 19, 2013, 02:43:11 PM
I recently obtained Vectrosity for this exact purpose and am having trouble figuring out how to not only draw a rectangle that changes as I drag it but also how to be able to add objects that are selected into an array.

While the features are being worked on; check out the SelectionBox example scene in VectrosityDemos, it does the drawing part you are looking for.
Title: Re: RTS Selection Box
Post by: jeanfabre on March 21, 2013, 02:18:33 AM
Hi,

ok, I did a fully working sample, tight with arrayMaker as well, that doesn't required any third party plugins like vectrosity. Will do one using vectrosity, but this is for later.

https://hutonggames.fogbugz.com/default.asp?W715

 If you have any questions, let me know. It's pretty advanced I feel, while the concept is simple, coming up with a stable, reliable and efficient system requires some careful thinking and crafting, so experiment once you have studied that sample so you understand where the pitfall can be ( especially around who is responsible to check for selection, and how often it should check)


bye,

 Jean