Page 1 of 4

[Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 15, 2018 05:15
by Piezo_
There's nothing more simultaneously exciting and terrifying than leaping off the top of a massive, snowy peak and gliding over the valley below.

That feeling of the icy wind rushing over you, the excitement rushing through your body... It's a thrill to die for.

Unfortunately, there's no way a thrill-seeker like you could get that kind of high in such a simple game with (let's face it honestly) such a sub-par physics engine, right?

W R O N G .

Feast your eyes on the hangglider mod!

Image

This mod adds a fully fun and functioning glider to minetest, that you can use to travel long distances through the air, without having to worry about fall damage!

This mod is based on cdqwertz's paraglider mod (LGPLv2.1), which I can't seem to find anywhere, and another parachute mod which I also can't seem to locate, but I remember was under the WTFPL, so it doesn't really matter.
(Jeez, it's like Amelia Earhart all over again with these mods...)

Feeling daring? Looking for thrills? Download now,and throw caution to the wind!

License: GPLv3+
Depends: default, wool
Supports: minetest_systemd, player_monoids, areas, wardzones

EDIT: I found the second mod (parachutes). It's here.
EDIT2: I found the first mod (Paraglider). It's in the rpgtest game

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 15, 2018 07:39
by texmex
Nice one, Piezo! Need to try this out.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 15, 2018 16:25
by voxelproof
Piezo_ wrote:There's nothing more simultaneously exciting and terrifying than leaping off the top of a massive, snowy peak and gliding over the valley below.


Thank You so much! Was dreaming about real flying for long time. I'm going to test it this weekend in Eden. I wonder if I crash into some nasty angel again. Btw they are a little bit of nuisance in Heaven, for example they obscured nice screenies attached to the linked post ;)

As you can see there's a lot of space for mountain sports there and flying among these rocky walls would be very exciting:

Image

EDIT: Instructions, please? :) How can I fly? (As for now I can only wield glider).

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 15, 2018 17:08
by Piezo_
voxelproof wrote:Instructions, please? :) How can I fly? (As for now I can only wield glider).


Left-click (use) the glider while already up in the air to open it.

Left-click again any time to close it.

The glider will automatically close when you're less than 0.5 nodes off the ground (i.e., when landing)

Note: There is a bug (in minetest, not this mod) that means attached entities will not appear properly in third person until you change/update view position. If you can't see the glider, try hitting F7 a couple times.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 15, 2018 18:03
by voxelproof
Piezo_ wrote:
voxelproof wrote:Instructions, please? :) How can I fly? (As for now I can only wield glider).


Left-click (use) the glider while already up in the air to open it.

Left-click again any time to close it.

The glider will automatically close when you're less than 0.5 nodes off the ground (i.e., when landing)

Note: There is a bug (in minetest, not this mod) that means attached entities will not appear properly in third person until you change/update view position. If you can't see the glider, try hitting F7 a couple times.


Great thanks once again! I've just checked it, it works (when I want a constant forward speed I just switch to auto-tap key function). Wonderful experience. Now the Minetest has gained a pair of truly awesome mountain mods (the other one is bike). And climbing has become yet more rewarding :))

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 22, 2018 18:21
by voxelproof
I've made a "tweaking" of the gravitational parameters of your mod. This is how condors fly ;)

Code: Select all
hangglider = {}
hangglider.use = {}

minetest.register_entity("hangglider:airstopper", { --A one-instant entity that catches the player and slows them down.
   hp_max = 3,
   is_visible = false,
   immortal = true,
   attach = nil,
   on_step = function(self, _)
      if self.object:get_hp() ~= 1 then
         self.object:set_hp(self.object:get_hp() - 1)
      else
         if self.attach then
            self.attach:set_detach()
         end
         self.object:remove()
      end
   end
})

