Ludeon Forums

RimWorld => Mods => Unfinished => Topic started by: Houkime on January 29, 2017, 05:10:00 PM

Title: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on January 29, 2017, 05:10:00 PM
Description:

Allows spaceships to have detectable interiors (no structural beams needed) and allows them to do suborbital jumps. With planned animation (droppod style).
Currently in early stage with working (i.e jumping) prototype done.
Prototype can currently transport pretty much everything except zoning.
Without animation yet.

After developed it is supposed to be integrated with things like RimVerse and such and be a framework for other mods.
Feel free to use detailed concept below and code in your mods (or continue it yourself if I abandon this). Just keep in mind that everything is subject to change.
All tips are welcome.

Mechanics:

Modified ship ComputerCore.
When commanded to launch a suborbital jump does following (at least this is a plan):

1. Detects ship boundaries and returns ship area as List<IntVec3>. (yes)
2. Constructs full lists of floors, walls and other buildings, pawns and things (possibly zones) inside ship area. (yes)
3. Asks player to select destination (like transportPod). Uses the constructed catalog to project ship boundaries allowing to select suitable place for landing. (yes)
4. Despawns entire ship except for ComputerCore itself and packs it into inner storage. (yes)
5. Using massive Draw() override and disabled Print() projects an illusion of a ship (based on the stored info) instead of despawned actual ship. (not yet)
6. Performs takeoff animation. (not yet)
7. Forms DropPod-like object on the global map but with more content attached to it. (yes)
8. Travels. (yes)
9. On arrival spawns ShipComputerCore that makes an illusion again and on touch down spawns everything. (no illusions yet)

Progress:

Step 1. Simple Illusions. (done)
Managed to make ShipComputerCore mimick different flooring and buildings with Draw() or Graphic() overrides.

Also managed to make ShipComputerCore look like it launches itself in the sky on command despite it being a building (you need to conditionally override Draw, DrawPos, disable Print and call a dirtymesh cleanup for this.)

The reason I did this first is because flooring in game is very different from Things and you need special tricks to make it move smoothly. I wasn't sure it is possible from start but seems like it is mostly ok.
Ideally I will also mimick items and pawns and lights and shadows but it seems like it should be ok so I better prove other stuff first.

Step 2. Ship boundary detection (Done. Ship area is now connected together by any floors and walls)
Created basic selection overlay for ShipComputerCore to visualize ship area.
Decided to make first iteration of area to be Everything that is connected by walls or floors with the Core.
Wrote a recurrent algorithm for boundary detection and it works.
Right now floors-not floors is decided by having/not having a blueprint def in Terraindata. I did it because i wanted for mod to be as compatible as it can.

Step 3. Basic ship contents detection. (done)

Ship now correctly detects all flooring, walls, buildings, items, dirt and pawns inside without double detections. No roof detection yet.
I also overwrote gamend spacelaunch conditions so that ship can now search for needed parts on entire ship grid. Ideally it will require them to be powered.

Step 6. Basic worldmap/localmap landing area selection interface. (done)

Made a raw but working adaptation of user interface from compLaunchable.

Step 7. Basic Travelling Spaceship worldobject. (done)

Prepared mostly-empty but working "spaceship" that is created on launch, is visible on map, travels to destination, sends a message on arrival and is ready to be filled with shipgrid info and actions.

Section: This Map-> This Map transportation tests (via Travelling Spaceship worldobject)
                Step 8. Floor transport. (done)
                 
                          If launch was ordered from pause state... then some unknown...  bad thing ( it brought me a lot of headache) tried to nullify flooring storage of a ship on unpause. Protected my ship storage by adding special setter which DOES NOT allow nullification... and now it seems to work... Yes, Rimworld is a dangerous place indeed.
...Maybe i can use the setter to catch this flooring thief ( like "oh... the value you want to set is null... Can you tell me your name, please?"), but I don't know how to do it yet.

                Step 9. Item transport. (done)
                Step 10. Building transport. (done)
