I'd like to duplicate what you see on NFL games when a caster has an overview of the field in graphical form and draws on it using a virtual pen. This usually shows up as yellow lines. This can be used to illustrate movement of players during a play, for example. I have two ideas for implementing this.
1. Zoom out so entire map can be seen. Position camera looking down at 90 degrees. Following the mouse when you click down to when you click up and create a line by placing doodads or other actors in the game world.
2. Display an image of the map using a Dialog Item and track the mouse as it drags lines across this image. I am not sure how I would draw a line. Perhaps by creating other dialog item images that consist of a yellow circle and have them overlap enough so that it looks like a line.
Any insight on which of these approaches is better and/or more feasible? Other ideas or examples?
When I capture the position of the mouse on the UI and then create a dialog item image there, it seems to be off by a scaling factor. It's correct at 0,0, but it gets farther and farther from the cursor as x and y increase. I tried to scale this using a multiplier, but it seems to behave differently if you're on a 16:9 vs 4:3 aspect ratio. Any way to guarantee that an image is created exactly where you click regardless of aspect ratio?
Use the mouse world position and calculate the position of the new dialog item from that. The mouse UI position is always relative to the aspect ratio. AFAIK there is no way to check what aspect ratio a player is using without asking them directly - and that's cumbersome.
(1) Hide game cursor / show dialog image cursor (2) On mouse move, calculate position of pen and move dialog image cursor (3) Leave a trail of dialog images when mouse is pressed down
This works correctly on any aspect ratio and doesn't depend on game world. Two problems I can see: (1) When you switch in/out of "pen mode" the pen cursor will appear offset from game cursor (more or less depending on distance from upper left) and (2) You can draw "beyond the screen" on 4:3 ratio..also noticed a wrap-around on 16:9. I don't think either of these are deal breakers.
Obviously anything that tracks mouse moves is going to produce lag...
That's an imaginative solution. The "dialog cursor" might feel a little unresponsive though.
It's pretty bad from Blizzard to give us resolution independent dialogs, but cursor coordinates dependent on the actual resolution. That's not very coherent.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'd like to duplicate what you see on NFL games when a caster has an overview of the field in graphical form and draws on it using a virtual pen. This usually shows up as yellow lines. This can be used to illustrate movement of players during a play, for example. I have two ideas for implementing this.
1. Zoom out so entire map can be seen. Position camera looking down at 90 degrees. Following the mouse when you click down to when you click up and create a line by placing doodads or other actors in the game world.
2. Display an image of the map using a Dialog Item and track the mouse as it drags lines across this image. I am not sure how I would draw a line. Perhaps by creating other dialog item images that consist of a yellow circle and have them overlap enough so that it looks like a line.
Any insight on which of these approaches is better and/or more feasible? Other ideas or examples?
The latter approach would probably be better and produce less lag - especially if you have a lot going on in your map.
The second approach is the only viable one, or all your players without the ultimate GPU will begin swearing.
Don't use circles, use line segments with rotated dialog items. I draw my graphs that way too.
When I capture the position of the mouse on the UI and then create a dialog item image there, it seems to be off by a scaling factor. It's correct at 0,0, but it gets farther and farther from the cursor as x and y increase. I tried to scale this using a multiplier, but it seems to behave differently if you're on a 16:9 vs 4:3 aspect ratio. Any way to guarantee that an image is created exactly where you click regardless of aspect ratio?
Use the mouse world position and calculate the position of the new dialog item from that. The mouse UI position is always relative to the aspect ratio. AFAIK there is no way to check what aspect ratio a player is using without asking them directly - and that's cumbersome.
@BasharTeg: Go
Actually I tried a different approach.
(1) Hide game cursor / show dialog image cursor (2) On mouse move, calculate position of pen and move dialog image cursor (3) Leave a trail of dialog images when mouse is pressed down
This works correctly on any aspect ratio and doesn't depend on game world. Two problems I can see: (1) When you switch in/out of "pen mode" the pen cursor will appear offset from game cursor (more or less depending on distance from upper left) and (2) You can draw "beyond the screen" on 4:3 ratio..also noticed a wrap-around on 16:9. I don't think either of these are deal breakers.
Obviously anything that tracks mouse moves is going to produce lag...
That's an imaginative solution. The "dialog cursor" might feel a little unresponsive though.
It's pretty bad from Blizzard to give us resolution independent dialogs, but cursor coordinates dependent on the actual resolution. That's not very coherent.