minetest.register_entity("hangglider:glider", {
   visual = "mesh",
   visual_size = {x = 12, y = 12},
   mesh = "glider.obj",
   immortal = true,
   static_save = false,
   textures = {"wool_white.png","default_wood.png"},
   on_step = function(self, _)
      local canExist = false
      if self.object:get_attach() then
         local player = self.object:get_attach("parent")
         if player then
            local pos = player:getpos()
            if hangglider.use[player:get_player_name()] then
               if minetest.registered_nodes[minetest.get_node(vector.new(pos.x, pos.y-0.5, pos.z)).name] then
                  if not minetest.registered_nodes[minetest.get_node(vector.new(pos.x, pos.y-0.5, pos.z)).name].walkable then
                     canExist = true
                     if player:get_player_velocity().y > -1.5 and player:get_physics_override().gravity < 0 then
                        player:set_physics_override({
                           gravity = 0.005,
                        })
                     elseif player:get_player_velocity().y < -2 and player:get_physics_override().gravity > 0 then
                        player:set_physics_override({
                           gravity = -0.5,
                        })
                     end
                  end
               end
            end
            if not canExist then
               player:set_physics_override({
                  gravity = 1,
                  jump = 1,
               })
               hangglider.use[player:get_player_name()] = false
            end
         end
      end
      if not canExist then
         self.object:set_detach()
         self.object:remove()
      end
   end
})

minetest.register_on_dieplayer(function(player)
   player:set_physics_override({
      gravity = 1,
      jump = 1,
   })
   hangglider.use[player:get_player_name()] = false
end)


minetest.register_on_joinplayer(function(player)
   player:set_physics_override({
      gravity = 1,
      jump = 1,
   })
   hangglider.use[player:get_player_name()] = false
end)

minetest.register_on_leaveplayer(function(player)
   hangglider.use[player:get_player_name()] = nil
end)