There is a bug in game where simultaneous deletion of walls with doors inserted like X|-|-|X results in a bunch of errors. Was forced to invent a workaround for this. Now works without errors.
                Step 11. Pawn transport.(Done. At least no bugs noticed yet.)
Used 40kInjector (see Acknowledgements).
Detoured Pawnsfinder.get_AllMapsCaravansAndTravelingTransportPods
Detoured PawnsUtility.IsTravelingInTransportPodWorldObject(Pawn pawn)
Now pawns in spaceships should be counted as pawns in droppods.
                Step 12. Roof detection and transport.(done but no hanging outside roof detection yet. For number of reasons including potential problem avoidance and aerodynamical realism it is probable that it will remain this way.)

Step 13. Full destination selection interface with multicell checks based on ship area. (done)

Section: This Map-> Other Map transportation tests.
                Step 14. Automatic landing area selection.(Seems to be working. It is random so hard to tell.)
                Step 15. Attacking other bases. (Done. Well, at least it seems to work.)
There was a funny bug with generated map for some reason starting with null sections[] but putting MapDrawer.RegenerateEverythingNow() was enough to counter this.
There is only one deployment method at the moment and it is "at the edge".
I was experimenting mostly with small "spaceships" though and it looks like bigger ones should have much more trouble with finding place to land.
Don't know what to do with that for now. Maybe less limitations on where it is possible to land (right now for every cell of the ship it is similar to droppod except for it cannot punch through roofs) or an ability to crashland.
                Step 16. Settling with spaceship. (done with cat sleeping on knees)



[Note] Keep in mind that animation is not really necessary for mod to add to gameplay.
If all animation efforts will fail I will just use default screenfader to white to hide the moment of launch. (I will put it there anyway till animation is done)
So when Step 16 is done I will call it a working prototype.

Section: Static ship illusion.
             Step 1. Floors.
             Step 2. Buildings.
             Step 3. Items.
             Step 4. Pawns.
Step 5. Takeoff and landing animations.
Step 6. Shadows and lighting.

Screenshots:

On this screenshot cyan "ship" outline is shown.
ShipComputerCore pretends that it is just wooden plancks and certainly not a modified core.

