Jump to content

Photo

New Game - Stratego

Stratego TI 99/4A Extended Basic

42 replies to this topic

#1 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Thu Feb 7, 2019 9:43 PM

Here's an Extended Basic version of the classic board game Stratego where your opponent is the computer. The theme is the battle of Waterloo pitting Napoleon Bonaparte (you, with the blue units), Emperor of France, against the coalition forces led by the Duke of Wellington (the computer, with the red units).

While the AI will put up a stiff defense, its success, or yours, will depend heavily on the initial setup of the forces on the field. The computer will vary its setup from game to game in order to avoid predictability. 

Designing the AI was pretty challenging because this is a game of incomplete information, and actually zero information at the start, and so the usual tree searches fail spectacularly. It turns out that programming common sense and strategic acumen is ridiculously difficult, particularly when memory is limited. There is definitely room for improvement, but with under 30 bytes of RAM left I had to make some tough choices, although I think the overall AI strength is pretty decent. At the very least it will not make idiotic mistakes :)

Being an XB game fitted into 2 separate but linked programs, one for the initial setup and another for the main gameplay, it is pretty slow, so joystick jockeys need not apply. Average response time during the early and late game is about 55 seconds but can take several minutes during the middle game, and a complete game can easily take a couple of hours.

 

Attached File  Stratego Splash.gif   80.95KB   2 downloads

Splash screen

 

Attached File  Setup.gif   43.69KB   0 downloads

Setting up the forces

 

Attached File  Prepare for battle.gif   40.45KB   0 downloads

Ready for battle!

 

Attached File  Attacker wins.gif   42.44KB   0 downloads

Combat resolution

 

Attached File  Issue orders Emperor.gif   42.42KB   1 downloads

 

Attached File  Wellington issuing orders.gif   43.01KB   0 downloads

Napoleon ravaging Wellington's deep lines

 

Attached File  Wellington leading counter attack.gif   42.23KB   0 downloads

Wellington attempting a desperate right flank counter-attack

 

Attached File  I know where the flag is.gif   42.23KB   0 downloads

Can you guess where the flag is?

 

Attached File  Napoleon wins.gif   44.17KB   0 downloads

Napoleon wins the day!

 

Enjoy!

 

Here's the disk label courtesy of Omega. I do plan on creating a printed manual and disk package in very limited quantities hopefully in the next month or so.

 

Attached File  Stratego disk label.png   1.43MB   0 downloads

 

** Last update 2/23/19 **

Attached Files



#2 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,679 posts
  • Location:Hustisford, WI

Posted Thu Feb 7, 2019 10:32 PM

Holy cow!!!! One of my favorite board games from childhood!!!!

Can't wait to try this one out! :)


Thanks Vorticon! :D

#3 Iwantgames:) OFFLINE  

Iwantgames:)

    River Patroller

  • 2,457 posts

Posted Fri Feb 8, 2019 6:23 AM

Nice! I'll try this out soon

#4 twoodland OFFLINE  

twoodland

    Chopper Commander

  • 214 posts
  • Location:Delaware, OH

Posted Fri Feb 8, 2019 7:12 AM

I love Stratego!!  This is awesome!  Thank you so much!!



#5 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Fri Feb 8, 2019 7:31 AM

Just one bit of warning for those of you trying it out: it takes several minutes to load after the setup is done (when it says Preparing for Battle). This is because it is saving the setup data to disk, loading the main program which is very large, then loading the setup data from disk again. Could not be helped as there was no way to have the game all fit into a single program...

Also, the sounds in emulation are not great, and I would recommend playing on real hardware for the best experience. While you could use Overdrive mode in Classic 99 which speeds things up considerably, it also makes the controls very touchy and the sounds are further distorted.



#6 OLD CS1 OFFLINE  

OLD CS1

    >OLD CS1█

  • 6,027 posts
  • Technology Samurai
  • Location:Tallahassee, FL

Posted Fri Feb 8, 2019 7:50 AM

The sounds might be better in MAME.  Since my last upgrade broke it, I have not been bothered to work it back up (though I should.)


  • RXB likes this

