Badly Drawn Racers 2?

id: 739760

category: Show and Tell

posts: 59

RobFarley74 RobFarley74 loading
So one of my first projects was Bady Drawn Racers. It's got a bit of interest again recently and it got me thinking about a rewrite to fix many of it's short comings.

I did attempt a rewrite a while ago making a radical departure from the way it worked before, a more bendy twisty road, but honestly I just couldn't get the game balance right and it was just too difficult to play.

So here's what I'm thinking, what's good, what's bad…

The good:
The physics are decent enough and fun
The collision is decent enough and gets the job done
The graphics are good
The sound is made with my mouth! So… Ya know!
The commentary radio chatter I was really pleased with
The way the map rotates is good.

The bad:
The track - Argh! Having to manually create the track in notepad, working out all the waypoints and complexities was WAY too hard, hence there only being one track. This approach was completely abandoned for Hover craft racing and I wrote a track editor, the AI waypoint system was also rolled into this algorithmically so there was no need to set each way point manually. This clearly is the way to do it!
Clones - Everything is made with clones so it's complicated as heck to map all the tiles and put them in the right place and in the right order so this needs to be rewritten using stamping of costumes.
Sprites - There's no good lay out here, it's just a hot mess of code hap-hazardly calling other bits… This needs to be uniformed.
No game timing - The game has nothing to keep the timing so if frames drop the game plays slow, this needs to be resolved so the game core runs at a constant speed.
Mobile friendly - Or not! See if this can be improved
Front End - It does the job but it's not very exciting is it!
Particle system - Well I've written enough particle systems in scratch now, this one needs to go!
Respotting - Yeah… It's rubbish isn't it!

Features:
So people talked about having power ups, shops, upgrades, pit stops etc. Although all of this is cool, it's a lot of work for not a lot of gain IMO, try and convince me otherwise!
Personally I'd like to add more scenery in the game, piles of tyres to run through and have them scatter… Cardboard boxes, leaves falling from the trees… None of this will really do anything to the game, but they add polish.
It needs a mini-map… I agree!

So I'd love to hear your thoughts on this. What changes would you make? What is good, what is bad, what you'd change. From my list there's clearly a lot more Bad than Good in the game, lots of things need rewriting and not a lot can be kept, but if there's enough interest in this I might give this a whirl!
colinmacc colinmacc loading
Can't really argue with anything you've written here!

I just refamiliarised myself with the project. It's already one of the best racing projects on Scratch. I don't like the track layout it's true, that hairpin gets me every time, and yes the respotting is bad but what's the alternative, other than barriers all the way around…

So it would be nice to have a choice of tracks yeah.

Maybe different cars with different characteristics?

RobFarley74 RobFarley74 loading
The track design was specifically built to test the AI, it was never meant to be the final product, it's just that the overall design of the game was so flawed creating new tracks was way too much like hard work!