(http://i.imgur.com/OIZFN6e.jpg)

Landing site selection interface (on world map standard droppod interface is used.)

(http://i.imgur.com/cQLE5f8.jpg)

(http://i.imgur.com/8BqudZK.jpg)

Abanqueiro was tired of short jumps that evil Houkime forced him to do over and over (and also from other colonists trying to catch his jumping cabin) and this time jumped much farther.

A few seconds before jump:
(http://i.imgur.com/rV7nnYZ.jpg)

And after his multi game-hour flight:
(http://i.imgur.com/coQl4jx.jpg)


Acknowledgements:

Detours (2 methods) in this mod are made using 40KInjector which is cpt. Ohu's convenient repack of CCL-team detouring methods. Injector was taken from his colossal mod Warhammer 40K Corruption. You can find it here:
https://ludeon.com/forums/index.php?topic=28422.msg286833#msg286833


Downloads:

A bit bugfixed GridTOL prototype is attached.

[attachment deleted by admin due to age]
Title: Re: [A16][WIP] Grid Takeoff and Landing. Suborbital launch of ship with interiors.
Post by: Thirite on January 29, 2017, 08:53:14 PM
After hearing the RimVerse guy hadn't even created a prototype before posting his thread I was pretty doubtful if he was going to make anything. I hope to see a proof of concept soon! I want to see crazy FTL style mechanics happen.
Title: Re: [A16][WIP2/8] Grid Takeoff and Landing: Suborbital jump for ship with interiors.
Post by: Houkime on January 30, 2017, 03:04:44 AM
I was sad about RimVerse, too. :(
My project is much smaller, much more specific and should be easier.

And BTW I just completed second stage ^_^.

Next two steps will probably be the most complex ones.
#6 should be easy and quick enough once grand illusion is done.

Title: Re: [A16][WIP2/8] Grid Takeoff and Landing: Suborbital jump for ship with interiors.
Post by: Rilamus on January 30, 2017, 02:27:23 PM
This looks amazing. I personally think this would be very useful towards  endgame colonies that are starting to lag.
Title: Re: [A16][WIP2/8] Grid Takeoff and Landing: Suborbital jump for ship with interiors.
Post by: Hydromancerx on January 31, 2017, 05:50:40 PM
Could this be made to be used for boats? So one could build say a boat on a coastal tile and then travel to other coastal tiles. Maybe even settle on an ocean tile.
Title: Re: [A16][WIP2/8] Grid Takeoff and Landing: Suborbital jump for ship with interiors.
Post by: Thirite on January 31, 2017, 07:17:47 PM
Quote from: Hydromancerx on January 31, 2017, 05:50:40 PM
Could this be made to be used for boats?

By Houkime's description I would strongly suspect that to be so.
Title: Re: A16 [WIP16/16] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 04, 2017, 12:06:31 PM
Hooray!

Completed all 16 steps.
Will test and debug it for a bit (haven't performed some electricity tests yet) and then upload here.
Title: Re: A16 [WIP16/16] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Thirite on February 04, 2017, 04:43:13 PM
HYPE GET
Title: Re: A16 [WIP16/16] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Goldenpotatoes on February 04, 2017, 04:51:22 PM
Is this a dream? If so, I don't think I want to wake up.
Title: Re: A16 [WIP16/16] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: ChaosChronicler on February 04, 2017, 11:34:12 PM
Wait, Does this mean I can create Dropships?

*Klendathu Drop Intensifies*
https://www.youtube.com/watch?v=CIGHCoVzqtk
Title: Re: A16 [WIP16/16] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 05, 2017, 08:22:41 AM
Ok, here's the very first raw toy to play with. Please do not try it on your beloved colonies because I don't really know how stable and balanced it is (WARNING: it is most probably NOT stable at all. You better not expect anything to work.) and also it does not yet really integrate with a standard gamend with credits.
So it is more of a proof of concept and a possibility to see something right now.
Attached folder to the first post.

Rules:
Ship is everything connected by floors (like if thing stands on floor) and walls to your ship core.+ you can attach structural beams, ship reactors, engines and solar arrays externally. (floor also can connect to an adjacent wall)
For ship to perform suborbital jumps it needs to have Reactor and Engine somewhere in the ship.
No crew required unless it is raid (which is lost if you are not there obviously) because AI core is quite a person with a mind of its own.
Though unmanned stuff is not really tested yet outside of hops on the map.

Tips and tricks:

During raid you can rejump with your ship to be able to manually select better landing spot... and to be very cheaty...

When raid starts you can zoom in into raided base or click on your colonists in the colonists bar to dive into action. (it is vanilla stuff that it does not automatically jump camera to raid but instead pauses time. Maybe i will change this.)

Known issues and just untested things:

Bed ownership is reset in flight.
Hydroponics and plant pots are untested.
Saving during flight is not recommended because I did no data exposing yet (was in a big hurry). Flights are short though.
Prisoners and enemies (if so happens..) are yet untested (and most likely broken).
Large ships are not really tested. I haven't got any troubles yet but it seems like landing problems are very likely to arise especially in forests.
Haven't decided what ship is supposed to do if landing fails yet.

Quote from: ChaosChronicler on February 04, 2017, 11:34:12 PM
Wait, Does this mean I can create Dropships?

*Klendathu Drop Intensifies*
https://www.youtube.com/watch?v=CIGHCoVzqtk


Sort of. Can get in. Can fight. Can get out with loot. Don't know about efficient designs though yet.

(http://i.imgur.com/PKekLOj.jpg)
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Seeker89 on February 05, 2017, 08:58:35 AM
That's just great... I can now make a mobile kill box
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Goldenpotatoes on February 05, 2017, 09:55:20 AM
(http://i.imgur.com/h2DPh4z.png)

Pretty fun, dropping a whole ship next to an outpost and letting the turrets take the blunt of the attack to chew up defenders is good stuff.

Beds don't keep prisoner/hospital markings, probably same reason why ownership gets reset.

Prisoners/enemies seem to work fine, at least surviving the jumps with no issues in the log.

Plants throw an error in the log about spawning a destroyed item, but seem to work otherwise.

Stockpiles are ignored when launching, which really isn't an issue as more of a slight inconvenience.

Potential issue when launching transport pods and ships close together. I launched a transport pod and a ship to the same destination one after the other, and..
(http://i.imgur.com/HFAMuLq.png)
(http://i.imgur.com/Ev0NPjI.png)

Breaking things is pretty fun.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 09, 2017, 01:12:54 AM
Update time.
Fixed resetting bed designations and ownership.
Seems to be fine now. Transported prison bedroom highlight now becomes blue for some reason. Seems to work nevertheless.
Pawns even remain in their beds unless timezone shift is too big.
And as a fun bonus get Disturbed Sleep.)
(Animals are a bit more alarmed about flight though and can get up for a bit)

(http://i.imgur.com/ZxZ95lu.jpg)

(http://i.imgur.com/GZvkh1B.jpg)
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: tiger33116 on February 09, 2017, 11:49:43 AM
This is awesome looking.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Dragoon on February 09, 2017, 02:13:24 PM
ptf
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Goldenpotatoes on February 09, 2017, 08:13:08 PM
Considering it already takes stock of everything within the ship's area, would it be possible to have them work like a regular caravan where you can land directly on a friendly outpost to trade, like with on-foot travel? It's not exactly a huge issue at the moment considering the work-around is just landing a tile next to them and bringing what you want to sell on-foot, but it'd be nice to just land on the tile, sell whatever you want, then fly back.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 09, 2017, 08:57:51 PM
Quote from: Goldenpotatoes on February 09, 2017, 08:13:08 PM
Considering it already takes stock of everything within the ship's area, would it be possible to have them work like a regular caravan where you can land directly on a friendly outpost to trade, like with on-foot travel? It's not exactly a huge issue at the moment considering the work-around is just landing a tile next to them and bringing what you want to sell on-foot, but it'd be nice to just land on the tile, sell whatever you want, then fly back.

I've thought about it and will try to do it sometime soon. Cannot guarantee result yet.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: dareddevil7 on February 10, 2017, 08:28:11 AM
This is incrediable. Hope you don't ruin yourself making it though.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: phinky on February 13, 2017, 04:22:43 PM
Can confirm it appears to work mostly fine with the "[sd] spaceship" mod which adds to the coolness factor. Also after testing with a very large ship everything worked out for the first five or so jumps, but it eventually destroyed itself upon spawning on its final. Perhaps this happens when it can't find a valid landing zone? Anyways sweet project. Hope you manage to get it completed.
(http://images.akamai.steamusercontent.com/ugc/80339917950271842/6F2D9EA5A5379D2E72A456382869F4305BA215F9/)
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Hydromancerx on February 13, 2017, 05:46:04 PM
Yeah i was thinking about that mod combined with this one. Nice ship!
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 14, 2017, 01:15:48 AM
Quote from: phinky on February 13, 2017, 04:22:43 PM
Can confirm it appears to work mostly fine with the "[sd] spaceship" mod which adds to the coolness factor. Also after testing with a very large ship everything worked out for the first five or so jumps, but it eventually destroyed itself upon spawning on its final. Perhaps this happens when it can't find a valid landing zone? Anyways sweet project. Hope you manage to get it completed.

Hmmm. Destroyed on spawn after some jumps?
Could you please be more specific?
How large was it and, most importantly, where did you try to land it (what biome) and did you have any errors in the log?
Because I programmed it to throw a special error like "couldn't find landing zone" in this very situation.

I already invented how to cope with this problem in the future and hopefully how to make trading-without-landing as well, but this will take a while... because quite a major change in everything.


BTW progress update on animation:
Flying floors v.0

(http://i.imgur.com/2UKg6ma.gif)

uv map a bit off though.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 14, 2017, 02:28:51 PM
Progress: now with some walls and proper uv.

However, fine texture of walls is not displayed. Haven't found how to do it yet.

(http://i.imgur.com/IzWZgZT.gif)
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: phinky on February 14, 2017, 03:11:15 PM
Was just about to reload the save, but I've run into an unrelated problem with steam. May be a while before I can get back with you.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 17, 2017, 01:15:05 AM
Ok, some dev update (not downloadable right now because bugs need fixing first)

(http://i.imgur.com/fNvlBU4.gif)
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 17, 2017, 10:33:04 AM
For the first time in Rimworld!
Edging shadows during flight! (used random generator this time for technology demonstration)

(http://i.imgur.com/JjHr5PI.jpg)

Some tweaking in precedence and altitude is needed though...
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: TerrorThomasCao on February 17, 2017, 08:45:05 PM
Good job Houkime! How long are you spending on these?
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on February 18, 2017, 12:04:01 AM
First working thing was done in about five or so days during vacation.
Then about 2 hours to fix beds and stuff (did it early in the morning before i had to go).
Now just experimenting with stuff from time to time to cope with chronical depression.
Most time-taking was to wrap head around specific rimworld shaders and stuff.
Spent an infuriating weekend (because *beep* UnityScript API prohibits you from obtaining virtually any info on shaders during runtime and UnityEdior functions for that are not reproducible because Unity guys use internal calls of extern functions to hide actual code) trying to hack into stuff.

Ok, another screenshot.
Now things start to behave finally.
Finer mesh for shadows with special triangles is needed though.

(http://i.imgur.com/PXpDbiu.jpg)
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Seeker89 on February 18, 2017, 10:05:41 AM
I feel bad for that guy....
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: SpaceDorf on February 28, 2017, 12:50:11 PM
post to follow awesomeness.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on April 02, 2017, 03:35:53 AM
Guys, bad things happen.
Due to massive political repressions in Russia I need to pause works on the mod because soon enough I'm quite sure to be in jail for an unknown amount of time.
Latest version I was sort of ready to share is on RimVerse thread.

Was good to be with you folks.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: SpaceDorf on April 02, 2017, 07:08:56 AM
Heard it in the news ..

I hope this won't happen to you ..
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Hydromancerx on June 05, 2017, 02:55:48 AM
 :(
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on July 21, 2017, 08:21:42 AM
Well. Ok. Time for some update.
Good news is that I'm alive and not in jail... for now at least.
Now I'm sort of a legitimate active member of opposition forces and we're deliberately trying to non-violently fight back oppressive regiment which gets more and more oppressive every day. That last part is bad news which means that if we're not active enough we will soon be back to Soviet Union.
We're now consolidating around Anti-Corruption Foundation and mr. Navalny because they have evergrowing population support and do actively fight back.
I don't know if I have enough time for gaming-related software development right now TBH.
That's a kind of life-or-death adventure we're all forced to participate in if we want at least some future.

I heavily encourage any development though. Do not hesitate, sources are all open.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: TerrorThomasCao on January 15, 2018, 10:44:29 PM
I know this is really really really really late, but I hope you're okay now? Unless someone knows what happened here
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Houkime on March 03, 2018, 09:50:39 AM
I'm sort of ok.
Only 2 arrests so far.

Monitored municipal elections and helped organising tons of stuff.
Some friends were beaten up over the course, computers and phones are being stolen regularly by police (though I have avoided this so far), some are in jail.
One day we even had two "car accidents" when cars were smashing into our equipment transport.
Once in a few months one gets killed or almost killed and it is in the news (although not TV ones - they are censored).

In March 18th we have presidential elections, I will participate in monitoring again (this time with even more chances to get beaten/arrested) and...

Well, they do this stuff even right before elections.
I really doubt they become nice and fluffy once they re-elected themselves.

Kind of have a dark time ahead, but there is a strange urge to develop games nevertheless somehow.
See what I can do.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Vlad0mi3r on March 19, 2018, 05:38:58 PM
I hope everything went well with you staying safe during the election Houkime. The result was as was expected but I hope your ok.
Title: Re: A16 [WIPproto] Grid Takeoff and Landing: Suborbital jump for ship with interiors
Post by: Hydromancerx on October 12, 2018, 03:01:50 PM
Any news on this mod?