ID:153775
 
Has anyone given any thought as to how to implement selecting multiple mobs via the mouse? I'm referring to the standard group selection feature as seen in a lots of games, from StarCraft to Empire Earth - the ability to drag a 'virtual box' (or circle even) around a collection of controllable units. Any subsequent command is applyed to all units within the selection box. An alternative is to CTRL-click several individuals for the same purpose of mass command issuing.
digitalmouse wrote:
Has anyone given any thought as to how to implement selecting multiple mobs via the mouse? I'm referring to the standard group selection feature as seen in a lots of games, from StarCraft to Empire Earth - the ability to drag a 'virtual box' (or circle even) around a collection of controllable units. Any subsequent command is applyed to all units within the selection box. An alternative is to CTRL-click several individuals for the same purpose of mass command issuing.

I don't think BYOND at present has Ctrl-click capability, but the next major version just might.

However, the dragging feature should be possible. Basically you'd need to override client.MouseDrag() (as I recall) and the MouseDown/MouseUp/MouseDrop procs as well. The dragging should set client.eye to a fixed target when it begins, and move that target as the selection window is expanded--whenever the mouse pointer moves to the edge of the map.

Lummox JR
In response to Flick
Flick wrote:
coming... :)

Ha! I knew someone would rise to the challenge!
already is one, wheni get to my pc il find the link
In response to Maz
In response to Maz
Thats just an entry, there is no code or demo link.


hmm...

Date Added: 1/18/03
Version: 1
Status: Alpha (initial testing/development phase)
Forum

December 22,2002 - Updated for better performance



In response to Flick
Got it, if you want it Il Email it to you.)
I shy away from using things that can't be implemented all the way with BYOND. Since dragging the mouse across the screen in order to select everything inside the square is usually accompanied by a visible rectangle, it can't really be done properly. Not saying it couldn't be done of course.

I created a little combat simulator a little while back just as an experiment with combat routines and AI, and I needed a way to select multiple units. This idea is only usable if all the units in the game are placed at the beginning, and are not created in the midst of game play. The solution is that you divide the existing units into groups, and whenever you click on one unit, all other units in its group are selected. It also lets you divide up certain units into task forces and prevents them from all getting bunched up in mix-matched groups.

If you could come up with an intuitive way to create and organize groups during game play, then perhaps that would be a good way to do things.
In response to Druin
Druin wrote:
I shy away from using things that can't be implemented all the way with BYOND. Since dragging the mouse across the screen in order to select everything inside the square is usually accompanied by a visible rectangle, it can't really be done properly.

Hmm. Too bad BYOND is strictly a text-based game engine with no capability for sending images to any part of a client's screen. Oh wait, that's not BYOND at all!

Admittedly, drawing a rectangle would slow things down a bit* and would probably only be practical as a whole-tile display rather than one that smoothly adjusted pixel by pixel, but I shy away from interfaces that rely on split-second timing in anything that isn't first and foremost an action-arcade type game.

*Considering that the loudest and most vocal complaints of "HUD lag" come from those that are inclined to complain loudly and vocally when the latency of their connection increases by a few hundredths of a second, I am inclined to take these with a grain of salt. But putting up more than a couple dozen screen objects will cause some delay on computers that are more than a few years old.
In response to Leftley
Hmm. Too bad BYOND is strictly a text-based game engine with no capability for sending images to any part of a client's screen. Oh wait, that's not BYOND at all!

If you're going to quote my paragraphs, please quote the whole paragraph.
In response to Druin
Druin wrote:
If you're going to quote my paragraphs, please quote the whole paragraph.

It sounded as though you were referring to the concept of drag-select as a whole, rather than displaying a selection rectangle. I wasn't attempting to take your words out of context; the context was ambiguous to begin with.
In response to Leftley
Heh... The HUD in DBTC at its max has around 90 screen objects (it varies, as different menus open and close... the bare minimum of just the base HUD is 37)

And I've managed to make things efficient enough that when playing it single player, there is no noticeable slowdown...

Of course, DBTC isn't an action game, so a bit of slowdown wouldn't really hurt anyone...

[Edit] Make that 160 at the max...lol
In response to Flick
There used to be an entry, I know I have it.
In response to Leftley
Leftley wrote:
Admittedly, drawing a rectangle would slow things down a bit* and would probably only be practical as a whole-tile display rather than one that smoothly adjusted pixel by pixel, but I shy away from interfaces that rely on split-second timing in anything that isn't first and foremost an action-arcade type game.

... putting up more than a couple dozen screen objects will cause some delay on computers that are more than a few years old.

You could use a dither to shade the selection area and only need one screen object. Use the "x1,y1 to x2,y2" format of the screen_loc var to determine where the rectangle is displayed. I had a demo for a commercial Star Trek game (I forget the name of it) that had a filled in shaded selection rectangle.

Drawing rectangular boxes around the outside of the selection area could be done with 4 screen objects stretched along the edges of the rectangle. If you want fancy corner icons, that bumps it up to 8.
I did it by just showing the corners of the rectangles since that is really all someone would need to see to determine what they are selecting. I ended up using 3 screen objects for corners and then just changed the mouse icon for the fourth corner. Unfortunately, the mouse icon only updates when it is moved to a new location (or else it used to) so it didn't always look quite right.

Basically, just use MouseUp and MouseDown (like Lummox said) and then the block proc should finish the job. There are probably more efficient ways to actually find the mobs than block() (since you have to manually look through each turfs contents) but it still works :p
In response to English
cool! thanks to all for your input!
In response to Flick
Flick wrote:
Thats just an entry, there is no code or demo link.


hmm...

Date Added: 1/18/03
Version: 1
Status: Alpha (initial testing/development phase)
Forum

December 22,2002 - Updated for better performance


I forgot about that! I was going to update it to have the box shaded in. The link is back up now and it seems to work decently. I'll tune it up a bit and probably release the source, or just send it to anybody interested in how it works. (it's pretty simple) If you have any questions just email me at .

Wall04