Cars with different features is an interesting idea, I could probably play with traction, top speed and acceleration… The issue is trying to get that balanced so no particular car has an advantage over the others, but… I'll have a look!
X-Marshal X-Marshal loading
It would be so cool to have different cars to choose from, with different speed, turn rate, traction, acceleration etc., especially if they look visually different. My main suggestion (which I think I've mentioned before) is to make the car select system (and other settings, I guess) a grid of options to choose from rather than ‘click for next’.

I would absolutely love for a remake to be done.

This is a properly good game.
RobFarley74 RobFarley74 loading
The effort involved in drawing new cars is crazy! When I drew the one car I didn't expect it to take as long as it did turning it into a workable sprite! So cars looking different beyond the livery is not going to happen this time round. However, I have been thinking about the driving characteristics and how to resolve that.

I think a method of tuning might be doable, whereby you can for example improve acceleration at the cost of top speed, likewise improving traction may cost acceleration… Something like that anyway… So if there's a bendy twisty track you could tune the car for that, likewise if there's a track with lots of long straights you could tune it for that. Getting the balance right is going to be difficult though, but that feels like an achievable compromise.

These sliders could also be randomised for the computer players to give them a more unique AI performance

The whole front end and car selection stuff on the original was all bolted on afterwards with not thought towards it, hence it being a touch janky!

I started to take a look at the code last night, and it's a mess! Not sure how much of it will survive! They'll be a lot of rewriting to do!
RobFarley74 RobFarley74 loading
We have the start of a track editor. Track size is now 32x32 tiles.

Development so far allows you to pick a tile and draw it on the grid, not particularly exciting, next step is to get it to verify the track as valid and automatically create waypoints for the AI

RobFarley74 RobFarley74 loading
So, it can now run the track by itself working out the route, and dropping waypoints on the way for the AI to aim for.

This screenshot shows the track rendered as a grey blobs, the red dot is the start/finish line and the white dots are the tiles identified as a valid route. This means each of the racers will need to pass through of these tiles to complete a lap. I'll add some allowance for missing the odd route tile if you come off the track. If you miss too many it will respot you back to where you were last on a valid tile.

Waypoints are dropped on each corner. I'll likely need to finesse this somewhat to make it more robust and to improve the AI, but for now, it understands all the corners from all directions and which direction this will next take you in.

RobFarley74 RobFarley74 loading
So the next stage is to rewrite all the AI and car control, and try to salvage as much as the physics and collision code as possible. If all goes well I'll have cars driving round the track in a convincing way… Then it's down to racing them and see how good or bad the AI is and make it so they're good enough to be a challenge and adaptable enough to allow them to be beaten by the players who may not be so skilled!
RobFarley74 RobFarley74 loading
Actually… Missed a bit… Need to make the tile engine render the map!
RobFarley74 RobFarley74 loading
So I have got the tile engine working now. Independent rotation and camera position. So that's nice. Feels like it makes sense to add the passive scenery (trees) in there too now as this will be generated as part of the track editor, likewise now I have the route calculated I should be able to make it automatically add road signage for corners.
RobFarley74 RobFarley74 loading
So level designer now automatically decorates the track with the correct arrows for the up coming corner, and also adds trees around the edges of the track. Time to make the start line work now. And once that's all done onto the exciting part of trying to make cars go round the track!

And I appreciate this looks no different that the version you see, but behind the scenes it's night and day! This effectively means anyone can draw a track and the game will “just work”… that's the dream anyway!
The effort you're putting in this project is insane!

when green flag clicked
ask [Do you want games that are not your generic platformers you see everywhere on scratch?] and wait
if <(answer) = [yes]> then
say [Then come check out my profile!]



else
say [Okay I guess...]
end
RobFarley74 RobFarley74 loading
So much for not needing to write too much new code…
  • Physics entirely rewritten
    Tile drawing entirely rewritten
    Car control entirely rewritten
Not sure there's much code left from the original… Actually… Probably keep the team radio stuff!

On the upside I've got a car with manual control zooming around a track

Next steps are completely rewrite the AI, completely rewrite the Particle system (I've even drawn some new particles for this too which I hope looks cool!)…

Then it's collision, ordering of cars, race positions, re-spot, etc etc… Argh… I didn't expect this to be a complete rewrite!

I'll post some progress up soon!

RobFarley74 wrote:

So much for not needing to write too much new code…
  • Physics entirely rewritten
    Tile drawing entirely rewritten
    Car control entirely rewritten
Not sure there's much code left from the original… Actually… Probably keep the team radio stuff!

On the upside I've got a car with manual control zooming around a track

Next steps are completely rewrite the AI, completely rewrite the Particle system (I've even drawn some new particles for this too which I hope looks cool!)…

Then it's collision, ordering of cars, race positions, re-spot, etc etc… Argh… I didn't expect this to be a complete rewrite!

I'll post some progress up soon!
Sick!
RobFarley74 RobFarley74 loading
So here's the first attempt at AI completely generated automatically by the track… For a first hit I don't think that's too bad, but clearly we need to generate more way points to describe the track better. Also currently it's just locating the way point in the middle of the tile, this needs to be improved to try and generate a race line

Click here for the video

The frame rate is low on the screen recorder not the game itself!

RobFarley74 wrote:

So here's the first attempt at AI completely generated automatically by the track… For a first hit I don't think that's too bad, but clearly we need to generate more way points to describe the track better. Also currently it's just locating the way point in the middle of the tile, this needs to be improved to try and generate a race line

Click here for the video

The frame rate is low on the screen recorder not the game itself!
try checking out @Minoru07 he has a project that has similar features but works way better

heres the link: https://scratch.mit.edu/projects/938057740/
RobFarley74 RobFarley74 loading

Stickmanongoing55o7 wrote:

RobFarley74 wrote:

So here's the first attempt at AI completely generated automatically by the track… For a first hit I don't think that's too bad, but clearly we need to generate more way points to describe the track better. Also currently it's just locating the way point in the middle of the tile, this needs to be improved to try and generate a race line

Click here for the video

The frame rate is low on the screen recorder not the game itself!
try checking out @Minoru07 he has a project that has similar features but works way better

heres the link: https://scratch.mit.edu/projects/938057740/
As I said, this is the first iteration of the AI this was my first hit of “I should probably drop waypoints here” and see what happens. The thing with mine is that it creates the way points automatically from the track so you don't need to set them yourself, that was always the problem with bdr and why it only had one track because it was a massive manual process. I've been sketching up ideas of how to improve it and should have an updated demo soon.
RobFarley74 RobFarley74 loading
This was my thought process last night, each waypoint will have an XY of the tile location but also an extra value (1,9) which will be the location on that tile, this way I can make the cars follow a more accurate line through corners. Then there's the issue of how to auto allocate the way points, and what to do when you get fast changes in corners and how to resolve clashes in potential waypoints. And finally there's the issue of if a car comes off the road and the next waypoint is a long way off it'll just ease itself onto the road rather than trying to get back on the road. I'm thinking I might just be able to distribute waypoints along a straight say every 3 or 4 tiles if there isn't a waypoint for a while… I'll try some different things.



So essentially there'll be a couple of waypoint passes, the first will just place then by running along the route, then they'll be another pass to clear out and/or resolve conflicting waypoints, and finally a pass to drop waypoints in any big gaps to keep cars on the road generally.
RobFarley74 RobFarley74 loading
Latest update on the AI

There's still a bit of work to be done, adding randomisation in so not all cars will follow the exact path etc, but going to declare this “done” for the moment to allow me to move onto multiple cars etc. Then I can race them and finesse the AI.
RobFarley74 RobFarley74 loading
Another update with multiple cars… collision needs work, but I think we're more or less there with the AI and auto waypoint system. I added in some pretty extreme corners and it seems to handle them pretty well. Again, frame rate is poor due to the screen recorder not the game itself.

Need to get a better screen recorder!

So next is to sort out the collision, then sort out particles, race order, respotting if you come off the track too much, race timing, um… yeah, still quite a few things to do!

So much for this being a quick and easy fix up!
RobFarley74 RobFarley74 loading
So just got the collision working, seems pretty good now, next step is to get on / off track detection, race position, lap times, respotting… And then probably need to tighten up at AI a bit more!
RobFarley74 RobFarley74 loading
Fresh video using a better screen recorder!… It's not showing much but it does highlight a selection of AI flaws.

1) The auto waypointing isn't quite right, there are additional waypoints that are added that need to be subsequently removed, it already does some of this but I've made an update to the waypoint array that now holds what point on the route it is, this will allow me to look forwards and backwards on the route much easier and see if the next or previous part of the route has a waypoint, and do something about whatever is in the current point. It'll make sense when I do it! It's more of the same of what I wrote on the piece of paper ^^^ up there!

2) Even with perfect waypointing, the cars need to “see” the edges of the road and try and stay on it

3) The chaotic nature of the video is mostly around the cars colliding with one another and pushing them all over the place. So should the cars “see” the other cars and make steps to avoid collisions? (probably!)

