You are browsing as a guest. Sign up (or log in) to start making projects!

Car Game

  • 14 Devlogs
  • 51 Total hours

An arcade racer inspired by NFS MW

Super Star

As a prize for your great work, look out for a bonus prize in the mail :)

Ship #1 ✨ Blessed

This is a small NFS inspired car game demo. It’s a project to test my technical abilities in Unity. It features custom made vehicle physics based on Unity’s built in wheel colliders and a custom easy to use solution for racing ai. Besides that, it is (in some small predetermined angles) a fairly good looking game, with a little bit of style.

The game uses Unity’s HDRP render pipeline for its graphics, together with some screen space reflections and reflective materials, the game gets to look fairly good, especialy in the low light enviorment it’s set in.

The car physics are in a sim-cade style. The car can still do crazy steering at high speeds, and its very easy to rotate it, but understeer and oversteer can still occur, besides that, the car is not limited in any way when it comes to external forces that can imbalance it, hit a curb at a high speed and the car can go flying.

The biggest challenge was the racing AI. First of all it was hard to make a car know how much to steer to go from point A to point B. After that, it was fairly simple right? Just sample some point from the road spline and follow them. But curves exist, and for that you need to calculate the right speed to go trough it so that it wont crash. Then, the car was driving very inefficiently, following the middle of the road, so what followed was a long quest of making a racing path generator, in which I succeeded (with the help of AI).

Then came obstacle avoidance, making the car not seem just like a train following a predefined track. If necessary the car will go off track to avoid obstacles and it’s aware of cars around it and will try to keep the distance. There is also a system that predicts collisions with other cars (for example if a car in front is cutting in front of it, it can predict that will happen and brake). This is all theory but it still works in game, sometimes.

Another hard part was building a city. I had no prior experience in making games that aren’t made out of just basic cubes and shapes, so it was difficult to find assets and other stuff to populate the city. Then also came the point of how much detail should I even add and many other factors that in the end made me make the hard decision of making just one race in order to not break the illussion of a semi believable city.

I’m very proud of how it came out, alltough I have so many ideas about how I can make it grander and better, but i currently don’t have the time to do so. I hope to come back in the future and actually make a cool metal-rock and boost infused racing game like NFS Most Wanted, but it has to wait.

For those who want to play test the game. Currently there is only a windows version for the game, and it can also be pretty demanding in terms of GPU (Basically, I think it needs a dedicated GPU, I have a rtx 3050 4gb laptop GPU and it runs fine). There is a simpler driving demo scene which is just white terrain with some roads, that maybe will fair better with lower end hardware.

  • 14 devlogs
  • 51h
  • 15.73x multiplier
  • 967 Stardust
Try project → See source code →
Open comments for this post

3h 12m 35s logged

BUILD READY!!!

This is the last devlog before the ship.
Alltough the game isnt in the state I would like it to be, school started and i’m in my terminal grade, so it’s a tough year ahead, so I have to shelve this project. The race is playable, its difficult in a way but its also fun. I also added a second level which is just an open map with a field and hills for you to test the driving physics and also as a lower graphical alternative to the city race.
In the final hours of development I added all the basic necessary menus and fixed some bugs that I catched while testing.

See you in the ship!

0
0
20
Open comments for this post

3h 41m 23s logged

I’ve reworked a few sections of the track and tweaked the racing AI. They can now almost always finish the race unless the player does some tomfoolery. Besides that I fixed a ugly visual bug where the terrain would poke trough the road when the camera was closed to the ground.

Next, I remade the speedometer, RPM indicator and Gear indicator as you can see in the screenshots.

The final thing that I added is a detection of “large” crashes, alltough is inconsistent, I dont currently have ideas how to fix it right now. For now when it detects a crash it enables slowmotion for a fraction of a second just for some oomph.

All that remains for me to do is UI:
-Race start countdown
-Race finish info
-Pause Menu
-Main menu
And a Game Over screen for when you crash.

After these additions I will ship the game, as school started and I will have to shelve it, and I dont want to miss out on the sweet stardust it can offer!

0
0
21
Open comments for this post

2h 51m 16s logged

Soo, I made the car more believable. It has working brake lights (WOOW), and new engine sounds that make it sound more powerful, but also added something extra spice, like exhaust backfire, that is programically made, with a multitude of firecracker sounds that I then processed. Besides that I also added a turbo blow off sound. They use the simulated rpm to decide their pitch and intensity, while also considering the throttle difference and position.

Last thing (visible in the last seconds of the last video), I improved the crash physics with detachable parts and deformable chassis.

0
1
9
Open comments for this post

2h 44m 8s logged

The map is done! I added some bariers with a simple shader, but I might change them soon, as I dont like the way they look. I also added a new car for the race.

I’ve also done some optimzing, enabled mesh batching, and after i’m 100% done with the map I will also bake the lighting for even better performance.

I’ve decided to leave out traffic for now, as its’ pretty difficult to implement and I don’t have the time, since school is starting.

As a small to do list for the ship:
-Main menu with settings
-Start sequence
-Race Timer
-Ending Cutscene
-Model credit list
-Sounds
-Maybe some music

3
1
222
Open comments for this post

3h 20m logged

I have been working on the map ever since the last devlog. There isn’t much to say as there is to show. The scene has gotten laggy with lag spikes that seem random, so I will have to investigate and see how to optimize the game.

0
0
28
Open comments for this post

3h 32m 8s logged

