Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411490 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 24, 2024, 04:29:49 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsScifi flightsim prototype
Pages: [1] 2
Print
Author Topic: Scifi flightsim prototype  (Read 10462 times)
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« on: January 23, 2020, 03:16:42 PM »

A long time ago I decided to try making a simple flight sim, and I did. Then I lost the project files and forgot about it. But recently I have been having that itch again so I decided to take it a little more seriously this time! This won't be a full game, just a proof of concept, a prototype. But I felt like logging the progress so here it is the devlog.


Pitch:

Flight simulators are great. Even non pilots love to fire one up, load whatever default plane available, take off, do some loops, and crash trying to land. Then most people stop playing because real life is kinda boring. I mean seriously, the world is basically flat! you have 6 degrees of freedom and no obstacles ahead. That's why everyone is drawn to buildings and bridges to fly close or under. So I decided I wanted to make a flight simulator, as convincing as possible, but in another world, where flying is challenging and interesting because cities occupy large 3D volumes you need to fly inside. In this game you play as kind of a truck driver, but a pilot. You fly inside cities, pick up contracts to transport boxes, take them to their destination etc. The money is used to pay for fuel.

it's not one giant city but a large world. And while flying inside cities might be challenging, you need to fly between cities, which is easy. This is when you can save the game. You put up the autopilot to maintain altitude and speed and go to bed to save.

Anticipating the technical challenges of making open world games I made my life simpler with some backstory. This planet is the result of a failed terraforming process and the population is the stubborn remaining of the colonization efforts, who were born and built a life there. THEREFORE the planet is covered in fog  Corny Laugh

Isn't fog great? I want different levels of fog. I want the fog to be a variable to take into consideration when planning your routes. So the densest fog is where large flying predators hide. Making the fog somewhat dynamic should provide for nice tension. You start the trip with a trajectory that is close by a large dense fog volume and go to bed hoping you don't accidentally enter it. Maybe you decide to land somewhere to wait in the less dense but still dangerous fog. Maybe that backfires and you find yourself having to cross a section of dangerous fog! Maybe the weight of your current load is too much to fly over it and you decide to flush your cargo out to survive. Yeah, I can see opportunities for juicy gameplay dramas to naturally occur.

So, to sum it up, in this game you: fly a plane, load the ship, manage cargo space, refuel, manage money, make long trips where you sleep to save, avoid monsters in dense fog.

Execution plan
Obviously I'm not going to make a AAA game with realistic graphics. But even so that doesn't limit much the world of possibilities, and whatever's left can still be too much work for single dev prototype.

Idea 1: The immersive sim philosophy. First person view and freedom to move inside the ship. Want to move that crate to the side? go there and move that crate to the side.
I can make the prototype with simple boxy graphics, no problem. But that still leaves some challenges to overcome, like physics scale. The flight dynamics uses the physics system, the FPS view will also be physics driven, but the two scales need to be kept separate... probably. The plane is big and flies fast. To make that smooth it requires scale to be set with small numbers and a system that resets the root of the transform before large numbers start to mess the simulation up. My intuition is screaming to leave the FPS part separate from the plane physics. A player collider with 0.01 units of height will be problematic, the interior of the ship full of tiny boxes inside a plane flying at 200 un/s will definitely not work.
So that's the challenge there. Separating scales.

The scale problem would be present in other aspects of the game if I hadn't made the planet foggy. Because the planet is huge in comparison to any city, a city is huge in comparison to a single block etc. Since it's all foggy I can just have two scales: one planet wide scale that tracks the player's position and the near vicinity is loaded with simple procedural generation. The separation of the plane and the FPS and plane parts won't be solved that easily.

Idea 2: I really love the immersive sim approach but I feel it might be too ambitious. Another possibility is to go in a completely different (and possibly original) path; a top-down isometric view with 2D art. The transition from 3D cockpit view to internal 2D view will be absolutely jarring. I never saw anyone do this, with good reason. But I'll be damned if it doesn't spike my curiosity.

