Car Game
- 14 Devlogs
- 51 Total hours
An arcade racer inspired by NFS MW
An arcade racer inspired by NFS MW
As a prize for your great work, look out for a bonus prize in the mail :)
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!
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!
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.
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
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.
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.
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.
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
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.
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.
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.
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.
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.
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.