My daughter has shown some interest in STEM so I was going to buy her a BBC Micro:bit robot kit DIY for $80 (which is cheaper than a Rasp-Pi kit) and thought–you know, we should do some coding first to see if she’ll stick with it. Coding is free, more or less.
I searched online and was thwarted at finding a modern CRobots implementation. I am surprised. Are there really no fans of the genre? I tried several search attempts that should have worked to no avail. A few older projects that weren’t appealing. Ugh! Quite a few “real robot” sims but that’s high-end stuff. Kaitlyn is a beginner to coding.
So, as the saying goes, if you want something done right… I opened up a 12-year old project called DBRobots (coded in DarkBasicPro). Loosely inspired by CRobots, not following the syntax at all. It’s BASIC code, and not scripted, it’s compiled. You have to dump your robot code into the IDE and run it. So what? I searched for a Lua plugin but DBPro is pretty old and I’d rather keep the package simple.
The good news is, there’s a free open source version of DarkBasicPro on github and a binary that someone was kind enough to build for us old fans and share…. HERE. Uploaded by Lee Bamber himself. Very cool! The IDE is lean and fast and the full help system is built in (F1 on any key word). Beautiful.
I opened up DBRobots, circa 2008?, and it wouldn’t run. Egads. After some digging, I cleaned up the code quite a bit and got it to run. It was a problem with my old code and the timer() function. Cleaned everything up, the whole project, all of the code (it really isn’t very big). Got it to run in multiple resolutions. Added a settings file.
Here’s what a simple robot looks like:
function FlipFlopBot()
SetBotName("FLIP FLOP")
BotLoadSprite("tank1.bmp","gun1.bmp","bullet1.bmp")
`near left edge?
if GetBotX() < GetArenaLeft() + GetBotSize()
SetBotDirection( 90 - 45 + rnd(90) )
endif
`near right edge?
if GetBotX() > GetArenaRight() - 30
SetBotDirection( 270 - 45 + rnd(90) )
endif
`near top edge?
if GetBotY() < GetArenaTop() + GetBotSize()
SetBotDirection( 180 - 45 + rnd(90) )
endif
`near bottom edge?
if GetBotY() > GetArenaBottom() - 30
SetBotDirection( 0 - 45 + rnd(90) )
endif
if GetBotSpeed() = 0
SetBotDirection( rnd(360) )
SetBotSpeed( 100 )
endif
`memory bank 1 used for scan direction
degrees = GetBotMemory(1)
if degrees = 0 then degrees = 10
angle = GetBotScanAngle() + degrees
if BotScan(angle)
BotFire(angle,5)
degrees = degrees * -1
endif
SetBotMemory(1,degrees)
endfunction



So, I think this has great potential as a learning tool for kids. Not that there aren’t plenty of those out there already, but personally I don’t like Python and it seems like everything is done in Python these days. The language is terrible, can we just agree on that? You get used to it, that’s what you do with Python. LUA is far better if you can find an engine behind it. I wanted to go that route with DBRobots. Maybe it will still be possible in time. But for now, it’s easy enough to write a robot program in a new .dba file in the project, point one of the 4 robot “slots” to your robot, and juala–whala–how is that spelled?–your robot is duking it out with 3 others.
I have my own DirectX 9-based engine from years ago with LUA built in and used it in several courses with some full game implementations. But I don’t want to screw with Visual Studio ever again. 10 was the last one for me. I did manage to use 13 years ago for the 4th and final edition of Beginning Game Programming but it wasn’t a great experience. If I were to open up a C++ environment again, I’ll get burned out all over again. Gotta keep it simple. As much as I love C++ and can do almost anything with it (like implementing a software sphere texture mapper for planets in Starflight just before the project was abandoned), I don’t want to go there again at this stage of my life. I gave years–decades–of my life to code and I am a master but don’t find enjoyment at that level anymore. Which is why a simple thing like DBRobots made me smile today.
I might put this up on github in time but it needs a lot of improvements first. This was just one 6-hour marathon to revive it so far. Anyone who is interested, send me a line via email or IG @jsharbour (the one and only SM I use–because of my kids).