Making Need For Speed 2015 with Game Maker
Comments
Transcript
Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.
In 2015, Electronic Arts decided the Need for Speed franchise was long overdue for a reboot. It was the first Need for Speed title in years with a 2-year development cycle. And when it released, it was met with, well, mixed reviews. Apparently, it launched with a ton of issues that made it borderline unplayable. I myself never had these issues as I bought it in 2018 when I bought my PS4, and most of the issues everybody mentioned when it launched had already been patched ever since. I absolutely adored the atmosphere in Need for Speed 2015. The perpetual rain, the beautiful reflections, the graphics overall, and the sound design. It's all truly great. And so, naturally, I wanted to create something similar in Game Maker. So, why Gamemaker, you ask? Well, I've been using it for 17 years now, and it is the only engine I have experience with. Well, say for a really old browser engine I used before I switched over to Game Maker. So, is it possible to make something that looks like Need for Speed 2015 in Game Maker? Well, yes and no. It
all comes down to how much time you want to sink into remaking a beautiful looking 3D racing game with both hands tied behind your back. And as an absolute masochist, I got to work. In this short series, I'll show you some of the obstacles I face while developing the game and what my plans are to differentiate it from Need for Speed to make it its own thing. [music]
>> [music]
[music]
>> First of all, I decided to split the time I was willing to give myself into two parts. The first to make a working car with a decent 3D model and the second to make the environment. For the car, I wanted to use a car that was available in Need for Speed before. And luckily, I own one. This is my 1999 Toyota Celica and it was featured in both Underground 1 and [music] 2. It wasn't present in Need for Speed 2015, but I do feel like it fits the nighttime street racing aesthetic very well. I spent a few weeks on and off working on this 3D model. It lacks a few details here and there, but all in all, it does look a little bit like my own car.
Making my own car in 3D was actually really handy as the blueprints I used for the modeling didn't give me all the necessary information to make it look convincing. After that, I set up a new Game Maker project. I then created a 3D camera that follows the car wherever it goes. After that, I use this little technique to make the camera lag a bit behind the car. Instead of using the car's facing direction for the camera's offset, I use the angle difference function to smoothly ease in and out between the two vectors. [music] This is what that looks like in code. And here is the difference it makes in the game's feel.
[music] The next important part were the environments. Need for Speed 2015 is an absolutely gorgeous game and it is actually surprisingly detailed. I made a few 3D models in Blender for the roads, sidewalks, street lights, buildings, facads, pipes, and many more. I then export these as vertex buffers so I can then load them into Game Maker. I have a tutorial on my channel in which I explain this in more detail. After that, I set up a very simple 3D room editor. For starters, I created an array of strcts in which I store the name of each model, the vertex buffered references, and the textures that go along with it.
I then use a simple loop in the draw gooey event to walk through this array. So I can then select each individual vertex buffer and place them into the map. As of right now, none of these models are actually being batched despite some of them using texture atlases. That will be my next big optimization, but the game runs fine for now. So I'm not going to spend too much time on optimization yet. All of these vertex buffers are then drawn in the draw event, so we have something to look at. The next step is then to create a shader for these models to make full use of normal maps and 3D lighting, which will help bring the scene to life. Need for Speed 2015 takes place during a night where it never stops raining. This is actually a very common complaint, but I personally really like the way it looks. I waited for ages for it to finally rain here in the Netherlands, something I never thought it would say since it rains here like 50% of the time. There's just something beautiful about wet asphalt and the way it reflects light. This was definitely something I wanted to add to my game.
>> [music] >> So in order to do this, I started writing a shader that would support multiple light sources, normal maps, specular highlights, and echo rectangular reflections. For example, for the asphalt, I used an albido texture that looks like this, combined with a normal map that looks like this. I have a full tutorial on adding normal maps and specular highlights on my channel as well, so I won't be going into too much detail here. With the albido textures added in, the scene looks like this, very Sega Saturnish. So now it is definitely time to add some light to the scene. In the create event of the control object, I add an array of light positions and a separate array for light colors. These arrays are then sent over to the shader alongside the size of the array so we can use them later to create point lights. I then loop through the light arrays I sent over to the shader and calculate the distance between the current vertex position and every light source. I then use the reflected vector to calculate how much reflected light makes it into the camera lens. This will determine the size and power of the specular highlights. So to make the lighting look a bit more interesting and less flat, I use a normal map for each mesh. I transform the RGB values of the normal map into normal vectors that are then used to fake additional detail on an otherwise flat mesh. So instead of using the vertex attribute that represents the vertex's normal orientation, I then use a combination of this vertex attribute and the color sampled from the normal map to make the asphalt look much more detailed than it actually is. I do love me some specular highlights and they might look extremely exaggerated in this game, but to be honest with you, much like our lord and savior Gabin once said, [music] realism simply doesn't interest me very much. Finally, I also added the echo rectangular reflections to the game by using a texture that looks a bit like this. This uses a similar method to cube map reflections in which you take the reflected vector from the camera's point of view towards the current vertex and use that to sample the correct pixel on a cubemap texture. However, since Game Maker unfortunately doesn't support cubemap reflections, or at least not in a way that I understand yet, I use this function that transforms 3D coordinates into 2D coordinates, which you can then use to sample pixels from the echore rectangular texture that looks a bit like this. It's not perfect, but I do think it looks pretty cool. So, with our lighting in place, the game now looks like this. I personally really like the atmosphere so far, but hey, environments only make up a small part of a full game, and we still have a lot of work to do to make it an actual racing game.
>> [music] >> The next thing I did were two things that I think are integral to an underground like racing game. Those two things being driving physics and sound. Now, I'm no expert when it comes to driving physics, but here is what I did. In the create event of our player object, I set up a few variables that will determine how the car behaves. I implemented the amount of stock horsepower, the weight of the car, the weight of the flywheel, the aspiration, and the engine type. This will also determine how the car sounds, shifts, and drives. The controls are also very simple. You accelerate with the W key.
You steer left and right using the A and D keys, and you break and reverse using the S key. When accelerating, a throttle value eases in and out between a value between zero and one. This throttle value then determines how fast the car accelerates. The acceleration also depends on the currently selected gear. [music] For now, there is only a manual transmission option, which means you are responsible for which gear you are in at all times, meaning you can even money shift if you wanted to. I faked some of the physics on the car by adding a slight rotation to the car's transformation matrix. This makes it look as though the car is being affected by the amount of G-forces it generates while accelerating and braking. I also added some very simple raycast to the car's wheels to determine whether the car is driving over a sidewalk. This will be changed in the future when I implement some actual elevation, but for now, this is pretty cool in my opinion.
Then for the car sound, I simply recorded my own car's exhaust sound using my old Blue Yeti. Unfortunately, I don't have any footage of that, but I recorded a few different sound effects from my car to make it sound as close as possible. I also added some foley sounds for the shifting and for the driving itself, like a slight whining noise from the belts and the transmission. I mean, it's a 28-y old car. Cut it some slack. Now, since my Celica is equipped with the 2Z G engine from Yamaha, it also has something called lift, Toyota's equivalent of Honda's VTEC. >> Honda VTEC. This means that once the engine reaches 6,200 RPM, something cool happens with the engine's cam shafts [music] that gives it more horsepower and makes it sound aggressive as hell, all while barely keeping up with the Prius in front of you. I then use the audio sound pitch function to have the engine sounds follow the car's RPM bend so that it sounds as though the engine is running at the appropriate amount of revolutions. I also added this RPM counter to the right, which closely resembles the Celica's own tachometer.
With all of this combined, the game sounds like this. Heat.
Heat.
Heat up
here.
Now, something else Need for Speed 2015 was known for was its customization. Now, it didn't really get around to making body kits or aftermarket parts for the game yet, but it did add some customization options. For starters, you can change the car's paint color, as well as the material used for set color. You can pick between metallic, gloss, satin, and matte. Metallic will add these subtle flakes to the car's paint which YouTube's compression will probably not allow you to see, while setting a matte dampen the reflections, which will give it this look. You can pick the color of your car using this color picker here. For this, I used the draw get pixel method, but you cannot tell the game maker guys about this because I will probably get lynched for that. Then, probably my favorite thing in the entire game is the livery editor.
I wanted the player to be able to add vinyls to their car, but I honestly had no idea how to do this. I started with the idea of sending five different surfaces to the shader as texture samplers. each surface representing a side of the car. Now, this was not going to work since Game Maker natively only supports up to eight texture samplers, which already includes the GM base texture. So, I reworked it by using a single surface, which I divided into five different areas. I discovered the GPU set scissor function completely by accident while skimming through GameMaker's manual. This was exactly what I was looking for. The texture I use looks a bit like this, where all sides of the car are divided into sections. I use five different arrays, so you can add vinyls to each side individually. Each element in the array represents a vinyl which you can move, rotate, scale, and finally place. It is very simple for now as it doesn't support copying and pasting or even deleting for that matter, but that is for another time. Now, I needed some vinyls and since I don't want to infringe on anybody's work while also staying very far away from stinky generative AI, I whipped up my old drawing tablet and started drawing some things up I wanted to place onto the car.
>> Yeah, I think just a little bit more shading to the left. And I think there we are. Hell yeah. >> The shaded then projects each part of the vinyl texture onto the desired side by comparing the vertex position and its orientation with each part of the texture. This ensures that vinyls that are placed on the left side of the car won't appear on the right side and vice versa. Now in the fragment shader, I then use the coordinates received from the vertex shader to project the texture onto the car. Again, it is not perfect, but it actually works surprisingly well. [music]
>> [music]
>> So, those were the main things I worked on so far. I have a lot of overly ambitious plans for the future of the project, such as adding races where you can wait your car and win your opponent's car if you win. I also want to add a lot more customization, more cars, better optimization, better sound, and so much more. In my humble opinion, it does look a bit like Need for Speed 2015, just with worse graphics. I do think the atmosphere comes quite close despite not having those annoying phone call.
Hey, hey, hey yo yo yo, what's popping my Just wanted to let you know there's a big race coming up in a few days. Like big money, big players. Yo, even running with Trace going with his est
5 my ass big time 69 for 20 talk soon broken.