minetest.register_craftitem("hangglider:hangglider", {
   description = "Glider",
   inventory_image = "glider_item.png",
   
   on_use = function(itemstack, user, pointed_thing)
      if not user then
         return
      end
      local pos = user:get_pos()
      if minetest.get_node(pos).name == "air" and not hangglider.use[user:get_player_name()] then --Equip
         minetest.sound_play("bedsheet", {pos=pos, max_hear_distance = 8, gain = 1.0})
         user:set_physics_override({
            gravity = 0.005,
            jump = 0,
         })
         local stopper = minetest.add_entity(pos, "hangglider:airstopper")
         stopper:get_luaentity().attach = user
         user:set_attach( stopper, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
         hangglider.use[user:get_player_name()] = true
         minetest.add_entity(user:get_pos(), "hangglider:glider"):set_attach(user, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
         
      elseif hangglider.use[user:get_player_name()] then --Unequip
         hangglider.use[user:get_player_name()] = false
      end
   end
})

minetest.register_craft({
   output = "hangglider:hangglider",
   recipe = {
      {"wool:white", "wool:white", "wool:white"},
      {"default:stick", "", "default:stick"},
      {"", "default:stick", ""},
   }
})


This can be enjoyed in full only in map generators creating really high mountains (this means that in none of the default ones, but the tweakings I've posted on the Forum are apparently created for your mod :) ) It would be also nice to see a constant forward speed added to this mod to get rid of the need of using the OS function of auto-tapping to emulate this feature.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 23, 2018 03:24
by kestral
Thank you, this is the mod that I've been looking for, especially after all the hours of paragliding around Hyrule I did last year.

I have also been playing around with your code, and have come up with my own additions:

  • Added an overlay when the hangglider is equiped. I'm not an artist so it's quite simple, but it does its job. I don't know how to disable the overlay when minetest is in third person, but I find the third person walking animation while flying just too distracting to use.
  • Added also unequipping the hangglider when landing in water.
  • Attempted to linearize the parabolic flight path, by starting with a stronger gravity, and gradually reducing it as the descent velocity increases.
  • Discovered that fast unequip/equip cycling min-flight would allow drastically longer flights than continuous flight. This shouldn't happen, and I've tried to fix it, but it's likely that I haven't taken care of all possible cases.
  • I also added a hud debug display to show various parameters, which is still enabled.

My updates are available at: https://github.com/kestral246/hangglider

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 23, 2018 17:51
by voxelproof
kestral wrote:
  • Discovered that fast unequip/equip cycling min-flight would allow drastically longer flights than continuous flight. This shouldn't happen, and I've tried to fix it, but it's likely that I haven't taken care of all possible cases.


Maybe this 'bug' shouldn't be fixed :) I've checked it out in-flight and, well, in my opinion it adds a lot of reality to the flying experience. It enables 'climbing' or gaining altitude so that it resembles taking advantage of upward air currents, which are in fact exploited by pilots to prolong their flights.

Thanks for the improvements :)

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 23, 2018 19:41
by voxelproof
If you set movement_speed_walk to 8 the immersion is nearly perfect when playing the 'tweaked' mod. In unmodified original version setting it to 20 makes real wingsuit base jumping experience. Thank you all for the great work!

Re: [Mod] hang-gliders [hangglider]

PostPosted: Sun Nov 25, 2018 08:41
by Piezo_
kestral wrote:Thank you, this is the mod that I've been looking for, especially after all the hours of paragliding around Hyrule I did last year.

I have also been playing around with your code, and have come up with my own additions:

  • Added an overlay when the hangglider is equiped. I'm not an artist so it's quite simple, but it does its job. I don't know how to disable the overlay when minetest is in third person, but I find the third person walking animation while flying just too distracting to use.
  • Added also unequipping the hangglider when landing in water.
  • Attempted to linearize the parabolic flight path, by starting with a stronger gravity, and gradually reducing it as the descent velocity increases.
  • Discovered that fast unequip/equip cycling min-flight would allow drastically longer flights than continuous flight. This shouldn't happen, and I've tried to fix it, but it's likely that I haven't taken care of all possible cases.
  • I also added a hud debug display to show various parameters, which is still enabled.

My updates are available at: https://github.com/kestral246/hangglider


Thanks! I'll look over it, and probably change a couple things. (Also: How do I merge to notabug from github? Never mind, I'll just put the link in the commit name)

Re: [Mod] hang-gliders [hangglider]

PostPosted: Sun Nov 25, 2018 23:45
by Piezo_
Update:
  • Added improvements made by kestral, with some changes
  • Glider now has durability

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 15:01
by kestral
Piezo_,

Thank you, I really, really like your Nov 25 code release. Your "changes" were significant improvements to how well the hanglider flies and operates.

The only additional change I've come up with is to ramp the speed override, like we did with gravity. That makes your increase in speed to 1.75 feel much more natural.

With my tweak to your Nov 25 version, I feel your hangglider mod is close to gliding perfection. I went back to my Wii-U and tried paragliding around Hyrule again, and it's really a tossup as to which *glider I prefer.

I've added this version of hangglider to my minetest.conf initial_stuff line, so I'll always have it available when I play minetest.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 15:52
by texmex
I like the general idea (of course), but I'm seeing a few bug here (player offset due to MT 5.0.0-dev):
Image

Also, hang gliders need constant speed to not plummet to the ground, no? :)

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 16:21
by voxelproof
texmex wrote:Also, hang gliders need constant speed to not plummet to the ground, no? :)


Yes, they are in fact walking parachutes propelled by the character's legs ;) To stop thinking about it (i.e. to maintain so-called 'suspension of disbelief) I resort to switching "auto-tapping' function on to the "w" key (if this function is enabled in Windows it's just pressing quickly "w" and then "Fn" keys consecutively).

However the speed of descent doesn't depend on the forward speed as in this mod there isn't implemented aerodynamic lift (yet?).

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 16:43
by kestral
texmex,

There's a line in the code with the offset for 5.x, but right now it's commented out and needs to be manually changed.