That would be a lot easier to implement and I'll be able to focus on the more abstract aspects of the game.

I'm curious to hear thoughts. Next post will have some gifs.
« Last Edit: January 23, 2020, 03:55:03 PM by diegzumillo » Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #1 on: January 23, 2020, 03:28:44 PM »

Here's the flight dynamics in action:



It's a simplistic approach but quite convincing. I'm using unity's animationcurve class to define lift and drag coefficients for each part (4 wings, 2 elevators, 1 rudder, 1 main body). I used Rigidbody to apply forces at their respective locations and I use the velocity at their locations as well. I used some basic plane (think cessna) to model this thing then tweaked until it felt nice to fly.

The city you see uses a pool of cubes and perlin noise to position the cubes as you fly. Super simple but it works. The parameters of the city will eventually be defined by volumes, so I can lay down a city by simply dragging a few objects around, specifying density and other stuff.

Logged

nova++
Level 4
****


Real life space alien (not fake)


View Profile
« Reply #2 on: January 23, 2020, 09:03:36 PM »

I am curious about your flight model... I've done similar experiments before (in ways that sound quite similar to what you are trying) and am curious what sort of behavior it results in. Can your plane stall, for instance? It's hard to tell from the gif.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #3 on: January 24, 2020, 02:41:33 AM »

I'm no pilot to give you a detailed analysis of how realistic it really is but, to a hobbyist, it looks convincing. It can stall, but the stall behavior itself isn't convincing yet. Stall happens when the angle of attack of any or most parts are beyond a certain number. In my model it just generates zero lift. It makes it hard to regain control. In reality I'm not even sure what happens! But I would guess lift fluctuates in complicated ways, so I might experiment with randomizing lift oscillations.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #4 on: January 25, 2020, 04:33:21 PM »

OK, I got the FPS thing working. Decided to go with an open source FPS system. I usually don't like using 3rd party assets, even in prototypes, because most of the time I get frustrated trying to bend it to do what I need. But this one is simple enough.

I'm trying to ignore my intuition and just going with idea 1 (first post) disregarding the complexities of physics in different scales. In other words, the player is a rigidbody cylinder climbing on a rigidbody plane and crossing my fingers. For piloting the plane it's simple, since I turn the collider and rigidbody off (of the player) but what will happen when walking inside the plane?

I might implement concurrent physics simulations. Apparently that's a thing we can do now (forum post describing the process) This way I can have the interior as a separate simulation and as child of the plane so it moves with it. Hopefully that's how it works.

Anyway, I feel like I need some more temporary art before moving on. It's hard to work on this stuff with tiny cubes representing the plane.

New gif


Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #5 on: June 10, 2020, 07:53:40 PM »

I was doing this 60 days levelthon of apple and worm (signature). At day 30 I decided to take a quick break and work for a week on something else. Well, this was the project I worked on! My overly ambitious scifi flight sim.

I enjoyed this a lot so I am going to continue working some more. Maybe switching projects every month is a good idea, because I really don't feel like resuming apple and worm yet.

This project is huge and overwhelming, so organization is key. There are two paths in front of me right now: shortcutting to a working prototype or implementing things that make me excited and I want to see in action.

Option one is the most sensible. Don't waste time on something you don't know will work, get the idea working as fast as possible etc. That would mean implementing (using a single coordinate system) an infinite and simple procedural city (done), simple plane interior, flight dynamics (done) with hovering functionality, and two or Three landing pads with stuff to do on foot, like moving crates, and, finally, some interaction scheme that allows you to pick up jobs, deliveries etc. And a super basic guidance system. OK, I think that's all I need for the basic prototype. Because of rounding errors in a single coordinate system, these landing pads/ports cannot be too far apart.

That's a lot. What puts me off working on this is that a lot of this will be hacked together with spit and will have to be reworked eventually, in order to encompass the other elements.

The second path now. I am itching to get started on planet-wide navigation. This requires setting up two coordinate systems. It is in this coordinate system that city limits and zones can be defined. I don't know why I am so drawn to work on this but maybe I should follow my nose.