LionCoder10 LionCoder10 loading
I love badly drawn racing! Here are some suggestions for this sequel:
-A mini-map (so you could take a glimpse of the map, and also be able to see the player dots)
-Cars that have different stats
-Maybe even try to make it online? (with AIs in case no ones there)
Idk, just ideas. I hope the second one turns out AMAZING!
RobFarley74 RobFarley74 loading
Mini map is already on the list
Cars with different stats is also on the list, need to play with this once I've got the AI stuff sorted, but essentially it'll be tuning of acceleration vs speed, traction vs speed etc.
Online isn't going to happen!
RobFarley74 RobFarley74 loading
So after all this messing about with way points I've just thrown all of that code away and just use the route instead, seems to work just as well (if not better) and actually simplifies the whole thing! Update soon!
RobFarley74 RobFarley74 loading
Oh, and mini map is in now too!
LionCoder10 LionCoder10 loading
Cool! Out of curiosity, do you have an idea of when it’ll be done?
RobFarley74 RobFarley74 loading
Honestly no idea! I have a full time job, kids, and very little free time to do this stuff, however, I'll keep posting up progression here as it develops and we'll have a clearer idea of completion.

The majority of the game dynamic is there, I'm currently working on the particle system for the smoke and mud fx. Then just need to do race order, respite, lap completion code and lap timing.

