[Mod] hang-gliders [hangglider]

Should the glider controls change to be like elytra, or keep the paraglider mod's?

Poll ended at Sun Dec 23, 2018 21:13

Paraglider
6
50%
Elytra
6
50%
 
Total votes: 12

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

[Mod] hang-gliders [hangglider]

by Piezo_ » Post

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
Last edited by Piezo_ on Wed Jan 09, 2019 02:30, edited 6 times in total.
while (true) { suffer(); }

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] hang-gliders [hangglider]

by texmex » Post

Nice one, Piezo! Need to try this out.

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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).
Attachments
Eden_mountains.png
Eden_mountains.png (699.68 KiB) Viewed 3871 times
To miss the joy is to miss all. Robert Louis Stevenson

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [Mod] hang-gliders [hangglider]

by Piezo_ » Post

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.
while (true) { suffer(); }

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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 :))
To miss the joy is to miss all. Robert Louis Stevenson

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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.
To miss the joy is to miss all. Robert Louis Stevenson

kestral
Member
Posts: 95
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

Re: [Mod] hang-gliders [hangglider]

by kestral » Post

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

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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 :)
Last edited by voxelproof on Fri Nov 23, 2018 20:42, edited 1 time in total.
To miss the joy is to miss all. Robert Louis Stevenson

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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!
To miss the joy is to miss all. Robert Louis Stevenson

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [Mod] hang-gliders [hangglider]

by Piezo_ » Post

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)
while (true) { suffer(); }

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [Mod] hang-gliders [hangglider]

by Piezo_ » Post

Update:
  • Added improvements made by kestral, with some changes
  • Glider now has durability
while (true) { suffer(); }

kestral
Member
Posts: 95
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

Re: [Mod] hang-gliders [hangglider]

by kestral » Post

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.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] hang-gliders [hangglider]

by texmex » Post

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? :)
Attachments
screenshot_20181128_165043.png
screenshot_20181128_165043.png (587.45 KiB) Viewed 3871 times

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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?).
To miss the joy is to miss all. Robert Louis Stevenson

kestral
Member
Posts: 95
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

Re: [Mod] hang-gliders [hangglider]

by kestral » Post

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.

kestral
Member
Posts: 95
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

Re: [Mod] hang-gliders [hangglider]

by kestral » Post

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.

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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.
To miss the joy is to miss all. Robert Louis Stevenson

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [Mod] hang-gliders [hangglider]

by Piezo_ » Post

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)
while (true) { suffer(); }


User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: [Mod] hang-gliders [hangglider]

by voxelproof » Post

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.
To miss the joy is to miss all. Robert Louis Stevenson

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] hang-gliders [hangglider]

by texmex » Post

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.

random_geek
Member
Posts: 55
Joined: Wed Jun 20, 2018 18:55
GitHub: random-geek
In-game: Techy5 random_geek

Re: [Mod] hang-gliders [hangglider]

by random_geek » Post

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. :)

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [Mod] hang-gliders [hangglider]

by Piezo_ » Post

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
while (true) { suffer(); }

User avatar
Lord_Vlad
Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] hang-gliders [hangglider]

by Lord_Vlad » Post

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)

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [Mod] hang-gliders [hangglider]

by Piezo_ » Post

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.
while (true) { suffer(); }

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 8 guests