Here's a gif with my new city generation scheme. The old way was horribly laggy and dumb. An a different approach to fog as well. I tried using volumetric lights, from HDRP and another from the Adam demo. Both worked but are too complex. I need a simpler solution and I found one. This fog is not mine, someone made (link here later), and it basically just replaces the standard unity fog but instead of pixels fading to a specific color, they fade to the current skybox. This opens up some interesting possibilities, like in the second coordinate system, the wider one, I can render some interesting fog based on the surroundings, using rendertocubetexture (or whatever the function is called)




Maybe I should at least sprinkle a few landing pads around and test flying from one to the other. Also, hovering mechanics won't have to be reworked ever so doing that now is also appealing.
« Last Edit: June 10, 2020, 08:00:07 PM by diegzumillo » Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #6 on: June 11, 2020, 05:30:43 PM »

I remembered I played with a multi-scale system before. My very own surprising and incredibly simple solution. Here's a gif with 3 levels of scales. Surface, planetary, solar. 20 lines of code.



It is too simple, actually, but in this project I only need two levels. In a space game high speeds are also a concern which might be solved with a more robust multi-scale system, like setting speed to zero in the basic frame and the next frame inherits, or stores, the remaining speed. None of this is of my concern. In fact I can hard code most of the game right now with this. Basic level generates terrain and buildings in a small radius, and also resets the origin when necessary. Second level is around a sphere, it takes position and velocity and applies it in spherical coordinates (horizontal velocity in basic frame is tangential velocity in high frame). Since the world is covered in fog I don't even need to stack cameras, you only see what's near you. But I do want to render a nice cube texture to be used as a skybox, and this is done in the high frame. The high frame defines the world, geography, position of cities and places of interest.

Unless this turns out to be problematic. A planet is still too large to position, say, a landing pad. We'll see.

All right this is my night job now. I am sure there are problems with this I'm not seeing yet.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #7 on: June 16, 2020, 10:57:05 PM »

I wanted to find the simplest solution to a global-scale game world. Ironically I spent the last 3 nights cracking my head over it. Ironically because maybe it would be done already if I just chose a path instead of trying to think 1000 moves ahead for every micro decision. Since writing about my problems tends to help me, here are my thoughts so far.

The absolute simplest possible solution: The world map is a plane with its sides connected. Imagine a square, you reach an edge and come out the other edge, just so you don't hit invisible walls. Unrealistic but easy to implement. I can define the geography of the world in this map, scatter all the things I want there etc. Translating this scale to the actual local scale, where the action happens is trivial. Fun fact, not only this isn't a sphere as its topology is that of a doughnut. The geometry is still euclidean.

I have a couple of problems with this approach. First, I set out to make a realistic flight simulator. It seems the least I can do is make the world round. Second, I am not ready to ditch the possibility to achieve orbit around the planet. Orbital mechanics is awesome, and I would love to have some orbiting bases for the player to dock in. Going the plane route basically scratches that future possibility.

What I do like about it is that it's simple and easy. And I should know better, I really should. The one thing hampering my projects, all of them, is increasing complexity to overwhelming and unmanageable levels. Is orbiting the planet really feasible or that important? It's a flight simulator! planes don't go to space! Besides, coding isolated functionalities is one thing but I do need to prioritize the ones I really want.

So the other approach is to make a round planet. The main scene consists of two sub-scenes; the local scale and the planet scale. The direct input controls the player in the local scene, which passes any displacement and rotation scaled up to its planetary scale counterpart, which in turn feeds the local scene with terrain data and gravity direction. Since the planet is covered in clouds and fog, rendering isn't an issue. I don't need to combine views, although that wouldn't be that much of a problem. The local terrain needs to sample height from the main texture of the planet, combining with some deterministic random bumps for detail.

