lajest - Crush Corp - Alpha v0.2.2 DevLog — page 1
/ 10

lajest - Crush Corp - Alpha v0.2.2 DevLog

More from lajest lajest - Crush Corp - Alpha v0.2.1 DevLog #2

About This Title

Hey again, hope everyone's been having a good month! It's time for another devlog~So this one is mostly going to be covering a new system that's been in development since last week, and some additional bugfixes that have been made since the v0.2.1e update. The new system in question is quite exciting in my opinion, and I've been eager to share it.Before getting into the details, here's a list of bugs that were fixed and will be applied in the next pass:

Coming Bugfixes

Added item insert help context

Added chemical container quantity context

Fixed chemistry station label not updating from red when loading new chemicals

Fixed save slot info time format

Fixed note UI scrollbar not fading with rest of animation

Fixed some scroll bars moving extremely slowly

Fixed big number overflow on reaction chamber monitor

Fixed a specific signal lingering on the screen for a few seconds on closing presentation

Fixed beaker fill visual bug on loading a save

Fixed carry weight UI not updating on scale change

Fixed held objects rendering behind tower during extreme scale events

Replaced placeholder beaker pad model with finished version

Fixed player walking even when holding shift from a stop on occasion

Implemented safeguard for incorrect save file types being present in save folder

There have been additional gameplay improvements and changes to the arena as well. Such as tinies now respawning over time. This is accomplished by some optimization to enable stuck tinies to remain rendered at a lower performance cost while new ones spawn. Will discuss more improvements regarding the arena in one of the subsequent devlogs/update posts.

Now without further ado, it's time to unveil the new system!

Traffic Simulation

That's right, full-scale traffic simulation is coming to Crush Corp!

It's something you might have been wondering considering the streets have been barren up unto this point. Well wonder no more! Recently I've developed a dedicated system for processing and simulating traffic on a scale that can cover the entire city. The system is in a working state right now and has been stress tested.

It currently includes the following features:

Massive vehicle counts (50,000+ cars)

Various vehicle models

Speed variations

Dynamic braking/acceleration

Curved roads

Intersections

Development pipeline tools to assist with road grid construction

Features planned for the near future

Dynamic density

Crushing behaviour

Integration with sticky debris (getting stuck underfoot)

Launching into the air from nearby stomps

Scattering like ants from nearby girls

Destroyed road rerouting

Now I will go into more detail concerning the development of this system. It might get a little technical, so bear with me.

Early Testing

To both determine the feasibility of this feature as well as to not bog down development, an early proof of concept test was performed on a limited time spawn (1-2 days). This early rendition of the traffic lacked varied vehicle speeds, lane tracking, road organization, braking behaviour, curved roads, and further optimization. However, it showed promise that being able to fully simulate the city would indeed be feasible when utilizing the ECS framework in Unity.

Speed Variation and Dynamic Braking

To better reflect real-world traffic, varied vehicle speeds would be required. However, doing this caused the problem of vehicles phasing through slower moving ones. Therefore, dynamic braking with respect to the next vehicle was required. Additionally, this further necessitated for the order of the vehicles to be tracked by lane so distance checks would not get out of hand.

Once braking behaviour and lane sorting was taken care of, it was trivial to add variable vehicle speed. The distribution of each vehicle's individual speed follows a bell curve to better simulate real-world traffic.

These steps took a couple days within ECS, but the results are visible above.

Curved pathing

Naturally not all roads are going to follow simple, straight lines. So alternative pathing was required to support curved roads. This was accomplished using cubic bezier math using reference points in the world so that cars can follow and path smoothly. Given that most roads are straight, most code runs the faster straight line math for optimization.

In order to fit these curves to the road, visual tools were implemented so that the path of the vehicles could match any curve in the road network.

Intersections

Currently intersections are supported to allow vehicles to move between various roadways. These cars also prefer empty lanes over congested lanes to better simulate real traffic. Currently the intersections do not have light control, allowing every car to pass through at all times. This causes vehicles to phase through each other mid-intersection, but this will be accounted for once the intersection logic is fully realized.

Large-Scale Simulation

Following the above features, stress test were performed handling 50k+ vehicles at smooth framerates above 70fps in editor. All the CPU-side processing for the sim was handled in just under 2-3ms for this quantity. The main performance bottleneck in this case was the GPU, which was needing to render a large number of total vertices. This indicates that further optimization can potentially be made to handle even more vehicles with proper LOD variants. However, since the city needs far less than this overall number, this indicates that the full simulation can run in the background without bottlenecking overall performance. Additionally, there will be an in-game setting you can adjust to limit the maximum number of vehicles for lower end system support.

City Implementation and Pipeline tools

Implementing the full-scale road network requires setting up all vehicle paths according to the city's road network. In order to streamline this task, some development tools have been made to simplify the process as much as possible.

Selected lanes show their vehicle pathing in cyan/dark blue based on dominant direction. Adjacent paths are highlighted in green/orange based traffic flow. Selecting individual intersections also highlights adjacent roadways. These tools and more better help to facilitate the full implementation of the road network. It's not something you'll see in-game, but figured I'd show you some behind the scenes of how it gets setup in Unity.

Conclusion

So there you have it, the city is about to become far more lively with this new system! To be honest, it was a question as to how many vehicles would actually be able to be simulated initially. But I'm happy to say that you'll be able to experience it at the full scale and bigger size ranges! Am very eager to integrate the reactivity to the girl's presence as well as mentioned in the bullet points earlier. This system should also be usable for ground-level near-sim in the future for traffic noise from individual cars and impacts, though that will come later.

Other than that, progress has continued as planned regarding asset production, animations, and more. Soon there will also be a new reveal in that department as well.

Anyway, thanks for taking the time to read all that if you did so.

Until next time!

Artist

lajest Artist ranked beyond 1,000 lajest 1 videos 5 albums 14.7K views View Profile

Comments (0)

1000 characters remaining

No comments yet. Be the first to start the conversation.