Search Unity

  1. Unity 2019.4 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  3. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Games 60 Day Non-euclidean FPS Build

Discussion in 'Works In Progress' started by newjerseyrunner, Jun 16, 2020.

  1. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    While I'm continuing work on my longterm project Mittens' Adventure, while I'm out of work due to the virus, I've been thinking about doing a handful of short projects just to bring in a little extra revenue. I've had this unique idea in my head for a while, but kept it on the back burner while I develop my other game, and also aren't sure how to make it a full size game, but it's perfect for a mini game.

    The standard features will include
    • 4-6 arenas
    • 3-5 modes like deathmatch, CTF...
    • Inventive takes on standard shooter guns
    • 4 player local mode
    • AI bots with a variety of settings

    The unique features will be
    • Heavy use of non-euclidean geometry, especially big places stuffed inside small containers.
    • Dynamic gravity, allowing "down" to be whatever direction the map says it is, and wall/ceiling running is important to the combat loop

    I will try to release the game publicly before the end of summer.


    Month 1:
    Make an virtual controller, which handles possibly mismatched input types
    Pin down the dynamically facing gravity and how sticky the character is
    all players together and make movement/weapon controls
    Add the non-Euclidean geometry effect
    Build navigation technology, use wall geometry as well as object placement markers (health packs, weapon upgrades, ammo...)
    Build AI to take control of virtual controllers
    Build a functional arena, playlets it to learn how it flows with the extra degrees of freedom. Use greybox.
    Finetune weapons/movement/combat loop
     
    Last edited: Jun 17, 2020
  2. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 1
    Imported some assets that I've already created for other projects. Wall running and gravity re-orientation is functioning, just needs to be tuned. Also started work on the non-euclidean geometry feature. Got it partially working, I expect to be able to create a short video featuring impossible geometry tomorrow. The math was a little more intense than I predicted and spent most of the morning doing geometry and calculus.
     
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 2
    I made what I had more robust and a little more optimized. I cleaned up the code so that it was easy for me to follow and debug later. I also started working on a haunted house style level. I'm starting to learn how to use different slopes to grant and restrict access to certain areas as well as setting up the room so that the non-euclidean illusion is never broken. I also have to make sure that two seams aren't able to see each other. I wrote a recursive algorithm, but it was too render heavy, so better to just work around it.

    Here in the video, I start by showing a long hallway that passes through a small object with a perpendicular hallway. Then I use the stairs as a ramp to jump to the wall and start running around on the ceiling.
     
    Last edited: Jun 18, 2020
  4. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 3
    Sort of got the non-euclidean traversal done. I'm learning how towrope my head around level design with such a strange space. I'm learning to think it in traversable pieces, playing spaces that are sectioned off by walls of 90 degrees. I've decided to color code them in Blender so that I can fully understand the space and how it will be traversed. Besides understanding, it also has a future use of verifying that the nav system that I’ll need to write works correctly and them at AI can go everywhere the player can.

    I expected to be able to visualize the geometry better than I am because I do a lot of general relativity, but gravity and spacetime is simple, it only stretches, it doesn't fold or break. This is more topography, which is much less of a strong suit.

    Screen Shot 2020-06-19 at 11.04.00 AM.png

    The yellow area represents one area, where the player can get to pretty much anywhere else on it through any path. The brown is another area that can be easily run around, but there is only a few locations where you can traverse from brown to yellow. This means that you can be physically right next to each other like where they meet at a corner, but have no real way to get to each other.

    By next Friday I plan on having something ready for feedback Friday. Since I’m building this game as such an insane pace and the geometry is so bizarre, I want feedback immediately.
     
    Last edited: Jun 19, 2020
  5. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 4
    I got most of the functionality of the non-euclidean geometry part working, there are minor hiccups here and there that can be cleaned up tomorrow. Meanwhile, I've been learning the limits of how I can and can not construct the world. Spaces need to fold over correctly and not have any way to jump between one and the other. It's very easy to loose track of where I actually am.

    Here is a short demo. First, I show off wall walking, and how you can move around at different angles. Then in the room I'm calling the kitchen, you can see a 90 degree turn that somehow leads through the middle object, as well as if you look from the other direction, you see a huge space inside the small table. In the bedroom, I then show off a bed that somehow has five right angle corners. This is mostly to test the frame rate, and I was relieved to see that it remained stable.

     
  6. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 5
    Fine tuning the controls and the space warping. I have to make sure everything is set up properly. I had the movement vector actually backwards and was subtracting positions instead of adding. That works fine in 3D space, but in my world, it wasn't, so I had to correct everything.

    I also realized that the topography of my five corner bedroom wasn't going to work mathematically, there was alway going to be a loose end. I actually went through and did a proof in the process of trying to find the right configuration. So instead, now it's two bedrooms that overlap and make one continuous bedroom with 11 right angle corners.
    C7DACA2E-11F3-4F56-B44C-555BE68415FA.jpeg
     
    Last edited: Jun 21, 2020
  7. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 6
    I built myself a nice shader to use, allowing fog that has different colors at different distances, making it much more eerie. I'm actually using an unlit shader, as Unity's lighting engine doesn't support what I'm trying to do. I may end up creating my own light mapping system to allow for some dynamic and static lighting, but I haven't decided how to do it yet. I also added some coins for the gameplay demo that I plan on sending to people just so they have something to do while I watch them navigate.

    Creepy.png


    EDIT: Check this out. I've always loved the look of some older games, true color just does something to it that makes it too sterile looking. I want to replicate the effect of textures using palettes, without actually having to use pallets. So once everything is calculated smoothly, I round each of the components to the nearest tenth. This essentially gives the entire game a color depth of 15,000 colors. The top has this feature disabled, and the bottom one has it on. The second one to me looks far more jagged and foreboding. Since it's in the shader, and the textures are all smooth, it's not as jagged as say doom, details kind of creep into view through the fog.
    C1.png
     
    Last edited: Jun 22, 2020
  8. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 7
    Added some moving perils noise to my shader, which gives the illusions of fog and shadows moving around in 3D space. I took a music track from my other game and pitched it down my a factor of 8, which gives it a ridiculously creepy ambient sound.
     
  9. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    31
    Cool! How does the non-euclidean effect work (portals)?
     
  10. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Hello @DebugLogError! There are actually two different systems to achieve this effect. One is smoke and mirrors and one isn’t. To navigate around the world, it’s all fake: teleporters and duplicate rooms. I pulled the tech it from a Brackeys video but had to modify it because he’s either smart enough to have optimized this on the fly, or not quite as good at math as he thinks. His rotation code was completely wrong and only worked if the “up” direction was the same.

    The second system is a true hyperspace mesh system. Most of the objects will be made out of these and rotate in 4D. I calculate a 3D cross section, then project that to a billboard. A powerup I plan to have has a tesseract as a model, and you can’t just take a gif of a rotation 4D cube and put it on a billboard because your movement should affect its rotation.

    Day 8
    The fog looked cool, but I also need lighting, which put me in a pickle because unity’s lighting system can’t be told about my teleporters, so I either had to fake it or come up with my own. I did the latter and spent the day building a static lightmapper. And not gonna lie... it looks beauuuuuutiful.

    I thought for like an hour how to pull it off. Ultimately, I decided to ignore the concept of a light source entirely. At the beginning of the rendering everything is black except objects that glow (lightbulbs, fires...). I Then move a camera along every pixel of the UV and actually render, calculate the light that hit the camera and add it to a high precision value, which turns into this pixels current light map value. It then applied that light map, and repeats. The first couple of repeats can have a multiplier indication that they are the initial source of the waves of light passing over everything. Bouncing then fills in the rest of the room as it loops over and over until the average light per pixel reaches a predetermined threshold. Then it dials all the light back to darken the room, and continues bouncing light and moving up to the theshold again, then it will loop there until I manually stop it. Since most of the work is don’t involve the GPU, it’s quite fast and I’m able to bounce dozens of times, where unity is limited to like 5. Fine tuning it today and will post a screenshot in the next post.
     
  11. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 9
    Put the finishing touches on my light mapper, and tested it extensively so that I'm sure it'll work in a variety of circumstances. I find it both fun and useful to analyze it's bake.

    On the very first frame, everything is black because the only thing that gets lit is directly exposed to the single lightbulb, which is the lampshade (and to a lesser extent the ceiling and part of the desk.) The lampshade ends up being the main source of spreading around early photons. The light bleeds through because I put both sides on the same spot in the uv.
    1.png

    By 4 bounces in, the amount of light has increased dramatically, so the multiplier for each frame is being reduced, though it it still filling the room with photons. You can start see a nice shadow on the bookshelf and I see some white light hitting the floor next to it, indicating that it actually has direct sight of the lightbulb under the lampshade.
    4.png

    By 8 bounces, light has reached all corners of the room and even inside of the bookshelves. Obvious dark spots are forming behind the monitor and computer and the shadows are softening. A dark shadow still exists behind the pillar in the room, but that should fade away as light moves around walls a lot more now. Light is still being added.
    8.png

    By 12 bounces, the room's full of photos and each additional bounce is contributing less and less, but each iteration gets it closer to the true value.
    12.png

    At 24 bounces, light is really smoothing out, bouncing all over the walls and inside of everything. I closed all the doors and turned on a lamp, this is exactly the effect that I saw in real life.
    24.png
     
  12. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Final output, with 50 bounces. Looks gorgeous in my opinion.
    50.png

    I can flip a switch on my shader to show just the lighting data, which is cool. Weird how all that soft orange light came from a pure white lightbulb shining through a wood texture lampshade.
    Raw.png
     
  13. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    31
    Nice job with the lightmapper. Could your implementation run in a build? I've worked on a few in-game level editors and not being able to bake the lighting has always been the biggest issue.
     
  14. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    @DebugLogWarning It does run in the build, that's the only way that it'll work properly with my teleporters. Here's the code: https://forum.unity.com/threads/static-lightmap-baker.919859/. The lightMagnifier could be increased by a bunch to put more light in the scene faster, though it'd still be slow. It takes about 60 seconds per bounce on a fairly simple 512pixel scene. Faster than Unity, but still not exactly real time.
     
    DebugLogError likes this.
  15. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    31
    Can't wait to check it out. Thanks for sharing!
     
  16. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Hope you find it useful, it shouldn't be too hard to convert to output something useful for the built in mapper.

    Day 10
    Fine tuned the controls. The player would go flying off of ramps, I added a recast below you to stick you to the ground. I also wanted to make sure that I prevented players from clipping through the walls. The physics engine is fine, but I needed a backup so I built one. If it detects that it's going through a wall, it will move back to it's previous position.

    Made some final adjustments to the light mapper and realized that the teleporters don't know about the rendering camera, so I'm gonna have to rework a method or two.
     
  17. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Not adding a day since I didn't do anything today besides post for feedback. Next week, I intend to finalize the light mapper, complete the arena, and fine tune all controls for the player. That way I can have a workable demo ready before feedback Friday and can then focus on navigation. I'm still figuring out how to build a nav mesh with not only teleporters, but also wall running.

    After that, AI. I need to have multiple enemies running around in order to really test the systems, and I will set them up to have a small neural network inside of a more coded AI that can fine tune parameters overnight.
     
  18. the_0dium

    the_0dium

    Joined:
    Nov 29, 2018
    Posts:
    9
    I remember making a prototype of a mp fps with changing gravity. Looked really fun, but mp was waaay over my head at that time (still is tho)
     
  19. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 11
    Based on feedback, I retextured some of the house, and increased the number of colors by a factor of 8. This still gives me the nice effect that I want, but the browns now have more places to go and don't get muddy. I also added a feature to the shader that will take the alpha channel and use that to multiple the distance, allowing me to put symbols on the walls that only appear at distance.

    Screen Shot 2020-06-29 at 11.49.07 AM.png


    I also fixed the problem where teleporters weren’t rendering for the lightmapper, so I added a method to the teleporter to force it to render from a certain angle, which fixed the problem completely. I’m ready to do a light bake as soon as I finish the geometry.
     
    Last edited: Jun 29, 2020 at 10:34 PM
  20. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 12
    I'm going away this weekend again, so I decided to finish texturing and modeling this single arena so that I can just let the light baking run over the weekend while I'm away. I ran a test run today while I filled in some of the holes.
    Screen Shot 2020-06-30 at 6.20.27 PM.png
     
  21. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 13
    Totally textured and closed in my first arena. I am going to let it bake lighting for a bit.
    Screen Shot 2020-07-01 at 10.24.33 AM.png
     
  22. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    890
    Day 14
    Not a very exciting or long day. Just fixed some minor bugs in the lightmapper and set it up to do a 50 bounce full render while I’m away this weekend. The arena isn’t final so I’ll have to redo some it it at some point, but that shouldn’t be a big deal. Next week I plan on making projectiles and turning my damage system back on, along with fixing issues with the teleporters.

    I had to take a ride to the city and during the ride I figured out how the nav system will work.
     
    Last edited: Jul 3, 2020 at 8:08 PM
unityunity