Alright, i’ve been busy collecting assets and making materials and collections in order to start work on the map, which I did, I started with the dock area, since I dont yet have many house models, and well, I think it’s looking pretty cool, ngl.

Next up I’ll go around the track in order to detail the section most. I am using the darkness and distance as a tool to be lazy, but also optimize. No point in detailing a part the player wont see. Also in my toolset is the fact the player will be moving fast and concentrating on the road, so it won’t be necessary for me to detail every inch of the map, instead focusing on intersections and areas the player will be slow enough to notice such details.

0
0
22
Open comments for this post

2h 10m 1s logged

The really fun part has begun! Im stylizing the game. Yeah, I decided to skip traffic for now and instead get busy making my environment. First I started by making a cool night sky and lighting, i turned on some settings, and I am pretty afraid that this game wont run decent at all when Im done, but ill do optimizing later, im sure it will be fine.

Im still in search of models, as modelling everything by myself is out of the scope of this little project. But it’s gonna be pretty cool looking, i believe.

0
0
8
Open comments for this post

1h 24m logged

Ok, i’ve worked around a bit, and decided that for the first ship I want to release ONE very good feeling race. So I wont complicate myself with tuning and other systems, it will be one car, one race. So the atmosphere will be very important. I already have the layout of the race done, it’s supposed to go trough the docks > coast > downtown > highway and then the race ends.
Also I believe making this small but very polished game will lend me more experience than something that will be overly complex, as many of my game projects end up.

I will start with the terrain an polishing the track to make it more interesting in terms of driving and then i’ll get started on the terrain and dock area

0
0
11
Open comments for this post

5h 4m 43s logged

The racing AI is done. I also made a small race manager which takes the cars, aligns them in a grid and then starts a countdown. It also keeps trak of the position and lap-times, but there is no UI for that yet.

I also started working on the Map for the demo, i’m still debating how big the demo will be, but probably it’ll be a few races. After I have a small map layout, i’ll get started on the traffic AI, and move on from there.

Im still trying to get the hang of this road tool I am using, and also getting the road dimensions right, but we’ll see.

0
0
20
Open comments for this post

3h 8m 25s logged

I’m very happy with the racing AI, while it’s not perfect and cannot avoid everything, like a wall in the middle of the road, I dont think that will be the case like ever. It can avoid other cars, either static or not and it uses a basic prediction to determine if it’s on a collision course with another car and act accordingly.

Also, for the path, as you could see from the beggining of the video, the path was already backed based on the road. The car then only decides when to brake and steer based on that path.

Next up i’ll make a demo race with multiple racers and position marking and stuff and then get started on the map.

0
0
14
Open comments for this post

5h 38m 18s logged

Alrighty, I decided to actually use my brain and came to the conclusion to instead bake the racing paths, instead of just having them create one at runtime. I made a small unity tool, I just place the checkpoints, click bake and a racing spline gets generated. If you look real close, you can see that the line follows an outside-inside-outside path for steering. Now that I have this, I will work on the racer Ai itself. First I will make it follow the track with optimal speed and then teach it to avoid obstacles, other cars and then even overtake.

0
0
20
Open comments for this post

3h 16m 26s logged

Okk, I feel like i’m getting close. As you can see, the car now tries to build a racing line, this is all in real time. While its still not perfect, I feel like I am getting close.

There are still some bugs related to the pathing on the road that I will have to fix, but overall its very good.

The system works by identifying an apex. The geometrical apex is considered in this case the point which has the biggest angle difference compared to its neighbours. Now, after it identifies the apex, it grabs all points leading to the apex, and shifts them to the outside, before starting to shift them to the inside towards the apex, all using a sine wave based lerp in order to get a nice arc. While this system is good, I feel like the driver script that is responsible with making the car follow the points is kind of goofed, so i’ll look into that.

0
0
13
Open comments for this post

6h 35m 55s logged

Racing ai, thats all I’ve been doing. It works fine-ish, i feel like Im close but it still overshoots, but I have some ideas on how to fix it.

0
0
13
Open comments for this post

4h 35m 45s logged

I have been working on making racing ai for the game. As a small intro, i have worked on this project before, and what I got is a working car controller, and dialed in physics to something I like how it feels.

The ai represented a difficult problem. If I want this to be open world, and for there to be police chases, I needed the NPC car to be able to go offroad, so basically, of a set path. There would be the option to make a hand tailored map and even for the offroad sections to be counted as roads, but that would be hard for one developer to do and test, so I opted for this. When the car is not on a road network, it fallbacks to the built in navmesh system in unity. It then uses it to calculate a path as a list of point and then drives between them. On the road, we just need to sample points from the spline of the road and then drive between them.

The hard part was this driving part :D
While it might seem simple, just point the car to the next point, and then have it move forwards, there is much more nuance to this. First, the NPC car should behave just like the player car, it should have the same turn angle, and thus I must now convert a simple direction into a steering angle. Another difficult part is when racing. I can’t just have it accelerate always, the car must brake when a sharp corner is coming up, and for really tight one, maybe even drift. So how do you do that? Well, i dont know yet, this past 4 hours I have been working on the same script and same section trying to figure that out. I really hope that next devlog I can come with a solution, but i cant promise anything.

My plan is to calculate the curve of the upcoming curve, and then somehow spit out a good speed for that, but there are a lot of factors to account for, like the grip of the car and actual speed, distance to corner etc.

0
0
7

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…