Is there some way for a mod to detect whether minetest is using the old 0.4.x character offset or the new 5.x character offset? That way it could be done automatically.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 17:03
by kestral
However the speed of descent doesn't depend on the forward speed as in this mod there isn't implemented aerodynamic lift (yet?).


With my speed tweak, which hasn't been reviewed or accepted for inclusion by Piezo_, the forward speed is made a function of the speed of descent. Kind of backwards, but it gives a similar effect—yes, as long as you keep pressing the 'w' key.

I'm not sure what Piezo_'s final intentions are for this mod, but I doubt he's trying to make a hardcore flight simulator within minetest.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 20:34
by voxelproof
kestral wrote:
However the speed of descent doesn't depend on the forward speed as in this mod there isn't implemented aerodynamic lift (yet?).


With my speed tweak, which hasn't been reviewed or accepted for inclusion by Piezo_, the forward speed is made a function of the speed of descent. Kind of backwards, but it gives a similar effect—yes, as long as you keep pressing the 'w' key.

I'm not sure what Piezo_'s final intentions are for this mod, but I doubt he's trying to make a hardcore flight simulator within minetest.


Interesting, I haven't tried your version yet, but the idea is very reasonable. As a matter of fact a sandbox game is not the best place to implement real physics and it's charm is in all those tricks that allow to simulate reality in a simple way.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 21:53
by Piezo_
texmex wrote:I like the general idea (of course), but I'm seeing a few bug here (player offset due to MT 5.0.0-dev):
Image

Also, hang gliders need constant speed to not plummet to the ground, no? :)


There is a version of the glider-spawning function on line 204 (commented out) that fixes this. Replace lines 67 and 198 with it to solve that issue. Once 5.0.0 shows up in more of the common repositories, I'll change this permanently. As of now, I'm on 4.17.

kestral wrote:
With my speed tweak, which hasn't been reviewed or accepted for inclusion by Piezo_, the forward speed is made a function of the speed of descent. Kind of backwards, but it gives a similar effect—yes, as long as you keep pressing the 'w' key.

I'm not sure what Piezo_'s final intentions are for this mod, but I doubt he's trying to make a hardcore flight simulator within minetest.


Sorry, despite the tone used in the initial post, this is more of a maneuverable parachute mod than a high-speed skydiving experience. (Although, I'll definitely take a look at the speed adjustment function)

Re: [Mod] hang-gliders [hangglider]

PostPosted: Wed Nov 28, 2018 22:10
by Piezo_

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 29, 2018 18:14
by voxelproof
Piezo_ wrote:Sorry, despite the tone used in the initial post, this is more of a maneuverable parachute mod than a high-speed skydiving experience. (Although, I'll definitely take a look at the speed adjustment function)


The main obstacle is imo the dependency on the default walking speed. When I played around with speed parameters of MT Game I've obtained pretty good wingsuit base jumping simulator, however I like long steady hang glider flying more.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Thu Nov 29, 2018 18:59
by texmex
Overriding player speed is easy. One should be able to get a always-speeding type of vehicle going which would be closer to a hang gliding experience.

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 30, 2018 01:19
by random_geek
Great mod! MT definitely needed this. I was going to make a hang glider mod anyways, so I'm glad I don't have to now. :)

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 30, 2018 02:21
by Piezo_
The next update might not be for a while. Between minetest_systemd, this, and the wield_redo mod I'm making, I've got my {hands, text_editor} full

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 30, 2018 04:38
by Lord_Vlad
Just so you know a bug that often happens to me is that when I open the glider I am teleported to the last place I opened it at... or sometimes at 0 0 0 (and I die)

Re: [Mod] hang-gliders [hangglider]

PostPosted: Fri Nov 30, 2018 04:47
by Piezo_
Lord_Vlad wrote:Just so you know a bug that often happens to me is that when I open the glider I am teleported to the last place I opened it at... or sometimes at 0 0 0 (and I die)


I'm sorry to say, I know about this one. It's caused by the airstopper, and I am still trying to find a solution, myself.