Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PACMAN for Maximite
Page 1 of 8 | |||||
Author | Message | ||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
In another subject thread, I asked about whether there was a standard for joystick control on the Maximite. The reason for this was regarding the problems with keyboard control when using INKEY$ in a real-time arcade game application. The problem arises due to the Maximite's use of a keyboard repeat delay and repeat rate. This gives an inconsistent reading if the game requires movement control as a key is being pressed. The key doesn't always deliver the key value, reseting to zero as it pulses to the repeat rate. I have begun writing a version of arcade PACMAN for the Maximite and this was a problem due to the nature of the 4-way keyboard controls in PACMAN. I therefore considered writing it for joystick but I knew it would alienate many users from being able to play the game. I gave it some more thought and have adapted the keyboard logic to compensate for this and succeeded. Below is an image of what I have done so far. The PACMAN character can navigate all around the maze and eat all the dots. The speed and animation (mouth chomping) is just like the original arcade game and the use of an interrupt holds the game at a consistent speed. The game is fast enough so that if I turn off the speed control, the PACMAN moves around the maze as a blur, indicating there is plenty of time left to add the 4 ghosts on the screen and keep a speed that is very close to the original and operating just as smoothly. This is a work-in-progress and I will keep this subject thread up-to-date with my progress. |
||||
Olimex Senior Member Joined: 02/10/2011 Location: BulgariaPosts: 226 |
oh well you did it before me, I started to write one but there are so much projects to do ... :) also started Minesweeper, Tetris, Sokoban but there are not finished too ... |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
You are going to beat me to it too, I stopped to write BASIC addons and have left my 70% done pacman lay dormant for weeks :-) This is an old screen shot, it's come a long way since and a ghost is slowly learning to chase me around with sound effects. |
||||
rhamer Senior Member Joined: 06/06/2011 Location: AustraliaPosts: 174 |
There is always Ms Pac Man PAC Man Jr Super PAC man PAC man plus Professor PAC man PAC & pal PAC land PAC mania PAC man VR And about 20 more. So plenty for everyone. Cheers Rohan Rohan Hamer HAMFIELD Software & Hardware Solutions Makers of the Maximite Expander. http://www.hamfield.com.au |
||||
Olimex Senior Member Joined: 02/10/2011 Location: BulgariaPosts: 226 |
hahaha at least there will be 3 different variants I made mines with loadable levels from the SD card, you can build the level in simple text file with the encoding the labyrinth and them bonus fruits 0 = food 1 = wall 2-5 bonus fruits to appear for limited time after the points are XXX so Iggy your labyrinth will be something like: 111111111111111111111111 100000000001000000000001 100000000000000000000001 100000011100011100000001 ........................ more lines 100000000000000000000001 111111111111111111111111 and once you complete your level it attempts to read pacmanN.lvl from the sd-card |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
Actually it looks likes this! Yes I intended to have different levels with the possibility of going to another screen when you exit left or right :-) Data 73,71,71,71,71,71,71,70,71,71,71,71,71,71,74 Data 72,81,83,81,81,81,81,77,81,81,81,81,83,81,72 Data 72,81,78,80,81,81,81,81,81,81,81,78,80,81,72 Data 72,81,81,81,81,73,80,84,78,74,81,81,81,81,72 Data 75,81,78,74,81,72,53,65,56,72,81,82,81,81,72 Data 52,81,81,72,81,76,71,71,71,75,81,81,82,81,72 Data 74,81,81,72,81,81,81,32,81,81,81,81,81,81,76 Data 72,81,73,69,71,71,71,71,71,71,71,74,81,81,52 Data 72,81,72,81,81,81,81,81,81,81,81,72,81,81,73 Data 72,81,77,81,82,81,82,81,82,81,81,77,81,83,72 Data 72,81,81,81,81,82,83,82,81,82,81,81,81,81,72 Data 72,81,81,81,81,81,81,81,81,81,81,81,81,81,72 Data 76,71,71,71,71,71,71,71,71,71,71,71,71,71,75] |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
I took an easy path to make the maze that also takes up less code...well, it would if MM-BASIC had a LOADBMP to supplement it's SAVEBMP command. I merely created the entire screen on my PC with a graphics editor and saved it as a BMP. This allows me to make the display as detailed as I want without the need for any code except a BMP loader subroutine. The tradeoff is that this loader, written in BASIC can take up to 30 seconds to load a screen. This has been improved by converting the BMP file to crackerjack's MPF format and the load time is now around 12 seconds. The wait can be annoying because it has to load the screen each time to start a new game. Along with the ease of changing the screen and the added detail that can be had, I chose this method with the hope that in a future revision of MM-BASIC, Geoff will see the benefit of a LOADBMP command and add it in. A single instruction to load up the game screen from SD will allow me to chop out 10+ lines of code (sorry crackerjack ) and remove the 12 second load time. I could later add a nice title page loaded the same way. For non-game applications, being able to simply LOADBMP a template for a data display again means no code whatsover to create nice professional and well presented screens. All your code requires is to write the data displays in spaces provided. All those in favour of a fast LOADBMP loader command for MM-BASIC, put up your hands! |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Hi Nick , Great ... a future best game ... hehehe Why don't you use Fonts instead of LoadBMP ? You can use my Animite software for convert pictures to fonts and then just use your pictures as a font , the limitation is that each char are 64 x 255 pixels max. I think it's not an issue , just use more than one character to rebuild your graphics Cheers. Darth. Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
I use the fonts for the "sprites". I liked loading of the whole page as a BMP because it was easier. I can simply make a change on the BMP image with my editor on a PC/MAC. I could with little effort add extra screens with more maze layouts. The game logic isn't tied to a specific maze as long as I create the new screens based on certain rules. I also load a MAP/DOT matrix data table directly off the screen after it loads. Again, no additional code. Not one data statement and the game setup is minimal. The biggest problem is finding free time to work on it. |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Nice work Nick. I'm glad the MPF format works for you, albeit not as fast as we would like. I'm all for improvements with purpose and in no way emotionally tied to the MPF code/idea so if Geoff gives us LOADBMP or similar in a future MMBasic version I could see many uses for it. Looking forward to your finished PacMax. Cheers. |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Hi just made a little test ... I can load and show a full screen in VGA resolution in 2.159 sec here is the code : Cls Timer = 0 Font Load "Darth.fnt" As #6 Font #6 Print @(0,0) Chr$(33) @(255,0) Chr$(34) Print @(0,63) Chr$(35) @(255,63) Chr$(36) Print @(0,126) Chr$(37) @(255,126) Chr$(38) Print @(0,189) Chr$(39) @(255,189) Chr$(40) Print @(0,252) Chr$(41) @(255,252) Chr$(42) Print @(0,315) Chr$(43) @(255,315) Chr$(44) Print @(0,378) Chr$(45) @(255,378) Chr$(46) a = Timer key: k$ = Inkey$ If k$ = "" Then GoTo key here is the source image and the font made with animite. 2012-01-31_064142_Darth.zip for see the time needed in millisecont just enter : print a Cheers. Darth. Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Very good! Just wondering, does loading large font files such as this eat up a lot of program memory space or is a seperate area allocated for fonts? |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
It uses memory from the General Memory pool When loaded into memory one pixel equals one bit of memory consumed. Geoff Geoff Graham - http://geoffg.net |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
So a full screen would take up around 25K of general RAM. I'll continue using the current method (MPF) and when the program is complete and there is RAM spare, I can convert to Darth's ingenious idea of using the fonts. Ideally, I'd still like to see a LOADBMP command. (hint hint) |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Today's update includes a few minor "cosmetic" changes to the graphics, mainly the title text. I have it now accurately keeping track and registering all 244 pellets being "eaten" (240 normal, 4 power pellets). The warp tubes at the left and right side of the game screen operate and the score indicator is functioning. I have set the pellets to only score 1 point so as to act as a pellet counter for testing purposes. Have been running around the maze checking the keyboard response and looking for bugs. So far, so good. Speed is good but will later provide speed enhancements by changing some of the goto's to labels. Just about ready for the next big challenge, the 4 ghosts!! |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Sound! It will need sound and a joystick capability a la Wii Nunchuck. But it's looking great so far. |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Yes, I agree. I'll leave those 2 things last and get the basics all in as best as I can. I'll need to make up a Nunchuck and get the audio connected to my MM. Just a survey... How many people here have a Nunchuck and Audio connected? |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
I do John |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
I have intentions for both. I ordered a couple of Nunchucks yesterday and then discovered that they won't ship for a week or so. Apparently they are celebrating a New Year in Hong Kong and they are all on holidays. |
||||
VK6MRG Guru Joined: 08/06/2011 Location: AustraliaPosts: 347 |
Hi Nick I use sound and if someone makes a plug and play adaptor for the Wii numb chuck I'll get one (or more) for sure. Well done to Darth for the Darth Vader pic! This is ALL awesome work! Its easier to ask forgiveness than to seek permission! ............VK6MRG.............VK3MGR............ |
||||
Page 1 of 8 |
Print this page |