Then it's onto the front end stuff which always takes longer than expected
Pikkewaan Pikkewaan loading
What if you got other people to draw the cars, like, in a contest…
And to build up hype, release a dev progress project every so often, to keep people on their toes, and a good trailer could be helpful, with a countdown after. The trailer could be something like this: https://scratch.mit.edu/projects/936487100/ only yours would have to be a bit more funky…
I really think it's cool that someone is putting so much effort into a SCRATCH game, which is why I think the development should go into something else afterwards. Something to put on game platforms (websites) It could be called Badly Drawn Racers: Scribbles and Smoke. I know this is bit ahead… but………………
Pikkewaan Pikkewaan loading
Can't say names of websites cuz scratch won't let me…
RobFarley74 RobFarley74 loading
The issue is I can't commit to a Dev deadline because of real life! Fear not, it will get done!
RobFarley74 RobFarley74 loading
So here's a little update of the progress made today. We now have the new AI using the route rather than a waypoint system, this could do with a bit of finesse but I think it's objectively better, also less calculations, although, I was pretty pleased with what I'd done, this is simpler. It's always a shame to throw code away but it makes sense to do so in this case.

I've also added a particle system so we've got some new smoke and dirt that kicks ups. I drew the smoke recently and I'm pretty pleased with it, I think a bit of cartoon animated smoke looks far better than the more realistic smoke of the earlier versions.

So still to do as mentioned above are race order, respotting, lap timing etc. Still bits and bobs, but getting there!

Video here!
Pikkewaan Pikkewaan loading
Not a deadline, just a thing to do every now and then, sometimes you might share 5 in a week, others you won't be active for a month.
RobFarley74 RobFarley74 loading
Given I don't have much free time to work on the game itself I really don't have time to make trailers!

However, updates for today are that I now have off track and respotting sorted and it works pretty well. I do want to add some more complexity though as the on/off track is entirely around the tile and this isn't great on corners as it detects on road when you're clearly not on the actual track as corners don't use the entire tile. So looking at improving that. My theory is it shouldn't be that hard as it just needs to work out where the centre of the corner circle is and do a bit of Pythagoras on it to decide if you're on or off track… That's the theory at least!
Pikkewaan Pikkewaan loading
I could make a trailer, or at least a teaser, of which you could quickly tweak if you have to. All I'd need would be a few cool screen shots of action, as well as the track, so I can animate the cars, video (which you already have) and a few sprites of the cars.
RobFarley74 RobFarley74 loading
New Video!

This is a pretty huge update over the old version. So the detection of ‘on’ or ‘off’ road was entirely based on what tile you're on.

This works great for the straight road tiles, but on the bends, especially the less tight bends, there's a lot of grass and this all originally counted as “track”, however, I've added an extra check if you're on a bend and it performs a radius check so we get a far more accurate representation of the track. This is shown by the red circles that appear when the car is on a corner tile.

The check is “what tile am I on? If I'm on a road piece then I'm on the track”, then there's the additional check of “If I'm on a corner and I'm inside or outside (based on the tile) of a given radius then I'm not on the track.”

Which is nice.
RobFarley74 RobFarley74 loading
So just to give another update, I'm currently tuning the physics so it plays well, trying to make it so coming off the throttle to power slide it round a corner is a thing, proving to be quite tricky, but I'm keen to make it more than just hold down accelerate and steer round corners, make it a bit more of a challenge to play.

