• Lua and Orbital Planets
    16 replies, posted
[B][U]I DO NOT EXPECT YOU TO BE ABLE TO ANSWER ALL THESE QUESTIONS OFF THE TOP OF YOUR HEAD[/U][/B] Don't whine saying, "How would I know? Durp this thread sucks." So, I'm sure most of us have at one point winshed that [url=http://www.facepunch.com/showthread.php?t=423976]Ulysses Universe[/url] was a reality, and since then, I have been wondering a few questions. Since I know well-organized threads usually get more positive attention, I am going to divide this up into nice neat sections :buddy: [INDENT][b]My Idea[/b] I am not thinking exactly along the lines of Megiddo, but rather from the perspective of Super Mario Galaxy. I've never actually played the game myself, but I know that you can fly around, and little mini-planets will pull you in at a relatively realistic orbital. It is also similar to [url=http://universesandbox.com/]Universe Sandbox[/url]. Basically, you could have a game where you don't exactly physically land on and interact with planets, but rather orbit around them, and I have a few questions regarding this. [b]NOTE: I will use an example based around just [i]one[/i] planet, too keep things simple.[/b] [b]Questions[/b] [LIST] [*][b]Would it be possible to make this? If so, how hard/easy would it be?[/b] Would it just be a matter of setting the player's view angles, model angles, and applying force toward the point? Obviously there would be some other crap you would have to di, but is this the basics of all it would take? [*][b]If you did the above, would that be enough to make semi-realistic orbitals?[/b] Maybe if you constantly pulled the player toward the planet, it would not create a real orbit. Would it need to pull the player towards where the planet [i]was[/i] on the [i]last[/i] frame? Maybe this would make the player's momentum balance out the downward pull and create a valid orbit. Also, in a real orbit, when you speed up (Say, with a jetpack) you would end up in a new orbit with a larger radius, and if you slow down, the opposite would happen. Would this have the same effect if you created it in Gmod? [*][b]Do you think this would be laggy as hell?[/b] Making all those adjustments every single frame to every player might cause massive lag, or it might not. [*][b]Assuming a single planet worked, do you think doing multiple calculations for multiple maps would work as well?[/b] Obviously, you wouldn't set the players rotation based on the planets if this was the case (Players flipping randomly around as they pass by different planets), so you would have to create some kind of complex movement system, but otherwise this looks like it would work. Why/why not would it (not) work? [*][b]Does anyone want to go ahead and try to start testing this idea?[/b] I am not asking you to do this, but I just don't think I'm up for the challenge, and I was wondering if there was someone who actually wanted to give this a shot. [/LIST][/INDENT] If you have some ideas about the answers, or some other thoughts, tell me. I crave your input, because as I'm playing it out in my head, this idea doesn't seem like it would work right. Especially if you look at [url=http://www.facepunch.com/showthread.php?t=798136]this thread.[/url] [editline]01:36AM[/editline] Also the title doesn't quite make sense... Orbital planets? Oops.
That was basically UU. Adjusting camera and simulating gravity.
I've tried to rotate the player once, here it is: [hd]http://www.youtube.com/watch?v=iF7zLbu5NiI[/hd] It was buggy as hell and I gave up after a few days of dev'ing. Should I continue?
[QUOTE=The-Stone;22085394]I've tried to rotate the player once, here it is: [hd]http://www.youtube.com/watch?v=iF7zLbu5NiI[/hd] It was buggy as hell and I gave up after a few days of dev'ing. Should I continue?[/QUOTE] If you can and feel like it, yes! Seems I could use it in a later stage to :D
I remember a while back there was someone who was making a script that made you stick to spherical planets, with the top of your head always pointing away from the center of the planet while you were on it so you would rotate....Idk if he ever finished it though.
[QUOTE=The-Stone;22085394]I've tried to rotate the player once, here it is: [URL="http://www.facepunch.com/#"]View HD YouTUBE video[/URL] [URL="http://youtube.com/watch?v=iF7zLbu5NiI&hd=1"]http://youtube.com/watch?v=iF7zLbu5NiI[/URL] It was buggy as hell and I gave up after a few days of dev'ing. Should I continue?[/QUOTE] Please do :buddy:
There is also some source mod where you can tilt and walk on walls and stuff, but I forget what it was called... Imma go find it. [editline]05:56AM[/editline] It's called Ballmen. [media]http://www.youtube.com/watch?v=J6JtH2Gg7EA[/media] [media]http://www.youtube.com/watch?v=oWYuFLdTgKU[/media]
Recently I actually began work on literally the exact same idea. Here's how far I've gotten: [url]http://pastebin.com/7xFx8Evu[/url] I kind of gave up when I had some issues calculating gravitational force between multiple planets and the thing kept spazzing out. However, if you just do one planet it works nicely and things will even orbit and all. It's pretty cool. As you can also see, I was working on setting the player's angles, which kind of works but not really.
Jo The Shmo I found a way better video than ballmen: [hd]http://www.youtube.com/watch?v=tEYWy9eftF4[/hd]
Please do not let go of this, it is the most epic project I've ever seen! Can you imagine the popularity Spacebuild would get with this??? KEEP UP THE GOOD WORK! :D
I was working on something like this a while back. I converted the source engines gravity to lua. Hopefully it can help you on your quest. [lua] -- init.lua -- In GM:Initialize() RunConsoleCommand("sv_gravity", 0) --- In GM:PlayerSpawn(ply) ply:SetNWVector("Gravity", GRAV_DEFAULT) -- Test Function: concommand.Add("grav", function(ply) local Ent = ents.Create("prop_physics") Ent:SetPos(ply:GetEyeTrace().HitPos + Vector(0, 0, 5)) Ent:SetModel("models/props_junk/wood_crate001a.mdl") Ent:Spawn() Ent:Activate() physenv.SetGravity(GRAV_TEST * -1) ply:SetNWVector("Gravity", GRAV_TEST) end) -- shared.lua GRAV_DEFAULT = Vector(0, 0, 800) GRAV_TEST = Vector(0, -600, 0) function GM:SetupMove(ply, movedata) if(!ply.BaseVelocity) then ply.BaseVelocity = Vector(0, 0, 0) end movedata:SetVelocity(movedata:GetVelocity() - (ply:GetNWVector("Gravity", GRAV_DEFAULT) * 0.5 * FrameTime())) movedata:SetVelocity(movedata:GetVelocity() + (ply.BaseVelocity * FrameTime())) ply.BaseVelocity:Zero() return true end function GM:Move(ply, movedata) self:SetupGroundVelocity(ply) end function GM:SetupGroundVelocity(ply) local newGround = ply:GetGroundEntity() local oldGround = ply.GroundEntity if(newGround != oldGround) then local BaseVelocity = ply.BaseVelocity if(newGround and !oldGround) then if(IsValid(newGround)) then BaseVelocity = BaseVelocity - newGround:GetVelocity() BaseVelocity.z = newGround:GetVelocity().z end elseif(oldGround and !newGround) then if(IsValid(oldGround)) then BaseVelocity = BaseVelocity + oldGround:GetVelocity() BaseVelocity.z = oldGround:GetVelocity().z end end ply.GroundEntity = newGround ply.BaseVelocity = BaseVelocity end end function GM:FinishMove(ply, movedata) movedata:SetVelocity(movedata:GetVelocity() - (ply:GetNWVector("Gravity", GRAV_DEFAULT) * 0.5 * FrameTime())) return true end [/lua] I never tested this in multiplayer but it should work great.
I will try to make sandbox with that, brb in a moment :D. EDIT: Works amu-avesomly. Like gm_vphysics just you can apply other values to other ents :3. Have useful rating! EDIT: Still cant "walk on wall" (not talkin bout rotating), i guess you would need to mess with C++ or remake walking in Lua....
Also, [url]http://www.youtube.com/watch?v=gmzsJA0rePY[/url]
[hd]http://www.youtube.com/watch?v=XTtt0_ZLlq0[/hd]
This is taking player environment interaction to a whole new level i always felt like spacebuild was just attaching thrusters to big props, getting in the props and turning the gravity off (which it is, on a basic level) but this could revolutionise spacebuilding altogether, if anyone gets proper planet gravity going [QUOTE=Diet Taco;22127686]Please do not let go of this, it is the most epic project I've ever seen! Can you imagine the popularity Spacebuild would get with this??? KEEP UP THE GOOD WORK! :D[/QUOTE] THIS
I'm just curious, has anyone gotten anything? Is there any progression or anything? I'm willing to test / host anything on my dedicated server. [U]Please don't let this die![/U]
If they had they would probably post it. Please don't bump two week threads just to ask if there's anything new.
Sorry, you need to Log In to post a reply to this thread.