Page 1 of 1

Formspec on surface

PostPosted: Sat Nov 21, 2015 20:25
by MirceaKitsune
https://www.youtube.com/watch?v=LBfUVIhFaLc

https://www.youtube.com/watch?v=PxLNIvuHj00

This is a feature I've been thinking about for a bit now, and there are certainly other Minetest users who agree it would be awesome to have. There are many engines that support interactive surfaces: The best example is Doom 3 (idTech 4), famed for having screens around the map that players can manipulate and click buttons on. Then there's Second Life, which supports interactive web pages on surfaces which you can click / scroll / etc like in any browser.

What I'm trying to suggest for Minetest is a simpler implementation: Formspecs on surfaces. First of all, I'm wondering whether it's possible to dynamically generate a texture from a formspec, which can be applied to any drawtype or surface. And second, if we can detect where the player's crosshair is pointing on that texture, so buttons and input fields can be clicked on and selected.

What purpose would it serve? Well doh... realistic terminals of course! We could create node definitions for screens, containing formspecs that operate nearby devices or have other effects on the surrounding world (calling Technic mod here). One idea: Keypads that open locked doors when you introduce the right combination. Obviously we can already do this... just that the formspec floats in front of the player who clicks the screen, whereas with this ability it would appear on the actual surface and work as an in-game touchscreen.

Here's a crude mockup of how what I'm imagining would look like:

Image

snapshot9.png
snapshot9.png (941.33 KiB) Viewed 2055 times

Re: Formspec on surface

PostPosted: Sat Nov 21, 2015 21:00
by kaadmy
+1 for this idea, but performance would suck ;)

Re: Formspec on surface

PostPosted: Sat Nov 21, 2015 21:05
by MirceaKitsune
kaadmy wrote:+1 for this idea, but performance would suck ;)


Don't think it would have to: The texture would only need to be re-generated when there's a change. What would be harder is detecting where every nearby player's crosshair is pointing on the surface, to highlight buttons and process clicks... but that shouldn't be way too heavy either. As with most features, the real problem will be finding someone with the knowledge time and energy to do it ;)

Re: Formspec on surface

PostPosted: Sat Nov 21, 2015 23:09
by Sokomine
Sounds cool at first, but might turn out to be more of an annoyance than help when actually playing. Navigating into a position so that the text can actually be read might quite often require noclip - a priv seldom granted on servers. Aiming at the right spot might also be tricky. And then there's clicking as such - left-click is usually digging, so that'd leave us with right-click - something we already got, although for the entire area.

I'm not sure if it's already possible to create i.e. 10 entities and let them hoover in front of a node and react to clicks. That way a keypad could be emulated.

Dynamic textures (especially with text) for inscriptions such as on signs would be far more helpful I think.

Re: Formspec on surface

PostPosted: Sun Nov 22, 2015 03:13
by benrob0329
MT would need a new texturing engine (I think) for this to be properly implemented. (Number one thing being dynamically textured nodes, number two being actual x/y/z of the crosshair on the node)

Re: Formspec on surface

PostPosted: Sun Nov 22, 2015 08:02
by jin_xi
Sokomine wrote:I'm not sure if it's already possible to create i.e. 10 entities and let them hoover in front of a node and react to clicks. That way a keypad could be emulated.


you can already do this and you really only need one entity. you can figure out where on the entity the click was with a simple calculation, see painting mod for an example.

Re: Formspec on surface

PostPosted: Sun Nov 22, 2015 12:18
by MirceaKitsune
jin_xi wrote:you can already do this and you really only need one entity. you can figure out where on the entity the click was with a simple calculation, see painting mod for an example.


Now that I think about it, this could be done with a single entity to some extent! Well maybe: You can detect where on the entity the player clicks, but how do you dynamically update the texture and make multiple clickable items? A combined texture can be used and updated ("tex1.png^tex2.png") for some drawn items, but how do you do things like text? You also can't have input fields that you can type into directly, as you would if a real formspec was being emulated.

Re: Formspec on surface

PostPosted: Mon Nov 23, 2015 17:01
by Hybrid Dog
l think at first, infotext should be put to the node and not to the top left