Laser squad a.i.

The place for codemasters or beginners to talk about programming any language for the Spectrum.
marenja
Microbot
Posts: 108
Joined: Sun Dec 26, 2021 4:15 pm

Re: Laser squad a.i.

Post by marenja »

ketmar wrote: Fri Jul 28, 2023 9:44 pm easy deal. but who will read and properly comment the code after that? ;-)
... and 3rd group who can analyze, annotate and comment sources as bare disassembly is just useful as source files but not for understanding of what is executed here and there.
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: Laser squad a.i.

Post by Bedazzle »

marenja wrote: Sun Oct 22, 2023 1:52 am Probably the work will be much easier with some co-operation ... hm-m ... a sort of crowd disassembling?
I can disassemble, but usually (as we all have) - have no time. :/
Anyway, it is interesting experience.
crabfists
Drutt
Posts: 29
Joined: Tue Sep 20, 2022 11:52 am

Re: Laser squad a.i.

Post by crabfists »

I've been disassembling Laser Squad recently with Spectrum Analyser. I'm still in the early days but I've already figured a few things out. Using the new Lua feature I've written a real-time map viewer that shows you the entire map while the game is running. It's quite cool because you can see the CPU controlled player moving around in the hidden movement phase. 8-)

I took a gif of me playing it here. Bit of a boring gameplay example though.

Image

The analysis files are here:

https://github.com/TheGoodDoktor/Spectr ... aser_squad
(This is my disassembly but not my repo. I'm not the author of the Spectrum Analyser tool. That's the TheGoodDoktor)

Let me know if anybody wants to muck around with it themselves and I can help you get it working.

I'll let you know if I figure out how the enemy AI works.
User avatar
lexi
Dizzy
Posts: 63
Joined: Mon Dec 04, 2023 10:55 pm
Contact:

Re: Laser squad a.i.

Post by lexi »

Arlorean wrote: Mon Oct 16, 2023 10:53 am Image

It is slow going but I'm trying to get a better understanding of how the chance to hit and damage mechanics worked. There are a lot of data tables for weapons, units and map elements that aren't formatted anywhere currently but I'll try to add a data dump tool to format these at some point. I've not looked into SkoolKit but the Spectrum Analyser tool says it does export to that format as well.
I saw this a little while ago - great work! I'm currently midway through merging two Chaos skoolkit disassemblies - I found your style very readable and it's influenced what i'm doing - thanks :)

I tried the skool file export on your SpectrumAnalyser progress - skool2* failed at a duplicate label, then at another error i didn't have enough time to debug. I'm guessing skoolfile support is still a work in progress, but it's really close and I'm and looking forward to cross-compatibility opening up yet more ways for people to understand, appreciate and tinker with old games.

crabfists wrote: Mon Jan 22, 2024 6:19 pm I've been disassembling Laser Squad recently with Spectrum Analyser. I'm still in the early days but I've already figured a few things out. Using the new Lua feature I've written a real-time map viewer that shows you the entire map while the game is running. It's quite cool because you can see the CPU controlled player moving around in the hidden movement phase. 8-)

I took a gif of me playing it here. Bit of a boring gameplay example though.

Image

The analysis files are here:

https://github.com/TheGoodDoktor/Spectr ... aser_squad
(This is my disassembly but not my repo. I'm not the author of the Spectrum Analyser tool. That's the TheGoodDoktor)

Let me know if anybody wants to muck around with it themselves and I can help you get it working.

I'll let you know if I figure out how the enemy AI works.
That looks so neat! I really love the ability to watch the hidden movement phases - SpectrumAnalyser looks to have so many powerful ways to explore and tweak the code - excited to see how that development progresses.

I still haven't had much time beyond merging to hunt down the things i'm curious about - and how much similarity/shared code exists between the Gollop games. Directions in Chaos are indexed q-w-e-d-c-x-z-a (FFFF,00FF,01FF,0100...etc) - if you see data strings like that about, then it may be using a similar mechanism for the pre-programmed paths.
Arlorean
Drutt
Posts: 3
Joined: Mon Oct 16, 2023 10:44 am

Re: Laser squad a.i.

Post by Arlorean »

lexi wrote: Thu Jan 25, 2024 10:07 pm
I saw this a little while ago - great work! I'm currently midway through merging two Chaos skoolkit disassemblies - I found your style very readable and it's influenced what i'm doing - thanks :)

I tried the skool file export on your SpectrumAnalyser progress - skool2* failed at a duplicate label, then at another error i didn't have enough time to debug. I'm guessing skoolfile support is still a work in progress, but it's really close and I'm and looking forward to cross-compatibility opening up yet more ways for people to understand, appreciate and tinker with old games.
Thanks for the feedback on that. It's the first time I've seriously disassembled anything to reverse engineer it. Some bits were easier than I thought, like screen and keyboard updates, but other bit were very obscure where flags were being written to random bytes in memory and I wasn't sure why.

I couldn't get it to generate the skoolfile either. It's a shame because I think it would be useful to format the data tables, map layout, and sprites, in a more readable way.

One great takeaway for me was the idea of moving a cursor around for the player and then using the same cursor movement for the AI. I used that approach on a game jam we just did and it was really easy to switch it from two player to one player with AI. We did the whole (dumb) AI code in less than 5 hours. Thanks Julian Gollop for teaching me how to program a Unity game in C# by reverse engineering your Z80 code from the 80's!
crabfists
Drutt
Posts: 29
Joined: Tue Sep 20, 2022 11:52 am

Re: Laser squad a.i.

Post by crabfists »

