Search Unity

  1. Unity 2020.1 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

Games Midnight Streets - Racing Game

Discussion in 'Works In Progress' started by Stephen_O, Nov 10, 2019.

  1. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Ive found that Enviro takes up alot of rendering/performance, not well optimized, now VSP is a godsend, lol. Love how its coming along, nice work bro.

    Dont forget about texture resolution reduction on that grass, as its not something the player is really going to see up close.
     
    Stephen_O likes this.
  2. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thanks.

    Yeah.. Enviro looks so good, but unfortunately I can't accept the performance hit. I'm too happy for VSP performance, it's almost something I know I won't have to stress about at all!

    My plan for textures (and also vegetation) is to give it them their own development phase and bring everything down to minimum values that produce good results.
     
    warthos3399 likes this.
  3. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Good idea, ive tried to do that myself, but in a game such as mine, its been a priority. I also like how you took a square block of buildings and reduced them to like 4 (less tris/polys). I know you got a large performance boost from that alone. I too like mesh reduction.

    Looks like your planning on night/day cycles, as lighting can be another whole phase by itself for a racing game, lol.
     
    Stephen_O likes this.
  4. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Less is more, in a strange way when we talk about performance. Maybe one day we can go crazy and just drop what we want anywhere we want.. but that is not today :). I'd rather figure out what everything costs now and do as much as I can to define clear rules before I start to go all out with world building. This mostly helps me have boundaries for level design.

    I doubt I'll have night/day cycles, my plan is to keep the game night time only. I want to reduce complexity in any way I can. Main goal is to release a game and try to make some money from it.. I'll likely have to settle for less than my dreams a good amount here and there.
     
    warthos3399 likes this.
  5. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Today I'll walk through the main steps of my level design process for a simple task. The goal: reduce the amount of terrain being drawn in the distance, add some new buildings, and hopefully come up with an idea or 2 for future iterations on the world.

     
    Peter77 and warthos3399 like this.
  6. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Today I added some more content to the open world, the starting island is almost done being blocked out. I setup an industrial area, gas station, more buildings and vegetation.

     
    Peter77 and warthos3399 like this.
  7. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    I like the new progress, one thing i noticed is the sky looks great for that night time environment. Yea i hate when you smooth out the terrain and that happens, as when smoothing it slightly drops the terrain, can be a pain sometimes, lol
     
    Stephen_O likes this.
  8. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thanks, it took a bit of work to make that sky look decent, the performance gain was totally worth it. Enviro was just drag and drop, looked great but I did not realize it was so costly (maybe in the back of my head I did know it was expensive but thought I could find a way to make it cheaper).

    I decided to stop pressing the auto smooth terrain button, mostly since at this point I'm focusing on specific areas, so it's better to manually smooth whatever area I edit. The road system also does not always keep an updated record of terrain.. so sometimes when updating the road it will alter the terrain based on earlier cached data - that might be a perforce issue though (keeping the terrain data in a locked file); I think I have to toggle a setting off and should be ok.
     
    warthos3399 likes this.
  9. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I had a few people ask me if I'll be publishing a traffic only package to the store using the job system and burst, I wasn't planning on it... but I guess since there's interest, I decided to put a demo together, I'll likely submit this to the store soon. I setup a WebGL demo.

    https://www.turnthegameon.com/simple-traffic-system

    This demo scene is a stress test, there are 358 cars, using 74 waypoint routes (one for each road lane) with 58 short routes in the intersections used to allow the car to turn and connect road lanes. Each lane has a traffic light that controls if the vehicle at the intersection can go or stop. Each vehicle has a forward boxcast sensor, if it detects another car, it will stop. Traffic light managers are used to control traffic light timers, they can be grouped and sequenced to control traffic flow.
     
    Antypodish and warthos3399 like this.
  10. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Solid, i like the control you have with that system, could be used in alot of different ways/senarios :)
     
    Stephen_O likes this.
  11. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    warthos3399 likes this.
  12. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,289
    warthos3399 and Stephen_O like this.
  13. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thanks. Yeah, I guess some users were interested enough to ask me to sell it. I did not expect that..
     
    warthos3399 and Antypodish like this.
  14. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Good for you bro, nice work :)
     
    Stephen_O likes this.
  15. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I've been focusing on completing the block out phase for level design, mostly creating all of the drive-able areas for the first island, setting up fences, parking lots, alley-ways, etc.. Once I finish this phase I'll begin to work on adding in the details like street lights, traffic lights, AI traffic, and other misc props.

     
    Peter77 likes this.
  16. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,995
    Hey Stephen, just wanted to say thanks for your dev logs. I've been following this thread and the logs for a while, interesting stuff! Please keep it coming :)

    You probably watched it already, Unity Technologies recently uploaded a video where they talk about cameras in racing games. It starts at about 12:40:
     
    Stephen_O likes this.
  17. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Hi Peter, thanks for the comment and support :)

    I've seen that talk, I think the main takeaway there is Unity is using a cinemachine camera and visual scripting together. Personally, I think built-in visual scripting will be very cool, but I don't know how much I will use it compared to traditional scripting since I can write a script to do exactly what I want fairly quickly. I'll give the visual scripting a try at some point when it's available, I won't just dismiss it as there might be some value there for different use cases.

    The cinemachine camera has a lot of nice features built into it that would be fun to control through scripting. I'll likely focus on camera work once I get the main island fully setup. My camera system does have some of the features shown there, but my plan will be to mostly rewrite it and dial in the logic and settings to control a cinemachine camera instead of a standard camera, and use traditional scripting to create something that feels more fun compared to what I currently have.

    If I recall correctly, my camera system was written a year or 2 before cinemachine existed, it will be nice to upgrade it to current tech.
     
    Peter77 likes this.
  18. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I've finished the block out phase for the starting island. Now it's time to start setting up props, the first is an interactive street light.

     
  19. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Love the lighting, and shadow support looks great :)
     
    Stephen_O likes this.
  20. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I spent some time switching my default camera controller for Cinemachine, setting up some virtual cameras for various states and some initial logic to blend between the states. I also worked on player emergency brake controls, allowing the car to do a sharper turn when using the e-brake.

     
    warthos3399 and Peter77 like this.
  21. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I've been working on optimizing the open world art scene. I used a few tools, specifically the builtin Frame Debugger, Resource Checker, Dreamteck Splines and Super Combiner. I also prepared 55 static vehicle meshes with combined parts using 2 texture atlases, these will soon be placed around the scene.

     
    warthos3399, Antypodish and Peter77 like this.
  22. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,289
    Lovely showcase:)
     
    warthos3399 and Stephen_O like this.
  23. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Love what your doing Stephen, looking great, whats funny is while deving a project like this, youve already released 1 new asset from the project, and i wouldnt be surprised if you release more, lol.

    All the best to you bro :)
     
    Antypodish and Stephen_O like this.
  24. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thank you. I think you might be right.

    I learned a lot between actual work projects, research and development, assets store, etc. Anything I made for the asset store over the years was always in preparation for me to make a full sized PC game (I guess this is the game). I don't really want to do a racing game anymore (I did when I started with Unity and I made a few small mobile games), which is part of what kept me from starting this project for a while, but now I have a good amount of knowledge about the genre and iterating over my asset store tools gave me a robust starting point, so I will finish the process and make a game with it.

    I'm kinda looking forward to being done and switch genres :p I don't know how I'll feel once the game is actually done, I guess at that point I would have reached my goal.
     
    Antypodish and warthos3399 like this.
  25. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    I feel for you Stephen, as the dev process for a game like yours or mine is around a year, give or take. During that process its hard to keep up the "spirit to completion" as theres just so much to do, you learn alot in the process.

    Hope you bring Midnight Streets to a completed project, as it looks and plays great, your on the right track. Just remember....theres always time for another project, and will be better than the previous, due to lessons learned.
     
    Stephen_O likes this.
  26. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I'll finish the game, for me, the key is to take it one day at a time.
     
    warthos3399 likes this.
  27. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,995
    Is working on this game your full-time job or is it more of a spare-time project?
     
    warthos3399 likes this.
  28. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    This is a personal hobby project, the main goal is to finish a larger project on my own and release it. If I can make decent money from it that would be great.
     
    warthos3399 likes this.
  29. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,995
    How many hours to do you spend working on it per day/week?
     
  30. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Lately about 30-40 hours a week since I have some free time. I'm in between work contracts right now, hoping to get one soon. Once that happens I'll be back to around 20-30 hours a week.
     
    Peter77 and warthos3399 like this.
  31. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,995
    I see, that explains why you're doing such leaps in progress. ;)
     
    Stephen_O likes this.
  32. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Over the past week I spent a lot of time on project cleanup and optimization. I've switched the Scripting Backend from Mono to IL2CPP, created more job system based managers to reduce cpu usage on the main thread and reduce amount of redundant code being executed per frame, and optimized road geometry. These changes resulted in a significant performance improvement.

     
  33. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Nice, like the job sys for the left hand turn only....:)
     
  34. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    I can't believe I've missed this! This is why WIP should have top level thumbnails on the main page. Great job.
     
    Stephen_O likes this.
  35. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I forgot to post about some editor scripting work I've been doing for the traffic system, this is to improve workflow. Reverse waypoints function on waypoint routes to make setting up parallel routes quicker.

    ReverseWaypoints_.gif

    Today I got tired of digging through all the waypoint routes and their points to manually connect routes, so I made an editor window that will load all routes from scene and provide handles in scene view to help make these connections.

    RouteConnector_Window.gif
     
    warthos3399 and Peter77 like this.
  36. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Nice bro, great system, love the individual waypoints with speed cap. :)
     
    Stephen_O likes this.
  37. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    I built a spline based tool to manage configuring multiple routes and waypoints for adjacent lanes much faster and efficient. Since it's spline based, it works well for curved roads and inclines.

    This helps automates much of the layout process to reduce the amount of work required to configure traffic lanes.

    Route Creator.gif

    Now I can finally finish setting up traffic in the open world! I dreaded clicking-to-spawn all the required route points. Using this with the previously developed route connector tool, I think it should be quick work... I'm excited to see the city with cars driving on all the roads I created.
     
  38. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    In this DevLog I discuss some of the workflow challenges I've recently faced relating to implementing the traffic system into my large open world scene, and the problem solving approach I took. This eventually led to the creation of a few new tools and functions that greatly improve workflow and productivity.

     
    Peter77 and warthos3399 like this.
  39. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,995
    Why don't you place waypoints only at the end of straight roads or where its curvature changes? For example, rather than having 10 waypoints per lane as seen in the image below, wouldn't it work with just the two red blobs?

    upload_2020-1-12_9-4-1.png
     
    Stephen_O likes this.
  40. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    There may be a few more in that shot than actually needed, but there are a couple reasons for using more in between points on straight roads.

    AI cars always head to the next point, each point can update the speed limit for a car, be a junction to a new route, or trigger an event, If an AI car gets hit by a player car it may be thrown off course. Having a series of waypoints allows the AI car to navigate back to the road instead of driving to end of road point.

    This system (it was optimized to use better logic, jobs and burst compared to the initial version) will likely support lane changing too, having additional points allows them to be interconnected so AI cars can navigate to a new lane if a slow vehicle or obstacle is in the way.

    This video shows some lane changing examples where the AI racers change lanes to overtake other cars in the race:



    If I had only 2 points and points on curves, I would not be able to achieve this.

    The AI racer waypoints will also likely be added to these objects, when racers move at high speed, they need to have more waypoints for overtaking and accuracy. AI racers will definitely get hit by the player and need these points to stay on course.
     
    Last edited: Jan 12, 2020
    Peter77 likes this.
  41. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    After making all my AI waypoint routes and connecting them (502 routes between short intersection connections and road lanes), I realized I needed another scene view helper tool for the traffic lights. There was no way I was going to try to manually dig through this hierarchy to assign that many references.

    RoadNetwork.png

    SignalConnectorWindow.gif

    Now I just add the traffic light prefab to the intersection, position them and use this handy window to assign the route to the signal light.
     
    Peter77 likes this.
  42. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Today I achieved a new project milestone, I now have the open world section I've been working in fully layed out for first pass, this includes landscape, roads, buildings, street lights, vegetation, lighting, post effects, AI traffic routes and intersection signals. It still needs some minor cleanup work and details to be tied down, I discuss some of the next steps in this video.

     
  43. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Nice job bro! I loved watching that one, can feel your excitement, very cool :)
     
    Stephen_O likes this.
  44. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thanks, it felt so good to get to this point, up to now it felt like I was stuck spinning my wheels coding to solve problems. I'll still need to do a good bit of that, but at least there's a traffic simulation up and running in my city now which feels like a giant leap forward :)
     
    warthos3399 likes this.
  45. jamespaterson

    jamespaterson

    Joined:
    Jun 19, 2018
    Posts:
    242
    Great progress
     
    Stephen_O likes this.
  46. Rabbity1

    Rabbity1

    Joined:
    Jan 15, 2020
    Posts:
    2
    Really good job, graphics look incredible. How did you learn how to do all this? Self taught?
     
    Stephen_O likes this.
  47. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thanks, yes I'm self taught. I found Unity in 2012 and used LOTS of Google, Stack Overflow, YouTube, Unity/Microsoft scripting docs, and Unity forums/answers. I also found and listened to anyone who put out content on the areas I was focusing on at any given time to find insight from multiple points of view.
     
    Rabbity1 and warthos3399 like this.
  48. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    764
    Back then, Stack overflow was great, we all do it, we find ways to gain the info we need, no matter the source. Youve done great Steve... please continue, your traffic simulation has improved greatly, kudos!
     
    Stephen_O likes this.
  49. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    Thank you.

    I finally had some actual work this week, and also put together a new IK Avatar Driver package for the asset store that I just submitted. I had a request for it so figured it was worth the time. This pack used to be published but was used as the upgrade path to Arcade Racer, so was lost in the process.

    I'm looking forward to getting back into Midnight Streets this weekend.
     
  50. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,190
    This was a slow week for the project, but I managed to clean up the traffic simulation issues from the last build and create more unique traffic vehicle prefabs to reduce repetition.

     
    cs747, warthos3399 and Peter77 like this.
unityunity