minetest / minetest_game

Minetest Game - A lightweight and well-maintained base for modding [https://github.com/minetest/minetest/]
http://minetest.net/
Other
1.42k stars 578 forks source link

Add a telescope item that enables zoom privilege #1358

Closed paramat closed 8 years ago

paramat commented 8 years ago

I'm thinking of working on this, any objections? I will probably make it a subgame mod, to keep MTGame as modular as possible. It will work as in Wuzzy's mod http://repo.or.cz/minetest_orienteering.git/blobdiff/2d88b8ff0795abbc9461c3a6bf269d4dcb38d5cd..2026249d90bd76c367bb35e4735b1bdfe92de293:/init.lua For performance the wielded item check will not run on every globalstep but maybe once every 1-2s. For an expensive craft it would require obsidian glass for the lenses, maybe with each lens requiring 5 obsidian shards in a lens shape. In Minetest 'Zoom' is disabled by default, this feature would make it usable in survival gameplay, instead of just being a privilege granted by server admin in creative mode. Why telescope instead of binoculars? A telescope is a more universal item suitable for a historical world, fantasy worlds as well as modern worlds.

ghost commented 8 years ago

This is a fine idea, but I feel it's somewhat unnecessary. The rationale is that, with F5 one is able to determine coordinates, without a priv, and with no craftitem. Better may be to make a compass, first.

Adding the zoom priv to the default default_privs setting would be another solution.

Wuzzy2 commented 8 years ago

I support this general idea very much. It will improve gameplay and gives more rewards. This is better than giving the player everything “for free”. At least for non-creative mode, of course.

I am not sure about craft. The item is useful, but not THAT useful, especially since you must wield the item, so you can't build or use a heavy weapon and zoom at the same time. As far I see, it is a purely graphical tool with no direct gameplay effect. E.g. chunks further away don't generate when you zoom, etc. But I don't have very strong opinions on the craft, obsidian is not that hard to get anyway. But if you use obsidian, at least use obsidian glass, not obsidian shards for the lenses.

The implementation details need more thoughtwork, however.

For performance the wielded item check will not run on every globalstep but maybe once every 1-2s.

Sounds good on the surface, but it needs to be tested if this is not too frustrating to use. I mean, wielding the item and then waiting up to 2 seconds for actually being allowed to zoom.

One technical problem I see in this, is that other mods who might want to extend this will be automatically screwed beause the zoom priv will be permanently overwritten. For example, you could not add another item which allows you to zoom because any change you will attempt to the zoom priv will be overwritten by Minetest Game (or vice-versa). This will thus make any custom zoom item or other additions which want to add more ways to zoom practically impossible. One use case would be a sniper rifle in a firearms mod, which allows you to zoom and shoot. Another example would be a static entity which the player has to rightclick to “enter” it only only when attached zoom is allowed.

One solution to this would be to add some sort of mini API or another method to somehow give mods a chance to tell their desire to enable zoom. The idea is that each mod can tell Minetest Game when it wishes to enable zoom. This “desire” can be revoked anytime. As long there is at least one mod which has a “desire” to allow zoom, zoom is enabled, otherwise it is disabled.

Here's my idea for this:

Example usage with 2 items:

  1. Zoom starts out disabled for our hero, “Player”
  2. Player wields the telescope item. The mod calls allow_zoom(Player, "telescope:telescope", true) when this happens. It is OK if this mod calls this function multiple times. Zoom is enabled.
  3. Player drinks the magic zoom potion and allow_zoom(Player, "example:zoompotion", true) is called. Zoom is still enabled.
  4. Now Player unwields the telescope which calls allow_zoom(Player, "telescope:telescope", false). But zoom is still enabled because the true of the magic zoom potion is still there.
  5. After 30 seconds, the effect of the zoom potion wears off, so allow_zoom(Player, "example:zoompotion", false) is called. Now there is no true left in the table and the zoom priv is lost.

Another very very minor issue with the approach is that obviously it is no longer possible to grant/revoke the zoom priv manually. However, I don't think this is a big loss, as I think the zoom priv should be not something an admin can control. So I don't mind if admins lose the ability to control zoom.

One solution to this would be to add a priv zoom_always which, when granted, always allows you to zoom regardless of the “zoom score” (number of trues in the internal table of allow_zoom). Technically, this could be done by calling allow_zoom for the duration of the priv being granted, which ensures the “zoom score” is at least 1.

But to be honest, this is just a silly solution IMO (and I do not recommend it), as this is a privilege to handle another privilege. I think this issue just shows how wrong it is to make zoom a privilege instead of, let's say, a HUD flag. See also: https://github.com/minetest/minetest/issues/4700


One question which remains: What about creative mode?


I think you, everamzah, are missing the point. It makes for more interesting gameplay as you can now have to “earn” the zoom feature by crafting an item first. This is better than having it on “always on” or “always off” or “admin decides what's best for you”. xD

The fact that F5 (and thus, the coordinates) is always available is a failure of the engine IMO, as this destroys the point of mods like orienteering in which you can craft tools which show your coordinates, pitch, yaw, etc. while you carry them. It's an engine failure because there is no way a mod can disable this, but there are good reasons why some mods or subgames do not want to have it accessible that easy. I have proposed to rework the debug mode stuff here: https://github.com/minetest/minetest/issues/4556

rubenwardy commented 8 years ago

Imo, it would be much better to have zoom controlled by hud flags. The zoom priv could then give and take when granted or revoked (I'm currently working on on_grant and on_revoke callbacks)

Wuzzy2 commented 8 years ago

@rubenwardy: https://github.com/minetest/minetest/issues/4556

Fixer-007 commented 8 years ago

I have binoculars and telescope IRL and it is soo much better with binoculars. I agree about idea in general :)

paramat commented 8 years ago

Hmm this has serious problems, i'll leave this open for discussion but will work on other stuff.

C1ffisme commented 8 years ago

I've never really needed the ability to zoom in, although maybe that's just my eyes. Most of the time, though, my render distance is set pretty low so my toaster of a laptop can run the game smoothly.

paramat commented 8 years ago

Best continue discussion in https://github.com/minetest/minetest/issues/4700

paramat commented 7 years ago

1881 merged.