-------------------------------------------------------------------------- NIM Metro's first two-player game! Written by Peter Deane (Inquestor BBS, NSW, Australia) --------------------------------------------------------------------------- Details ~~~~~~~ Version: 0.9 Released: 10 January 1991 Language: AmigaBASIC Compiler: ACBasic Compiler Options: A, N, R, T Stack required: 4,716 bytes Author ~~~~~~ Peter Francis Deane PO Box 228 Swansea NSW 2281 AUSTRALIA Fido 3:622/401 Sysop of Inquestor BBS - Caves Beach, NSW, Australia 011-61-49-72-1647 (from the United States) (049) 72-1647 (from within Australia) Available 24hrs, all speeds to ZyXEL 19200 Copyright Status ~~~~~~~~~~~~~~~~ This program is shareware. ALL rights are reserved by the author, except that permission is granted to transfer the program electronically, provided that no profit is made from such a transfer. If a profit IS made, then the proceeds must be sent to the author. Introduction ~~~~~~~~~~~~ NIM is a door file to run with the Metro BBS (by Percy L Broadnax). It is Metro's first two-player game, where users can sign up and compete with each other. I was thinking of releasing a crippled version, where players would be limited to two games, and there would be a lower limit on the number of games playable, but I decided against this. You have the FULL version, and so I'll leave it up to you to abide by the above copyright requirements. NIM took almost a week of full-time programming to get up and running. NIM is my fifth DOOR for the Metro BBS. Further work will be encouraged by shareware support from those who use it. Another advantage of registering, is then I'll actually listen to any suggestions you have for improving the program. Like the Metro BBS, registered users will be entitled to free updates for life. Owing to the extensive use of ANSI screens created in ANSIMaster, NIM is by far, Metro's best-looking door, especially when called by a user who has ANSI graphics and IBM graphics characters available. All users are catered for, however, and the user can select to receive the ANSI codes, IBM graphics, both or neither. Anyway, enough of the codswallop.. how do you get this thing to work? Archive Contents ~~~~~~~~~~~~~~~~ 'NIM_0-9.lha' should contain these files: GameImgs.lzh Archive of all the game images door1 The Door itself. You will need to rename this. NIM.about.0.0 The Intro Title NIM.about.0.1 " NIM.about.1.0 " NIM.about.1.1 " NIM.bas The full AmigaBASIC source NIM.bye.0.0 The closing message NIM.bye.0.1 " NIM.bye.1.0 " NIM.bye.1.1 " NIM.config Your config file. See later. * NIM.docs You're reading them. NIM.Errors Very important. List of errors. See later NIM.games File with all the game details * NIM.gen.bas BASIC program to clear the game file if ever needed * NIM.gen.bas.info Icon for the same NIM.inst.0.0.1 The first instructions screen NIM.inst.0.0.2 The second instructions screen NIM.inst.0.1.1 " NIM.inst.0.1.2 " NIM.inst.1.0.1 " NIM.inst.1.0.2 " NIM.inst.1.1.1 " NIM.inst.1.1.2 " NIM.lost.0.0 Screen printed should a player lose a game (?) NIM.lost.0.1 " NIM.lost.1.0 " NIM.lost.1.1 " NIM.menu.0.0 NIM's menu NIM.menu.0.1 " NIM.menu.1.0 " NIM.menu.1.1 " NIM.won.0.0 Screen printed when a player wins a game (!) NIM.won.0.1 " NIM.won.1.0 " NIM.won.1.1 " * = this is not a required file for NIM to run. Setup ~~~~~ If you've ever setup a door on Metro, I think you'll find it pretty easy: simply create a new directory in one of your DOORFILES directories called DOORx (where x is an unused door number), and re-name the file 'Door1' in the archive to 'DoorX'. Then you have to edit your BBSFILES/DoorCmdsX file so that a menu entry is created for the door. If this is unclear, consult the Metro docs themselves. The problem with NIM, is that it accesses nearly 100 files, so it's just a matter of being careful of where you put things. Within the DOORx directory in DOORFILES, create another directory called 'GameImgs'. (EG on my system it's BBS:DoorFiles1/Door1/GameImgs') in this directory, all the game images are stored. This was done to avoid severely cluttering the Door directory itself. The 'Readme' file in the archive 'GameImgs.lzh' has further details on this. So we have a directory structure like this: DOORFILESx/DoorX/ (Store all NIM files here) DOORFILESx/DoorX/GameImgs/ (Store all the Images files here) The idea is, you unarc 'GameImgs.lzh' into the GameImgs directory, and then put all the other files in the Door directory itself. Easy, really, but I'll confuse you and explain it further with an example. Here is the way it's setup on my system. If you have all these files, the program WILL work: (On my system it's door #1 in doorfiles1... yours will definitely be different) DOORFILES1/DOOR1/GameImgs/ NIM 1.0.0 NIM 1.0.1 NIM 1.1.0 NIM 1.1.1 NIM 10.0.0 NIM 10.0.1 NIM 10.1.0 NIM 10.1.1 NIM 11.0.0 NIM 11.0.1 NIM 11.1.0 NIM 11.1.1 NIM 12.0.0 NIM 12.0.1 NIM 12.1.0 NIM 12.1.1 NIM 13.0.0 NIM 13.0.1 NIM 13.1.0 NIM 13.1.1 NIM 14.0.0 NIM 14.0.1 NIM 14.1.0 NIM 14.1.1 NIM 15.0.0 NIM 15.0.1 NIM 15.1.0 NIM 15.1.1 NIM 16.0.0 NIM 16.0.1 NIM 16.1.0 NIM 16.1.1 NIM 17.0.0 NIM 17.0.1 NIM 17.1.0 NIM 17.1.1 NIM 2.0.0 NIM 2.0.1 NIM 2.1.0 NIM 2.1.1 NIM 3.0.0 NIM 3.0.1 NIM 3.1.0 NIM 3.1.1 NIM 4.0.0 NIM 4.0.1 NIM 4.1.0 NIM 4.1.1 NIM 5.0.0 NIM 5.0.1 NIM 5.1.0 NIM 5.1.1 NIM 6.0.0 NIM 6.0.1 NIM 6.1.0 NIM 6.1.1 NIM 7.0.0 NIM 7.0.1 NIM 7.1.0 NIM 7.1.1 NIM 8.0.0 NIM 8.0.1 NIM 8.1.0 NIM 8.1.1 NIM 9.0.0 NIM 9.0.1 NIM 9.1.0 NIM 9.1.1 DOORFILES1/DOOR1/ door1 NIM.about.0.0 NIM.about.0.1 NIM.about.1.0 NIM.about.1.1 NIM.bye.0.0 NIM.bye.0.1 NIM.bye.1.0 NIM.bye.1.1 NIM.config NIM.Errors NIM.games NIM.inst.0.0.1 NIM.inst.0.0.2 NIM.inst.0.1.1 NIM.inst.0.1.2 NIM.inst.1.0.1 NIM.inst.1.0.2 NIM.inst.1.1.1 NIM.inst.1.1.2 NIM.lost.0.0 NIM.lost.0.1 NIM.lost.1.0 NIM.lost.1.1 NIM.menu.0.0 NIM.menu.0.1 NIM.menu.1.0 NIM.menu.1.1 NIM.won.0.0 NIM.won.0.1 NIM.won.1.0 NIM.won.1.1 The format of the files that are printed out (eg 'NIM.bye.0.1') is simply to indicate whether the user gets ANSI, IBM Graphics Characters, neither, or both. eg 'NIM.Lost.1.1' means the player wants ANSI and IBM characters. A '1' indicates YES, and it's in the order ANSI.IBM. With 'NIM.menu.1.0' this file contains ANSI, but no high ASCII (IBM graphics) characters. 'NIM.about.0.1' has no ANSI but does have IBM graphics. No prizes for guessing what form 'NIM.bye.0.0' is in. The extra number for the 'NIM.inst.x.y.z' is for the first or second instructions screen. Anyway, you can read '.0.0' in any text reader at all, so have a look if you like. You can use Percy's FILEREAD program (released with v7.0 of Metro) to have a look at the ANSI screens. I'm sure you'll be quite pleased when you see what the users with ANSI will actually be seeing. Local, however, there is no ANSI emulation, and all you get are the escape codes. Generator Program ~~~~~~~~~~~~~~~~~ I have supplied a blank games file for you, so there is NO NEED to run the generator to get NIM running. If however, you should happen to lose your games file (accidentally, hard drive crash, severe program malfunction (shudder), power turned off or guru halfway through writing to this file, act of God, or similar disaster), or if you decide you're completely sick of all the games in progress and want to start again, then you can run the generator. Simply load up AmigaBASIC and run the program. When you run it, it will ask you two questions... the first is whether you actually want to run the generator, the second is where you want the file it creates put. Then it does its stuff (quite quickly) and produces a file called 'NIM.Games' which you can use to replace your old copy. I don't really ever imagine you'd have to use this, but you may as well have a copy of it just in case. Config File ~~~~~~~~~~~ Now, so you can set things in the program yourself, NIM has a three line config file that you can edit with a text editor. Let's look at the config file in detail: 10 ANYTHING 20 That's all there is to it. The first line is how many games each player can sign up for. Mine is set for 10, but it's too early yet to see how effective this value will be. NIM has an internal 99 game limit (no more than 99 games can be current), and if a player tries to start a game when 99 games are already active, he'll be prevented from doing so. By limiting each player to 10 games, 20 people (at a minimum) can all be playing NIM. If you have a LOT of users who are really active games players, you may like to restrict them further than 10. On the other hand, if you run a small BBS, make it 20, 30 or even 50. The second line is the maintenance password. This really doesn't matter, because you have to have level 9 to get into the maintenance section anyway! It just gives the hackers something to hack at... they can have unlimited attempts to get into the maintenance area, but even if they do manage to get the password right, and their level is less than 9 they get kicked out! I'd suggest you set it to something different to your sysop Metro Password, however, just in case it confirms to a user what your Metro password is. This way, even if they do hack into your account, they can delete all the users and all the files, but they won't be able to touch the NIM games! In the config, the password can be in upper or lower case, it doesn't really matter. The final line of the config is how many times a 'Won' game will be displayed for. When a game has been won, it will be displayed in the tatus option for a certain number of door entrances. (Every time the door is run, it will increment the display counter, and if greater than this value it will reset the game from 'WON' to 'Inactive'). So when Harry Bloggs beats Jeff Machinegun in game 17, then these details will be displayed for all to see, a certain number of times. This chews up a game slot, so if your users can't start any new games you can either lower this value, or login and enter and quit from NIM a dozen times. This will clear games. (The users can do this themselves, but probably won't - you'll see it in the log if they do!) Menu Options ~~~~~~~~~~~~ Right, so NIM is setup and running... how does it work? Firstly have a read of the Menu and the Instructions from within the door itself. Here are a few more notes on any little intricacies:

lay, oin, egin, nstructions, bout and uit are pretty obvious, so I won't mention them here. tatus goes through the games file and prints up relevant details on each active game. An active game is either waiting for someone to join up (only 1 player involved), in progress (meaning that it's waiting for one of the players to take their turn), or has been WON, in which case it will be displayed for a certain amount of times (see above). If YOU are looking at the overall status (very fast locally) what you should be looking for are the 'Last Move' dates. If a game has been waiting on a certain player for 6 weeks, then I'd say it's time to reset that game in maintenance (see later). our Status is the same as above, but only the games that YOU are involved in. iew a game prints up any game you like (as long as you know the game number - see the tatus to find out) as if you were about to play it. Thus it gives my GameImgs a bit more use than in the game itself. It's also handy to see how you're going if it's not your turn to play yet. hange your setup asks you the same questions that you were asked on entry, that is, do you want ANSI and do you want IBM graphics characters. Locally, you WON'T want ANSI, the BASIC screen will simply display all the escape codes and distort the display somewhat. Remote it will look VERY good (I hope - still waiting to have a look at this one using a good ansi terminal). If you are still using the Topaz font, you also won't want IBM graphics characters. But gee, are there any Metro sysops who do use Topaz anywhere? If you are such a person, go and change your startup-sequence immediately and use FF (from Workbench 1.3) to globally replace Topaz with the IBM font. The command is 'FF >NIL: IBM.font" (Of course you must have the IBM font in your fonts: directory firstly). The '>NIL:' bit is optional. You could use 'FF IBM.font' as well, if you like. Ever since v7.0 of Metro came out I've been running the IBM font instead of Topaz. I can tell you, it's a big improvement!! Much more readable. When you use FF to change the fonts, IBM font 'becomes' topaz to the amiga. All your applications, wordprocessors, databases, Metro, Metro doors - the works - will all look heaps better. And you'll be able to see all the IBM graphics characters that this door uses from within a BASIC program! The way the screen clearing works will speedup too... there are two methods I use. If you don't want ANSI or the IBM font, a screen is cleared by printing up 24 blank lines. By answering 'yes' to just one of those questions the screen will clear with a crtl-L (remote) and a CLS function locally. This latter method is HEAPS faster. aintenance is the section you should be interested in. It merely allows you to delete any game and reset all the good bits back to zero. From the tatus option you can keep an eye on the games, and note if any player has obviously signed up for a game never to return. Jot the game numbers down on one of those scraps of paper idling around near the computer and enter maintenance. You will need to know the maintenance password (read NIM.config if you forget) AND have level 9 security to get into this section. It's pretty simple: you type in the number of the game you wish to delete, and the program will tell you who's playing and the date of the last move. It will not check the game, so it's possible to reset inactive games (not that this makes much difference!! Maintenance converts them to inactive ANYWAY!!!). You have to be able to delete any sort of game (1 player, active, displaying, etc) so there's no point testing them! If a game is inactive I think the date of the last go will read 'Never', anyway, so it's going to be easy to see. The program then asks you whether you're sure you want to re-set the game. Tell it you are. (HotKeyed) Then (just to make sure) it asks you again! If you decide after humble consideration of the matter that you do wish to proceed, then that game will be erased forever from the NIM records, and it will provide a free slot for new games to start in. It will also release players from any games they may be involved in, but can't play (because their opponent has left the country, become bankrupt and no longer owns a computer, etc, etc). Errors ~~~~~~ It is absolutely CRITICAL you have a file called 'NIM.errors' in the directory, otherwise if an error in the program does occur (thus the error checking is suspended) NIM will hang, and put your BBS offline. It doesn't matter what the file 'NIM.errors' looks like, as long as it actually exists, so NIM can append its error messages to it. The way it works now, NIM checks for two sorts of error: FileNotFound and all the others. I couldn't work out what sort of other error WOULD occur, but anyway, if one does occur, the program will record the error in this error file for you (along with the line number and time and date it occured) and abort the program. The users will simply be told that this has happened. If any of these other errors should occur, I want to know about them. Let me know exactly what the entry says, and I'll investigate the matter and remove the bug. I don't think you'll get any of these. In any case, you can look the errors up in your AmigaBASIC manual and poke fun at how badly I've goofed! If a file NIM needs to access is not in the right directory, or has been misnamed or whatever, NIM will write to the errors file the time and date of the event, and also the EXACT NAME OF THE FILE THAT NIM WAS TRYING TO ACCESS. You should then check this errors file to find out the filename, and then scan your drive to see where you've hidden it. The files can only be in two places... the door directory, or in the GameImgs directory inside the door directory. There should be 68 files in GameImgs. Make sure they are there. Anyway, if you have the directory setup correctly, this second error will not occur, either. If any error does occur however (apart from not having a 'NIM.errors' in the door directory) NIM will never hang the system. It will at worst, simply quit the user back to the BBS. Brief Miscellaneous Notes ~~~~~~~~~~~~~~~~~~~~~~~~~ The program allows for user numbers between 1 and 9,999. (I was nearly going to make it 999, but I know Percy is nearly up to 1000 users now. If you have more than 10,000 users on your BBS, users who play NIM will only have the leftmost 4 digits taken into account.. EG user number 12,345 will look exactly the same to NIM as user # 1234. Of course, the chances of the same player playing each others games with this many users is downright minimal. Anyway, if you do have more than 10,000 users on your system I'll do you a custom version of NIM. Better add a few more games than 99 in the process, too! :-) When playing NIM and coming down to the wire, remember the object of the game is to *NOT* take the last piece. So, if a user has 2 objects left, and removes 3, I don't go telling him: "Hey, there's only 2 pieces left." I interpret this as him taking the LAST remaining piece and thus LOSING the game. (He'd lose of he also removed 2 objects!) Also, the game never goes to its logical conclusion of the loser having to remove the last piece. The game is won when there is only 1 piece remaining. (Otherwise the potential loser would simply never play that particular game again and forever postpone the inevitable). In fact, despite me having made up images for 1 piece left, from the looks of the program, they'll NEVER be displayed. Ah well! Ravings ~~~~~~~ Well, that's just about it, I'd say. I shouldn't go on further, as I'm going to be uploading this to USA, and the longer the more expensive! I was extremely pleased at how well LHARC crunched all the images files, menus, etc. I was almost going to send this over on disk, but it won't be too long an upload as it is. I double-arced 'GameImgs' not for the saving in size, but to make sure you unarc it into its own directory within the door directory. All the other files can go in the door directory itself if you like. I only wish I could call my system now and see what NIM looks like in ANSI... the ansi files were all done with a program called 'ANSI Master' which is on Fish Disk # 378. I suggest you get this one. It's written in Hi-Soft Basic (sound familiar, no?) and is good for doing the IBM graphics characters. DIED V2.4 is still very good, and has more options, but no way of accessing the high ASCII, except by trial and error through the Alt-keys. AnsiMaster has a set of gadgets you can click on. Be warned, however, ANSImaster saves your files with CR+LF, so you need to strip out the Ctrl-Ms with something like Repstring for them to be true amiga files (with just the linefeeds). I also touched the files up with Cygnus Ed Pro as well as stripping the ctrl-Ms from them. BTW Cygnus Ed Pro EATS any other editor you care to name. It's brilliant, and SO FAST!!!!! A lot of the time I do the BASIC code in Cygnus and then load it into BASIC for the odd touch up. It took me about a week to write this program, and I kept on getting distracted during its development (things like work, etc). It took as long to do all the graphics files as the actual coding. It was mainly written as a learning experiment in handling multi-player operations and BASIC random files... see, I've only been programming for less than 2 months. Eventually I hope to get 'Global Wars' ported to the Metro BBS, but I may end up buying GFA BASIC first and try out Percy's new ANSI door-routines. With this game, the file operations slowed me down. With Global, I hope the file operations are now all there, and the actual GAME coding will slow me down. Anyway, Metro now has another door, and you'll all have to think about putting TWO door directories online now, if you haven't already done so. Finally, may I severely apologise for the room this door will take up on your hard drive. It worked out at over 1/4 meg on mine. Hopefully no re-partitioning will be called for to let it fit! See, when a file is stored on the Amiga, it always takes up a multiple of the block size. If you have a hard drive formatted under the FFS, the block size will be 512 bytes. So, if a file is 1023 bytes it will take up 1024 bytes of drivespace. If you have a file that's 1025 bytes long, that will take up 1566 bytes on the drive. :-( -Peter!