#7 eebuckeye OFFLINE  

eebuckeye

    Stargunner

  • 1,264 posts

Posted Fri Feb 8, 2019 8:16 AM

That is awesome!! Thanks!



#8 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,679 posts
  • Location:Hustisford, WI

Posted Fri Feb 8, 2019 9:23 AM

Walid, please put me on the list for a full package. I need me some of that in my life. :D

#9 videofx OFFLINE  

videofx

    Moonsweeper

  • 255 posts

Posted Fri Feb 8, 2019 10:56 AM

Wow, what a coincidence! I was just playin this on my Power Mac. Now I will have to play on my TI99! :)



#10 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Fri Feb 8, 2019 11:23 AM

Wow, what a coincidence! I was just playin this on my Power Mac. Now I will have to play on my TI99! :)

 

Let me know how the AI compares!



#11 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Fri Feb 8, 2019 11:24 AM

Walid, please put me on the list for a full package. I need me some of that in my life. :D

 

For our 2 dedicated junior TIer's, Buck and Cesar, each will get a complimentary copy :)



#12 videofx OFFLINE  

videofx

    Moonsweeper

  • 255 posts

Posted Fri Feb 8, 2019 11:25 AM

 

Let me know how the AI compares!

 

 

Sure I wish we could do computer against computer and see how the AI faires



#13 OLD CS1 OFFLINE  

OLD CS1

    >OLD CS1█

  • 6,027 posts
  • Technology Samurai
  • Location:Tallahassee, FL

Posted Fri Feb 8, 2019 12:11 PM

 

 

Sure I wish we could do computer against computer and see how the AI faires

 

You kind-of could, via a wet-ware interface device between the two computers.



#14 arcadeshopper ONLINE  

arcadeshopper

    River Patroller

  • 4,286 posts
  • Location:Portland, Oregon USA

Posted Fri Feb 8, 2019 1:36 PM

very nice! with tipi you could do multiuser :) 

 

If you would like to sell through my store lmk. otherwise I will just buy a few copies and stock them..

 

Greg



#15 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Fri Feb 8, 2019 2:43 PM

very nice! with tipi you could do multiuser :) 
 
If you would like to sell through my store lmk. otherwise I will just buy a few copies and stock them..
 
Greg


Greg, I don't plan on selling the packages, but you are welcome to create and sell them on your site if you would like and keep the profits. My way to support your store :). I am only going to make a few copies which will go to the handful of contributors to the game as well as Buck and Cesar. I will also keep a copy to use as a door prize for the next Chicago Faire companion Friday event.

#16 InfernalKeith OFFLINE  

InfernalKeith

    Dragonstomper

  • 722 posts
  • Location:Toledo, OH

Posted Sat Feb 9, 2019 1:17 AM

I can't wait to play this!  I actually thought of Stratego as a programming project once and immediately dismissed it for AI reasons.  I'm excited to see how you've done it.



#17 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Sat Feb 9, 2019 7:36 AM

The AI concept is pretty simple here and mainly consists of many simple heuristic rules each covering a specific situation. For example, one rule would state "don't attack a known enemy piece of higher value". I attach a score to each rule, and rules override each other depending on the score while others have a special urgent trigger which calls for immediate action regardless of the score. You will recognize those when the response time is much shorter than usual. The main challenge encountered while working on the AI is how to balance the score assignments, and I think I have easily played several dozen games, each time taking careful notes of the computer responses, then going back and tweaking the scores. Frequently one change would break some other rule somewhere, leading to more debugging  :P   The program cycles through all the computer pieces, and subsequently picks randomly from a set of the 5 top scores. If several top scores are equal, the first 4 choices are the same but the 5th is the next best one, which helps reduce repetition, therefore it's not always obvious what the computer will do at any one point, particularly in the end game..

All the computer units have a general "drive" and a few have more specialized ones. The main difficulty with Stratego is how to deal with unknown enemy units. Humans have a poorly defined intuition on what might constitute a good move strategically and trying to program that into the computer was impossible within the confines of the memory available, but on the other hand the computer has perfect memory and will track an uncovered enemy unit without fail as well as those which have moved, helping reduce uncertainty somewhat. If I had more memory, I could have created a probabilistic map of the entire field to help guide strategy...

