Players Walk on ships whilst it is moving +Code

Discussion in 'Suggestions' started by Alixander, Nov 27, 2017.

?

Is this something you want to see as well?

  1. Yes

    95.8%
  2. No

    4.2%
  1. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    So I have been playing the game for a while now, and I have an idea for how the devs can improve upon the game. Both me and a lot of my friends have all wanted the ability to walk around on ships whilst they are moving.

    Now this is probably not a high priority on the devs todo list but it would be a nice thing to add to this fun game. So I went and programed it myself. Now I would like to get one thing out of the way first, I had to do a bit-lot of guess work on how the devs created and programed their scripts. Therefor I tried to make the code as generic as possible, as an attempt at making it as easy as possible to implement into the game as feast as possible.

    So how does it work? When the player disables their jet pack with in a ship, or close enough to one, the player will align to the ship's rotation. Then apply gravity to them in order to simulate the ship's gravity generator in game. As it does this it also add the player to the ships root parent, the highest point in the hierarchy assuming they use that system. The downside to this is if the ship gets deleted then the player will also be deleted, so some code will have to check and remove all players currently on board the ship being destroyed. But it does allow the whole shop to be destroyed before that would happen.

    Here is a Youtube link to a video that I made showing the system off in a basic form. Sorry for the quite mic.


    I have tried to comment the code as best as I can. I will also be giving the code out here for all to have, including the devs so they can hopefully implement it into the game :D.

    Adding a system like this would reduce the lag on servers due to the reduction in CVs. Instead of having 10 v 10 CV battle you might have a 2 v 2 with each ship having a crew of 5 members, these members would have rolls like; pilot, damage control, ammo crafter and gunner even someone refueling the SV as they land of the ship during the fight.

    How to Install/ use, Add ether PlayerShipGravityCompressed.cs or EnablePlayerToWalkOnMovingObjects.cs (names :D) located with in "Gravity consept\Assets\Scripts\WalkAroundOnShips" onto the player model and done :D. that is it. You will need to change a few things in order to get it to work with your system, but I have tried to guess as much as I can so it should not take to long to fix.

    Here is the link to the Unity build file, if you want to try it out.
    https://ufile.io/o1r3e

    Here is the link to the whole unity file.
    https://ufile.io/kobon

    I have used uploadfiles.io so the links will expire within a month, just message me and I will re-add them if anyone still wants the files.

    I am giving this code out freely for all to have :D (I am nice), because I want to help support this amazing game however I can.

    //=========================

    // Written by Connor Alexander Marshall

    // Steam Profile: http://steamcommunity.com/id/Alix_141/

    // Email: [email protected]

    //=========================
     

    Attached Files:

    #1
    Maris, piddlefoot, Bollen and 31 others like this.
  2. Sofianinho

    Sofianinho Captain

    Joined:
    Sep 7, 2016
    Messages:
    77
    Likes Received:
    174
    #2
    Mortlath and Alixander like this.
  3. Zaflis

    Zaflis Commander

    Joined:
    Sep 15, 2017
    Messages:
    87
    Likes Received:
    65
    I just want to add that you can extend that very easily to CV-CV-CV-CV-... any number of times... docking, all the while player can walk on all of them while the most parent ship moving.
     
    #3
    Alixander likes this.
  4. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    Yes you definitely can, just instead of parenting the player you would do it to the CVs.
     
    #4
  5. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    #5
    Sofianinho likes this.
  6. Hummel-o-War

    Hummel-o-War Administrator Staff Member Community Manager

    • Developer
    Joined:
    Jun 15, 2015
    Messages:
    5,403
    Likes Received:
    8,417
    I be already forwarded your proposal .. and the devs will review the idea ASAP (as far as I heard, this is a good idea..:)
     
    #6
  7. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    Thank you very much for the reply and the forward. Reading this makes me so happy that a fun game can get even batter.
    If you or anyone has any questions I have more than happy to help :D
    See you in game.
     
    #7
    Gawain and Mortlath like this.
  8. banksman45

    banksman45 Rear Admiral

    Joined:
    Jun 6, 2016
    Messages:
    1,145
    Likes Received:
    3,238

    I would love to see this added to the game.
    This is why we need too allow MODDERS to to have access to this game. The devs already have soo much to do already. You can open this game up to modding and let gamers like this gentleman to start adding into the overall game development and not have to wait. What some dev teams have done in the past is take a look at certain mods and add the mods they like to the core game itself.. So everybody will have access to the same thing.
     
    #8
  9. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    I fully agree with you on that. If this game was open up to the modding community it could be overhauled/changed/improved upon/ update over night :D, I know I have a lot of ideas for Mods for the game. If you take a look at Factorio their dev team is doing this very thing, and the game has only benefited from it.
     
    #9
  10. banksman45

    banksman45 Rear Admiral

    Joined:
    Jun 6, 2016
    Messages:
    1,145
    Likes Received:
    3,238
    Yes and Space Engineers started doing this two years ago. There are some pretty cool features in Space Engineer today that used to be mods.
    I would love to see what you guys could do with Empyrion because I've heard some pretty epic ideas from people who would love to mod this game.
     
    #10
    ion_storm and Alixander like this.
  11. Doc 2

    Doc 2 Lieutenant

    Joined:
    Mar 3, 2017
    Messages:
    1
    Likes Received:
    3
    yes the game should be more "moddable" I have so many ideas.
    Love this idea, thank you mate!
     
    #11
    ZipSnipe, banksman45 and Alixander like this.
  12. Blaine

    Blaine Commander

    Joined:
    Oct 30, 2017
    Messages:
    32
    Likes Received:
    125
    @Alixander, much respect for researching and coding this yourself. Most of us just ask for or suggest new features, but you went the extra mile and actually got your hands dirty.

    The technical term for the phenomenon of walking on a ship while it's in motion (or sitting in a car seat, standing on a subway train, etc.) is "inherited momentum." Space Engineers has this feature, and believe me, it's amazing. This definitely needs to make its way into Empyrion as soon as possible.

    I don't think you'll find a single "No" on that poll. Everyone wants this.
     
    #12
  13. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    Thanks for the extra info about the subject. I have put a few hours in space engineers and Starmade, who has a similar mechanic and it is a lot of fun to wonder around a ship during long travel times or when plummeting towards a planet XD
     
    #13
    banksman45 and Sofianinho like this.
  14. ravien_ff

    ravien_ff Rear Admiral

    Joined:
    Oct 22, 2017
    Messages:
    6,275
    Likes Received:
    11,936
    This would add so much immersion especially for coop.
     
    #14
    DuLux, banksman45 and Mortlath like this.
  15. Methule

    Methule Lieutenant

    Joined:
    Jun 30, 2017
    Messages:
    5
    Likes Received:
    19
    The biggest problem with this will be when a player walks off a ship without toggling the J(etpack) key. You'll have to come up with a system that checks many times a second to verify that the player is still on the ship, drawing resources. It might not be an expensive operation, but it's not as simple as a toggle and forget code.
     
    #15
    Alixander likes this.
  16. Zaflis

    Zaflis Commander

    Joined:
    Sep 15, 2017
    Messages:
    87
    Likes Received:
    65
    It shouldn't be any more expensive than the act of checking if player collides with ship or not. Unity's physics engine is efficient at what it does. Bigger problem is actually deciding what "inside the ship" means. Do you need to be in a sealed room or just inside the bounding box? There's various things to consider.
     
    #16
    Alixander and Sofianinho like this.
  17. Nogitsune

    Nogitsune Rear Admiral

    Joined:
    Jul 16, 2017
    Messages:
    20
    Likes Received:
    18
    Don't think the checking part is even worth mentioning. You can just compare it to motion sensor's trigger box.

    If the system works based on having jet pack turned off, then it could probably just rely on gravity to do it's thing: if player falls off the ship, they'll fall towards ship's down vector, and eventually end up below the ship. The connection could be severed when the player has fallen far enough below the ship (e.g. below lowest point of ship's collision box). For some obscure situations though, where player might fall off the ship and then ship turns around so that player actually has fallen towards ship's up or side - but is now too far away for gravity to kick in.... well, it should work well enough to just sever the link if player is outside ship's grid, and let the gravity (and ship's movement) affect them while they are within.

    It's not perfect, it could lead to some rather funny issues where player has fallen outside the ship, ship does a barrel roll, and player matches the roll in the open space next to ship. Perfect fleet flight. But other solutions would be more complicated, and defining what is 'sealed room' is difficult. A hangar might not be pressurized, but could still be 'sealed room' in a sense.
     
    #17
    Last edited: Dec 17, 2017
    Alixander and Sofianinho like this.
  18. ravien_ff

    ravien_ff Rear Admiral

    Joined:
    Oct 22, 2017
    Messages:
    6,275
    Likes Received:
    11,936
    Tie it in with the gravity generator. It would make sense lore-wise as well.
     
    #18
    IronCartographer and Alixander like this.
  19. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    It would not be hard to implement. Right now in the code I am just amusing each floor has its own gravity.
     
    #19
    Sofianinho likes this.
  20. Alixander

    Alixander Lieutenant

    Joined:
    Nov 27, 2017
    Messages:
    10
    Likes Received:
    48
    My code works by pulling the player down (relative), which is how gravity works (basically). So if you walk off the ship you have a down force with nothing to oppose said force so you would fall off the ship, and space having no resistance would not stop you from moving at all. The only time I would see a problem with this would be on planets, where there is a fixed "down".
     
    #20
    ThumbsUp, ZipSnipe and Sofianinho like this.

Share This Page