ID:2029113
 
Code:


Problem description:
Hi i have one question. Is posible to zoom "map" in game, without object in screen?(I mean about HUD)

Like this video.

https://youtu.be/YWvW9srnIXQ?t=5s (in 0:05s)
Of course. Plane masters affect the view on the same plane, so just apply a transform matrix to scale everything uniformly.
Can anyone give me the answer of this question?
With the new plane master feature, just scale up the transform of the plane master that is on a plane above your scene and below the HUD.

You can also smoothly rotate the view this way.
mhm, can you show me the way, how to do this?
I was wrong actually, the plane master only affects its own plane.

I guess it goes something like this:
mob
var obj/map_zoom

Login()
..()
var obj/o = new

// o.plane = 0 by default, should be the same as your world map and below your HUD plane

// see the DM Reference for this
o.appearance_flags = PLANE_MASTER

// this is so it's always visible
o.screen_loc = "1,1"
client.screen += o

// this is so we can change it outside of this proc
map_zoom = o

verb/zoom(n as num)
// simply scale the transform smoothly
animate(map_zoom, transform = n * matrix(), time = 5)
Man, that's one step-heavy way of doing that.
obj/map_zoom
appearance_flags = PLANE_MASTER
screen_loc = "1,1"
mob
var/obj/map_zoom/map_zoom
Login()
..()
map_zoom = new()
client.screen += map_zoom
// And the rest...


Lots less var lookups, creations and accesses in that, meaning less overhead.
Any thoughts on how you handle this for multiple users where you want each player to have their own zoom state without having to manage duplicate objects/images for every user?

*edit*
Removed a couple ideas that didn't make sense.
The way it's setup now would allow for varied zoom levels between users.
In response to Nadrew
Right. Plane masters only have an effect on clients that can see them (although the plane masters themselves aren't drawn). This is why they're added to client.screen, so they're always visible.

For example, place a plane master just outside of view, move towards it and its effects will show, move away from it and its effects disappear.
They work as a single image output to the client as well. The only caveat here is that things that aren't on the same plane as the transformed master won't be zoomed, so things can get a bit weird.
so ..
you want to zoom map like a pro? :)
My map zooming lib (didnt post it on byond) can do the job pretty well.
datum/var
min_zoom_size = 0.10
max_zoom_size = 2.10
zoom_size = 1.0

zooming_in = null ; zooming_out = null

/*hebrons here just a little snippet
so you get the jist this should
work im guessing idk never really
used something like this i hope it
works for your though.*/


datum/proc
#define MAP_ZOOM_PERCENTAGE 0.1
#define ZOOM_TRANSITION_TIME 1
#define DEFUALT_ZOOM_SIZE 1.4
zoom_in() //proceedure for zooming in.
while(zooming_in) //while you are zooming in.
sleep(ZOOM_TRANSITION_TIME)
.=..()
if(zoom_size > max_zoom_size)
zoom_size = DEFUALT_ZOOM_SIZE //set's the zoom size back to default.
return

zoom_size += MAP_ZOOM_PERCENTAGE //add's on to the zoom size.
winset(usr, "default.map1", "zoom=[zoom_size]")

zoom_out()
while(zooming_out) //while you are zooming out.
world.log << "call"
sleep(ZOOM_TRANSITION_TIME)
.=..()

if(zoom_size < min_zoom_size)
zoom_size = DEFUALT_ZOOM_SIZE //set's the zoom size back to default.
return

zoom_size -= MAP_ZOOM_PERCENTAGE//reduces the zoom size.
winset(usr, "default.map1", "zoom=[zoom_size]")

datum
verb
Zoom_In()
zooming_out = null
zooming_in = 1
src.zoom_in()

Zoom_Out()
zooming_in = null
zooming_out = 1
src.zoom_out()
In response to Hebrons
Hebrons wrote:
My map zooming lib (didnt post it) can do the job pretty well.

Doesn't that approach zoom everything including HUD elements?
true that, the reason i actually made the lib was because i think it was Brandon M. wondering how zooming could be accomplished on byond and i sorta made a snippet for that and made it a lib but yes it does, but my resolution was to just make a screen_obj_off/on() proc and call it in zoom but yes that's the only down side to my lib.
In response to Hebrons
Hebrons wrote:
true that, the reason i actually made the lib was because i think it was Brandon M. wondering how zooming could be accomplished on byond and i sorta made a snippet for that and made it a lib but yes it does, but my resolution was to just make a screen_obj_off/on() proc and call it in zoom but yes that's the only down side to my lib.

Comment in your example suggests the "library" was made for you. :) Still useful and not a downside if that's the type of zooming you need.
In response to Nadrew
Nadrew wrote:
The way it's setup now would allow for varied zoom levels between users.

I think I get it. By not specifying a plane, are we assuming everything else is on the same plane which is why it would work?

Does that also mean that any effect applied to any one object on the same plane will be applied to everything on that plane?

I need to spend some time on it.
In response to PopLava
The effect isn't applied to everything on the plane, individually. When visible (although the plane master itself isn't actually drawn), a plane master's transform, color, and blend_mode will affect the plane as if it were one big icon.

By default, atom.plane = 0. Assuming the stuff you want to zoom is on plane 0, scaling up the plane master of plane 0 will effectively zoom-in that plane.
yeah, thanks :)still progressing myself as a programmer
In response to Kaiochao
Kaiochao wrote:
The effect isn't applied to everything on the plane, individually. When visible (although the plane master itself isn't actually drawn), a plane master's transform, color, and blend_mode will affect the plane as if it were one big icon.

By default, atom.plane = 0. Assuming the stuff you want to zoom is on plane 0, scaling up the plane master of plane 0 will effectively zoom-in that plane.

*ding* - Thank you.