Overall, however, it's interesting to see how a set of simple rules can generate complexity, and frequently the computer would surprise me with its decision. 

I would very much welcome feedback on the AI strength for my own edification and for application to future games :)


Edited by Vorticon, Sat Feb 9, 2019 7:44 AM.


#18 RXB OFFLINE  

RXB

    River Patroller

  • 3,550 posts
  • Location:Vancouver, Washington, USA

Posted Sat Feb 9, 2019 9:27 AM

If memory is the issue you should make a SAMS version!

 

That would solve most of the issues.

 

A RXB version would put all the Assembly & Data  into SAMS 4K pages.

 

As these are Program Image loaded would speed up loading and set up.


Edited by RXB, Sat Feb 9, 2019 9:36 AM.


#19 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Sun Feb 17, 2019 7:42 AM

I did some minor finetuning of the AI which improves play in some selected circumstances. The disk image in the first post has been updated. There is so much more I would have liked to enhance, but I only have 14 bytes left... Regarding using RXB, the SAMS card wouldn't help here because all the data is already off-loaded to disk. I really need something like 64K of RAM :)

On a side note, there is a possibility that the program could be made to compile with Senior Falcon's XB compiler. The main hitch is the fact that I make heavy use of the SUB facility in XB with array argument passing, something the compiler does not currently support, but Harry is optimistic there might be a way to fix that. Stay tuned!



#20 senior_falcon ONLINE  

senior_falcon

    Stargunner

  • 1,420 posts
  • Location:Lansing, NY, USA

Posted Sun Feb 17, 2019 8:12 AM

For what it's worth, it is possible to use all 32K for an XB program. You put lines of XB code into low memory, probably with an assembly sub. Then the main program is loaded into high memory. Then the line numbers from the low memory code have to be added to the line number table in high memory. Once the program is set up this way, XB doesn't care that the actual code is in low memory as long as the line number table is where it expects. One shortcoming is that editing the program would not be as simple as it is normally in XB. Also, the program would have to be saved in 2 segments, one for low memory and one for high memory.

 

Edit:

Try this: CALL INIT::CALL LOAD(-31952,63,255,63,255,"",-31868,63,255,63,255)

Now when you load an XB program it will be loaded into low memory. You can verify this with Classic99's debugger.


Edited by senior_falcon, Sun Feb 17, 2019 8:43 AM.


#21 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Sun Feb 17, 2019 10:57 AM

So in the case of Stratego, the main game program is chain-run after the setup program is done. If the main program is in 2 segments, how would I go about loading it from the setup program?

Also, would you mind posting the actual assembly code for the CALL LOAD statement so I can better understand how you do this?



#22 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,947 posts
  • Location:Silver Run, Maryland

Posted Sun Feb 17, 2019 11:14 AM

Walid, I may try to convert Stratego to Forth.  Do you think it too much work?

 

...lee



#23 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,619 posts
  • Location:Eagan, MN, USA

Posted Sun Feb 17, 2019 12:09 PM

Walid, I may try to convert Stratego to Forth.  Do you think it too much work?

 

...lee

 

The main difficulty is going to be the subroutines conversion. Also, it's quite a long program. Happy to assist you in this endeavor if you are up to it. It would make a great show and tell at the next Chicago Faire companion event!

I am attaching the source code in TIdBiT format which should make things much more readable. 

Attached Files



#24 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,947 posts
  • Location:Silver Run, Maryland

Posted Sun Feb 17, 2019 12:32 PM

That is all the encouragement I need.  :)



#25 atrax27407 OFFLINE  

atrax27407

    Stargunner

  • 1,237 posts

Posted Sun Feb 17, 2019 1:03 PM

I'm waiting, Lee - it has been almost half an hour and you aren't done yet?  ;)


Edited by atrax27407, Sun Feb 17, 2019 1:04 PM.






Also tagged with one or more of these keywords: Stratego, TI 99/4A, Extended Basic

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users