My Coding/interest projects around Amiga, retro gaming and "stuff".
EAB Lemon Amiga AROS.ORG AROS-EXEC AROS World
Quick Links
Rebelstar 2 - More development AI and General coding (part 4)
AI and internal issues
The AI routines were just about complicated as I imagined at first, but not exactly as I thought.
Adding a specific path finding routine seemed an easier task in the present time, with the internet and such. But the reality is that the algorithms are too heavy for 68000 based machines, specially the lower 7mhz ones. And the only saving grace was that I didn't had movement in real-time but turn-based with individual unit handling.
The approach here would probably be different as the original with the amount of memory would probably work with tables to use path-finding, and the Amiga does an adapted version (by me) of the famous A*.
I opted for a trying to develop a somewhat simplified and rough version of that (taking in account different unit type movement restriction and cost). That made my find-path code is memory hungry (almost 100kb just for variables) and slow on modest hardware (got up to 40 seconds in the most extreme condition for the map on A500). So, I optimized them with some unit area bounds and some specific table creation for lower models.
With the path-finding and line of sight routines in place it was actually easier to setup a sort of behavior for the computer units to follow.
That was a major milestone for me and allowed me to concentrate on establishing AI behavior for both the Aliens and the Raiders (which is more difficult since they are outnumbered and have more objectives than just kill on sight and drag the game). Also having them handle objects and have different specific purposes. Even when to decide to escape to the Shuttle!
The original
Naturally I didn't have the original source code when I developed it. After having it all running and having a feeling for it, I did wonder if it was too different from the original...
At one time I remembered that maybe I should take a look onto Rebelstar inner workings, so I emailed William Fraser famed by his rendition of LS on java and his site on Laser Squad in general (he did have a small mention to Rebelstar):Laser Squad Home Page
I asked William Fraser for his input, as he developed the original JAVA versions of both Rebelstar and Laser Squad for JAVA, based on the disassembled original code. He gently provided me his JAVA source code, as well as providing the original disassembled ASM. While I did this because of weapon damage soft stats and damage calculation regarding the original, and allow me to take a look onto another stuff.
What I found in term of path finding was as I expected a table of routed and region importance. Which makes sense - in the original the aliens can go pretty much anywhere apart from the trees and walls. The only exception is the swamper which only moves on the river.
I wasn't going back on my code now, but in a hindsight somehow, I felt it was the easier route (not necessarily the best - that's debatable).
Naturally other differences stood out on the unit next command selection, something I noticed but never paid too much attention as it seemed not relevant, but after verifying the internal works how it searched through the map and how AI units were handled, it made perfect sense.
Regarding the AI behavior, well my code while different did mimicked in broad terms the original behavior, except for unit entering cover mode. In mine brute implementation the computer AI is more aggressive and persistent. While I knew that was a thing, as I had experienced on the original Rebelstar (not so much on the 2), hadn't thought much about it - as it was much more in with Chaos Theory, let the chips fall where they might... But I should take some notes and come up with my own implementation.
Other stuff stood out such as the computer opponents do not pick up items. In fact, apart from reload they don't really change stuff. So, there's where my version definitely improves! As well as having different AI behavior for type of units and both sides, as well as threat assessment (instead of random enemy unit targeting - which admittedly actually worked very convincingly)!
But if you take in consideration the tools and limited memory Julian Gollop had to contend (and all is Assembly), you got to be impressed. That's when people mention best game creator/designer/programmer his name springs first into my mind. Rebelstar would be topped shortly by Laser Squad on the ZX-Spectrum.
In a nuttshel - Amiga Rebelstar 2 is not a port of the original. Apart from the name and stats which were public in gameplay, it follows my interpretation of the original - while not trying to be to different. Some game mechanics are similar, but others have a different twist (I'll do an article on that later). And while it would be easier to port and then add features, now it's done my way...
So, thanks William Fraser - your help was eye opener for me!