All of this is feasible, but it would still not be enough to allow orbital motion. When achieving orbit we start dealing with very high velocities, which require special ways of handling. Large numbers and floating point precision do not affect only position, high velocities are also a problem. So that argument above about wanting orbit in the future kind of gets a fart to the face, doesn't it? I mean, maybe it's not that hard either. It's the equivalent to floating origin but with velocity. When the player crosses a specific speed, it zeroes out but the planet-scale counterpart retains that excess speed for safe keeping.

To put some numbers. Player is moving at 300 u/s (units per second). The planet-scale counterpart is scaled in such a way that it moves at a 0.3 u/s. The input flow is always local->large. But when the velocity gets to 301 u/s it resets to 1 u/s, but the planet-scale counterpart is holding 0.301. Which means the input flow is now two-way. The theory is fine, but the implementation seems like it would bring me a new surprise unexpected side effect every day.

All right. End of wall of text. Did I decide anything?

Godammit.  Lips Sealed Hand Shake Right I'll just code whatever.
Logged

nova++
Level 4
****


Real life space alien (not fake)


View Profile
« Reply #8 on: June 17, 2020, 06:28:21 PM »

For the sake of your own sanity, do not do this.

Take it from me, as someone who has gone nuts with trying to manage this same multi-scale system that you are trying to.

In my case I have several layers. Terrain engine to keep spherical terrain, local planetary coordinates stored in double-precision, a floating origin system to reset the player so they don't move too far from the engine origin, another layer of double precision above that for interplanetary movement (and then another one on top of that for interstellar)

It probably sounds way easier than all the space-warp stuff in Apple but I assure you, it is absolute quicksand. Maybe I'm extra jaded because I've done it three times over, though.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #9 on: June 17, 2020, 07:15:10 PM »

For the sake of your own sanity, do not do this.

Take it from me, as someone who has gone nuts with trying to manage this same multi-scale system that you are trying to.

In my case I have several layers. Terrain engine to keep spherical terrain, local planetary coordinates stored in double-precision, a floating origin system to reset the player so they don't move too far from the engine origin, another layer of double precision above that for interplanetary movement (and then another one on top of that for interstellar)

It probably sounds way easier than all the space-warp stuff in Apple but I assure you, it is absolute quicksand. Maybe I'm extra jaded because I've done it three times over, though.

Oh no, I believe you 100%. This has all the marks of quicksand. I know because I tend to get stuck on these a lot.

However (this is where the drug addict gets a little defensive during his intervention) if I ditch the expectation of eventual orbital stuff I can live with two layers only. With the fog thing I mentioned before there would be no need for fancy resolution changing terrain etc. It's basically just a way to have a spherical world map, really. I actually tried really hard to get a spherical world map in some simpler way but the simplest solution does seem to use two layers in scale. You move around the sphere in one scale and the other scale is just you moving around a small patch of terrain, occluded by fog.

But I'm open to suggestions! If you have an idea on how to do this any other way I am all ears. I considered defining the global map on a plane with a spherical metric, but I'm sure that will come with just as many complications as this method, like the singularities at the poles, or alignment issues because the spherical metric is a little complicated, and without the benefit of having been implemented by others for comparison.
Logged

nova++
Level 4
****


Real life space alien (not fake)


View Profile
« Reply #10 on: June 17, 2020, 07:58:51 PM »

Some sort of curved terrain and a floating origin system would be a good fit for you, then... sometime I should make a little example project to put up on github just to easily demonstrate how that sort of thing is done.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #11 on: October 10, 2022, 10:21:27 AM »

Ahah!  I bet no one expected to see this thread coming back to life.

I have been playing with ray marching lately. And I remembered this project was struggling to find a good way to represent the world. I think this might be a winning combination.

Ray marching is cool. You can make really intricate geometry without your GPU even sweating. There are many challenges involved but the one that was bothering me the most is well under way to being solved; having a spherical world. But it's not really a spherical world! it's complicated. This isn't a space game, you will never actually go up and see the spherical planet, but navigation respects round planet rules, if that makes sense. Which is good enough for a flight sim. I'll go into detail later.