The AI players are currently tough as hell too, I can't beat them! This is a good thing as it's easy to make them dumber!

Things to do are race order, completion of tracks, lap timing, lap number… So a few things really!

I'm going on vacation in a couple of weeks so the likelihood of this being complete before then is pretty small, I'll see what I can do, but we'll have to see how it goes!
LionCoder10 LionCoder10 loading
Sounds like it’s really coming along! I guess the physics mostly work. I’m so excited for this!
Fun(ny) Suggestion: if you can choose the AI difficulty, you could keep the “impossible” mode on for fun
And, now that I think, can you make the mobile controls easier? It’s hard when everywhere you press is the joystick. Maybe a fixed joystick in the bottom center?
RobFarley74 RobFarley74 loading
Latest Video update…

Sound, particles, AI, Lap time and Lap number… Quite a few updates here, each of the cars now knows it's lap time and what lap it's on. This sounds obvious but pretty handy for a racing game. Next up is to keep track of grid position. Record all the lap times for each car for each lap, and make the commentary understand all this data and let you know what's going on, who's fastest, what position you're in etc. Anyway… More stuff to come soon!
LionCoder10 LionCoder10 loading
Wow! This looks so great! I really think it’s coming along well!
151766cc 151766cc loading
I hear you saying that the frame rate is low. Maby run it in turbowarp! in turbowarp go on the top left press adbanced, warp timer and interpolation.
RobFarley74 RobFarley74 loading

151766cc wrote:

I hear you saying that the frame rate is low. Maby run it in turbowarp! in turbowarp go on the top left press adbanced, warp timer and interpolation.
No the frame rate was low on the original screen recorder. The game itself runs absolutely fine.
RobFarley74 RobFarley74 loading

LionCoder10 wrote:

Wow! This looks so great! I really think it’s coming along well!
Thanks, I'm going to need to redo the mini map, it's pretty much useless as it stands, so going to make it bigger and scroll and rotate like the main track itself so you'll see a few corners ahead, I think that would probably be more useful
Firemalaya Firemalaya loading
Make the car customizable and add bodykits,colour and upgrades and add new cars like tuner,muscle and exotics and add new locations and I will make the game poster.And iam trying to make concept model.
RobFarley74 RobFarley74 loading

Firemalaya wrote:

Make the car customizable and add bodykits,colour and upgrades and add new cars like tuner,muscle and exotics and add new locations and I will make the game poster.And iam trying to make concept model.
I'm not going to do down that path, but I'm hoping there to be an element of tuning, speed vs traction for example. The whole game is getting quite big now and it's definately going to need to be played on turbowarp on the majority of machines. I've been aiming to have it run on my phone without turbowarp, but, it's a horrible slideshow on my phone now. It's fine with only 4 cars, the more you add the slower it gets! I've added optimisation so that collisions don't happen when you can't see the cars and particles don't spawn when you can't see them, but this really hasn't made the impact I was hoping for.

Here's the current state of the car sprite, bear in mind, this sprite is just the one for handling the cars, nothing to do with sound, backgrounds, foregrounds, etc. There's quite a lot going on!

Actually… having stitched this image together, I think I can make some optimisation in the getRouteId block… Going to try that now!


Pikkewaan Pikkewaan loading

Firemalaya wrote:

Make the car customizable and add bodykits,colour and upgrades and add new cars like tuner,muscle and exotics and add new locations and I will make the game poster.And iam trying to make concept model.
Uh, this isn't that kinda game…
RobFarley74 RobFarley74 loading
So I made a few optimisations last night that have really improved performance and the game is now (mostly) smooth on my phone again. Trying to work out the best method of working out position in the race, it's a surprisingly difficult thing to do!

I'm feeling decidedly less optimistic that I'm going to get this finished before I disappear on vacation. But we'll see if I get a few hours on this over the weekend and where that leads!

It's also been nearly a week since I've put out a video and there's been some nice cosmetic changes which are probably worth sharing, more scenery, hud etc. I'll put something us shortly.