lexi wrote: Thu Jan 25, 2024 10:07 pm That looks so neat! I really love the ability to watch the hidden movement phases - SpectrumAnalyser looks to have so many powerful ways to explore and tweak the code - excited to see how that development progresses.

I still haven't had much time beyond merging to hunt down the things i'm curious about - and how much similarity/shared code exists between the Gollop games. Directions in Chaos are indexed q-w-e-d-c-x-z-a (FFFF,00FF,01FF,0100...etc) - if you see data strings like that about, then it may be using a similar mechanism for the pre-programmed paths.
Thanks! When I got the viewer working it was a nice surprise to see the AI players moving around. Made me wonder if they could see them moving in development?

Thanks for the tips on AI direction data. I'll keep an eye out for those.

I didn't realise the skool file exporter was broken. I thought it was working. If you could report the issue that would be amazing.
https://github.com/TheGoodDoktor/8BitAnalysers/issues

@lexi and @Arlorean You should come and join us on the Spectrum Analyser Discord server. There is a section where we can talk about Laser Squad. :geek:
https://discord.gg/VQ3m6W4ZRu
Wall_Axe
Manic Miner
Posts: 500
Joined: Mon Nov 13, 2017 11:13 pm

Re: Laser squad a.i.

Post by Wall_Axe »

How about the a.i. for Lords of chaos? (Just kidding guys)

It seems like advances are being made. Wouldn't mind knowing how the a.i. makes decisions. But I think the consensus was it was custom code per scenario and pretty dumb .
I.e. the dalek thing that you see down the corridor to the right when you first enter the house. That's probably just told to stand there and take shots at you down the long corridor.

But anyway, still would like to know what you guys uncover.
LevelUp
Drutt
Posts: 1
Joined: Tue Jan 30, 2024 8:54 pm

Re: Laser squad a.i.

Post by LevelUp »

Arlorean wrote: Mon Oct 16, 2023 10:53 am I made start on disassembling the original single player Rebelstar game using the Spectrum Analyser tool.

The current progress is in this GitHub repository:

https://github.com/Arlorean/Rebelstar

Image

It is slow going but I'm trying to get a better understanding of how the chance to hit and damage mechanics worked. There are a lot of data tables for weapons, units and map elements that aren't formatted anywhere currently but I'll try to add a data dump tool to format these at some point. I've not looked into SkoolKit but the Spectrum Analyser tool says it does export to that format as well.
This is something I've been meaning to do for some time. I'll get familiar with Spectrum Analyser then get stuck in and give you a hand. I might need to complete a couple of tutorials on how to use github as well.
marenja
Microbot
Posts: 108
Joined: Sun Dec 26, 2021 4:15 pm

Re: Laser squad a.i.

Post by marenja »

crabfists wrote: Mon Jan 22, 2024 6:19 pm (This is my disassembly but not my repo. I'm not the author of the Spectrum Analyser tool. That's the TheGoodDoktor)

Let me know if anybody wants to muck around with it themselves and I can help you get it working.
Please add skoolkit export to github repository. Native Spectrum Analyser file Analysis.json is totally human UNreadable. And it is not better case when I try to readd diff of Analysis.json commits. Totally unreadable.

Please mention which versions / releases you disassemble in github commits too. Or attach snapshot files if possible. There are at least 3 releases of Laser Squad in ZXDB now. They are surely slightly different. To feel a bit more fun... each Laser Squad scenario differs at addresses B621-FFFF because level data is loaded there. I gues your disassembly is scenario 1.

It is hard to guess sometimes what game exactly is disassembled (Batman). It may probably Batman 3D by Ocean or it may be Batman: The Caped Crusader or Batman: The Movie.
crabfists
Drutt
Posts: 29
Joined: Tue Sep 20, 2022 11:52 am

Re: Laser squad a.i.

Post by crabfists »

@marenja

Thanks for the feedback. I created a new repository with snapshots included. Let me know if it's not clear how to get it up and running.

https://github.com/Colourclash/LaserSquad

I will try to create a skool file if I get the chance.

Don't try to read the analysis.json file. It's not meant to be human readable.
marenja
Microbot
Posts: 108
Joined: Sun Dec 26, 2021 4:15 pm

Re: Laser squad a.i.

Post by marenja »

crabfists wrote: Wed Feb 14, 2024 6:52 pm I created a new repository with snapshots included. Let me know if it's not clear how to get it up and running.
Many thanks. I have now loaded your project and can see the disassembly.
marenja
Microbot
Posts: 108
Joined: Sun Dec 26, 2021 4:15 pm

Re: Laser squad a.i.

Post by marenja »

crabfists wrote: Wed Feb 14, 2024 6:52 pm I created a new repository with snapshots included. Let me know if it's not clear how to get it up and running.
I had a glance into project. It is already loadable and running but i have several problems with Spectrum Analyser.

I have no idea about the way to add multiline comments. I haven't found such option in the mouse popup menu or the program main menu. I can add only single line comments that are placed after asm instructions. But multiline comments are some other sort of object. They are placed from start of line and are edited in the editbox labeled as "comment text" - see lower red frame in the screenshot. I can change text after "comment text" was created.

Image

LUA scripts are inactive. There is no tab for "game viewers" at all. See upper red frame. I have already tried to drag-&-drop those files above emulator window but without any success. Do I need to install LUA separately from Spectrum Analyzer?

It does not save project sometimes. It is better to say saving project does not have any effect and reports no error. This dangerous situation gives you a habbit to save often, close the project and reopen it - at least not many changes will be lost.

The key B formats numbers in binary form %01010101 but it is a single direction result and there is no option to format back into the hex form.
Post Reply