No controls implemented yet but I can already play in the editor by making "meeeooooowwwwnnnnnn weeeeeeennnnnnnooooo" with my mouth.



I'm doing all the coding in Godot. And for now it's all shader coding.
« Last Edit: October 10, 2022, 10:27:32 AM by diegzumillo » Logged

KorbohneD
Level 0
**


Doing nothing all the time.


View Profile WWW
« Reply #12 on: October 10, 2022, 11:53:11 AM »

Well, sounds impressive and cool and like a lot of work. : D
Good luck!
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #13 on: October 10, 2022, 03:24:54 PM »

Well, sounds impressive and cool and like a lot of work. : D
Good luck!

Thank you :D

It does sound like a lot of work.
I've always wanted to make this scifi flight sim, but it never got off the ground (hah). I could not figure out how to represent the world, basically. And now things seem to finally be clicking... no, I need a pun. The project is taking off (heh).

Anyway, yes, hard work. But now the path seems clear, which is a good development. The skies are clear... ah forget it.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #14 on: October 27, 2022, 05:55:16 PM »

I got terrain working, it can be as large as I want it to, which is great. Objects can have different colors too. Materials are all the same at the moment.

Here I'm just playing around with a couple of fractals:



Currently trying to figure out the best solution to create SDF scenes, save and load them ingame. How are they going to be defined? the easiest way but also the most limited is to translate every complex object (like a ship or a structure) into its own function inside the shader. Another would be to define objects in terms of primitives and combinations, and pass it to the shader to construct them in real time. But that would require some loops and fancy array operations which could be too much for the GPU to handle with good performance.

While I think about that there is another thing to decide. How to model things. I might end up just making my own simple SDF editor with Godot tools. But if there was a nice modeler out there that also exported code, that would be great.
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #15 on: October 28, 2022, 01:20:49 AM »

1: how on earth did I miss this devlog

2: HOLY SHIT THAT LAST UPDATE LOOKS GORGEOUS!
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #16 on: October 28, 2022, 04:41:55 AM »

Quote
1: how on earth did I miss this devlog
I make the least memorable and noticeable titles. "unnamed platformer", "scifi flightsim prototype", "temporary project that means nothing to passersby".

Quote
2: HOLY SHIT THAT LAST UPDATE LOOKS GORGEOUS!
Thank you! fractals are awesome. And a little fog goes a long way making a landscape look cool. Even one with just two solid colors for texture.
Logged

SolS
Level 5
*****



View Profile WWW
« Reply #17 on: October 29, 2022, 12:00:03 AM »

Looks very cool! 1st time seeing this too!
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #18 on: October 29, 2022, 02:07:22 PM »

Looks very cool! 1st time seeing this too!

Oh hey you too! didn't recognize the name and avatar at first. And you seem to have two new devlogs I didn't know about either. But I do keep up with your stuff on Twitter :D

I continued trying to find a way to define scenes. I even 'bought' MagicaCSG (it's free for patreon supporters, so I will be a supporter for as long as I'm not completely broke). The editor is brilliant! But I still don't know how to use this with my engine yet, if at all. I would likely have to write a parser to convert the saved file into something I could use.

But anyway, I also wrote a few lines of shader code that read an array an put objects into the scene. There are lots of ways to define a scene but I hope I found a good compromise of flexibility and performance. Can't say for sure yet. It basically breaks down any scene as a set of objects and subobjects. Objects are combined with the simplest combination possible and subobjects use smoothed combination. (that's Min and SmoothMin, for anyone into SDF)
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #19 on: March 03, 2023, 06:05:56 PM »

I forgot I have this thread.



I made some progress on this. The renderer supports a predefined number of light sources with soft shadows and other niceties worth having that are not worth sharing (read that as 'I don't remember everything I did but there's a bunch of stuff under the hood'). Also, the most useful fractal of all time for this project is the mandalay. It's a mandelbulb with extra operations on it that make it look really cool.

Not as much progress as I would like to have made.
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic