Sunday, 17 January 2016

January 2016 Retrochallenge 7: Ministry and Mini Pac-Man Revised

Ministry

I ported the simple empire simulation game "Ministry" from C to Micro Color Basic back in mid November. Now I have made the few minor edits needed to make it work on Color Basic for the Colour Computer and Dragon.

The source code came via Rudi Horne's "Let's Compile" Youtube channel: https://youtu.be/Fw1H0wGP6fk.Thanks to Rudi and the original programmer, Wesley May, for the inspiration!  Here's were you can find the source:
https://github.com/jggames/trs80mc10/tree/master/quicktype/Simulations/Ministry

The original code wasn't very hard to translate to Basic. Not too much in the way of distinctive C programming techniques were present and only the simplest of commands were used. I wouldn't be surprised if the program was originally Basic and then translated to C. My other hypothesis is that it was some kind of educational assignment. In any case it is quite complex in its game play and options despite its relative simplicity as a program. It provides a simple example of a "God Game" for the MC-10 (and now the Coco and Dragon) in Basic. You don't play to "Win" because as far as I can tell, there are no "winning" conditions or a win routine. Instead, you play to achieve the highest amounts of wealth, land and scientific achievement for your society as possible.

Back when I was first playing such "type-in" style games I could imagine playing a game like this for a score to compare with a friend's achievement. However, I think the game could actually be easily modified to allow two players to play against each other or to add some kind of arbitrarily determined set of winning conditions. I would also like to add some kind of map function to visually represent the territorial expansion of your "empire." I take it that the title represents the player's ability to manipulate "with God like power" all the major "ministries" of government, which makes me suspect that Wesley may is a Brit, or from somewhere else that uses a Westminster system.  Here's a video to give you a sample of the game play:


If anyone plays the game please let me know if you run across any errors, bugs or suggestions. I try to play it enough to make sure there aren't any obvious programming errors, but you just never know.

For instances, I realized that there were several places where I added some INT functions to clean up the display of numbers in the MC-10 version right near the end of my editing back in November (last minute changes), which ended up making 2 lines (2040, 2301) too long for the 128 character limit of the MC-10. When you "quick type" the program into the Emulator, which just takes a text file and dumps it into the MC-10 as if you are typing it at the keyboard, these lines just get chopped. By revisiting the project to port the program to Coco and Dragon, I had one more opportunity to find such snags.

Since it didn't take too much effort to fix Ministry I turned my attention to the Mini Pac-Man program I discussed a few postings back. There were a few things niggling at me about the game. One was that it had an an extra Sound statement in the original source code, which really slowed the game down. It sounded for each move you made even when you were not eating dots. It was noisy and slow and I couldn't hear it in the video of the original Atari version, so I took it out. I also didn't like the reverse video greater-than symbol for Pac-Man. I thought some simple changes would allow me to use either a normal less or greater-than symbol combined with a "=" sign to simulate mouth movement. I also wanted to add variable scoring for the different levels (higher scoring for higher levels) and a visual image of whichever character (Pac-Man or the Ghost) that is left standing on the field at the end of the game. Finally I wanted to add the Quick Keys pokes for the Dragon version, which are really necessary to make the game playable on keyboard of that system. Anyway, here's a video of most of the changes:


Since the video I also added a slightly more satisfying sound and representation (via some additional Pokes) of the player or ghost eating the the other at the end. Here's the source code of the Dragon version with the Quick Keys pokes in line 0:
0 REM FOR DRAGON->IFPEEK(269)+PEEK(270)<>1THENPOKE65283,52:POKE256,116:POKE257,1:POKE258,81:POKE259,126:POKE260,PEEK(269):POKE261,PEEK(270):POKE269,1:POKE270,0:POKE65283,53
1 POKE65495,0:INPUT"LEVEL (1-9)";E:CLS0:M=1024:FORY=0TO9:FORX=0TO9:POKEM+X+Y*32,46:NEXT:NEXT:DIMF(255):F(0)=60:F(8)=62:F(94)=62:F(9)=60:F(10)=60:X=0:Y=0:A=9:B=9:W(0)=98:W$(1)="YOU WIN!!"
2 P=M+X+Y*32:G=M+A+B*32:C=PEEK(P):D=PEEK(G):POKEP,F(S):POKEG,98:S=0:IF(PEEK(344)ANDPEEK(343)ANDPEEK(342)ANDPEEK(341))<>255THENS=PEEK(135)
3 Q=(S=8ANDX>0):Q=Q-(S=9ANDX<9):R=(S=94ANDY>0):R=R-(S=10ANDY<9):X=X+Q:Y=Y+R:IFC=46THENPOKEP,61:SOUND99,1:C=32:T=T+E:PRINT@11,T;
4 P=M+X-Q+(Y-R)*32:G=M+A+B*32:POKEP,C:POKEG,D:IFRND(11)<=E THENA=A-(X>A)+(X<A):B=B-(B<Y)+(B>Y)
5 ON-((X=A)+(Y=B)<>-2)GOTO2:W(1)=F(S):C=-(T=(E*100)):P=M+X+Y*32:POKEP,61:SOUND99,1:POKEP,W(C):PRINT@353,"gAmE oVeR";:PRINT@385,W$(C);:PRINT@416,;:RUN1

1 comment:

  1. Thank you. And I have fixed the broken link to the original source code of Ministry in the above.

    ReplyDelete