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 2 of 8 | |||||
Author | Message | ||||
VK6MRG Guru Joined: 08/06/2011 Location: AustraliaPosts: 347 |
And at $3.35 delivered! WOW! Its easier to ask forgiveness than to seek permission! ............VK6MRG.............VK3MGR............ |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
Nick, Just to shut you up I'm writing the BMP read function for MM and DM BASIC which I'll submit to Geoff for inclusion (his choice of course!) as well. Cheers, iggy |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
That would be great. Not to give you extra work but it would be good if it had a couple of optional parameters to specify the position of the top left hand corner of the image. Something like: LOADBMP file [, xpos, ypos] Geoff Geoff Graham - http://geoffg.net |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Whoo Hoo! See, whine long enough and you get your way! Seriously, this will be a very useful function. Make it fast enough, we may even be able to play video... in glorious dithered black and white! |
||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
That looks fantastic Nick. Why not just read a normal joystick with the I/O port? Dave Everett |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
I plan to add joystick support at the end. Right now, I support a standard and most common MM configuration. Also, what constitutes a "normal" joystick? There hasn't been a joystick standard defined for the mm yet but it looks like we're heading for a modified Wii nunchuck. |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
Yep, I agree, good options. I'm a little distracted, listening to a man-hunt on the police radio. They have the escaped prisoner from Goulburn holed up in a forrest down south. Makes me miss "the job" |
||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
Also, what constitutes a "normal" joystick? There hasn't been a joystick standard defined for the mm yet but it looks like we're heading for a modified Wii nunchuck. I mean in terms of arcade games. Pacman was one of the simplest using a single 4 way digital stick. I could see a Maximite inside a box that has a 4-way stick and 2 buttons covering many of the early arcade games. Dave Everett |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
Nick, I have LOADBMP "filename.bmp" working in 2.7x, what version of BASIC are you using and on what hardware? If it is 3.x I will need permission from Geoff to send you a hex file to test once I import my code into his current source or he may choose to do that for you. It takes maybe 0.5 seconds to load a full screen BMP from my microsd card on a Duinomite-Mega. I will try it on my Maximite-Mini and see how it goes. Obviously will also try it in 3.1 when I copy the source in there tomorrow. Still need to implement a few extras like positioning, possible inversion etc. Cheers, iggy. |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Time I did another progress update on my Pacman. I now have all 4 ghost characters blindly roaming the maze. Graphics are smooth and speed is ok. I say ok because I have still to add the ghost intelligence and a few other housekeeping routines and I fear that these will drop the speed to below what I want. All my animations and character movements are pixel width. It looks smooth and professional. I am in the process of applying code optimizations to glean every cycle I can get. MMBASIC is fast but in the end, it still is an interpretive language and we pay a high speed penalty. In comparison, when I wrote Pacman in assembly language on my Tandy Colour Computer 3, an 8-bit 6809 running at just under 2Mhz, I had plenty of CPU speed to run the entire game at 60fps...in color, with a bit mapped display (no hardware sprites or sound chips). Still, MMBASIC is a lot faster that the BASIC on these old systems. I wouldn't come close in making a Pacman in BASIC on my Tandy. If anyone has suggestions, tricks or a magic potion for getting more speed from MMBASIC, I'm all ears. I have removed all line numbers and use labels. I have used multiple statement lines since this provides a slight speed boost (as outlined in another post). Below is the latest screenshot. Pacman eats the dots and ghosts navigate the maze superimposed over the dots like hardware sprites. It does look good if I may say so myself. But I need more speed to complete it. |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
Earth calling Nick, come in Nick? And the answer to my questions directly above you update are? |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
And the answer to my questions directly above you update are? Hmmm. The answer... or the box? Tough decision. Sorry about that. Sounds great! I'm running 3.1 and Pacman will certainly need 3.0 onwards to run. |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Speed problem fixed! I came to the conclusion that no matter what optimizations I did, MMBASIC just wasn't fast enough to move all objects at a single pixel resolution. I have modified the code to animate all objects at a resolution of 2 pixels. This has brought back the speed that I needed although object movement lacks the "glass smooth movement" I was getting before... still pretty good though. This mod required a change to the maze dimensions which wasn't too hard. Basically, edit the screen with a graphics editor on the PC and a few code tweaks and changes in the MMBASIC code. Mission accomplished with enough speed to implement the enemy intelligence next. The maze looks a bit narrower than previous but this is welcome, bringing the screen closer to the aspect of the original. |
||||
VK6MRG Guru Joined: 08/06/2011 Location: AustraliaPosts: 347 |
Nick, Fantastic work. I can't wait to give it a try Matthew Its easier to ask forgiveness than to seek permission! ............VK6MRG.............VK3MGR............ |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Been a bit busy lately and haven't done much to my Pacman so I thought I'll just type up a bit of an update on where it's at. First thing, a name change. I've renamed the game from Pacman to MaxMan. Code wise, I have the ghosts chasing you in a semi-intelligent fashion. Still some work to do here. Many instances where the ghosts don't make an obvious move, like if they are an inch away from you and they decide to take a turn at the next corridor, sending themselves away from you. The Power Pills are half operating. They flash and register when they are eaten but the code to put the ghosts into a "run-away" mode is yet to be done. All 4 ghosts "launch" from their Ghost pen in the centre of the maze and you can get "eaten" by them. Speedwise, it's good. It looks very much like the original game. The biggest challenge is finding free time to keep working on it but little by little, it gets done. It's all keyboard driven so far but eventually, I'll need to get me one of these Wii Nunchuck adapters. Can anyone tell me what the code would be to read the 4 directions from the Nunchuck. I can add the code in so it will have dual controllability. I haven't even looked at sound yet. I don't know what the speed penalty (if any) would be when that goes in. |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Got a bit more done today. I can now eat the ghosts! I've made a video and uploaded it to my ImageShack account. It's blurry and dark but you'll get an idea of how the game looks so far. Still a few things to go in before it's ready for prime time but getting closer. Here's the link to the video. Sorry about the quality. http://imageshack.us/clip/my-videos/543/9hq.mp4/ |
||||
Olimex Senior Member Joined: 02/10/2011 Location: BulgariaPosts: 226 |
looks very nice, good work! |
||||
cosmic frog Senior Member Joined: 09/02/2012 Location: United KingdomPosts: 284 |
Just watched your video and Wow this is really good work! very professional. I like the animation where the ghosts come out. Can't wait for the finished version, with sound I hope. Keep up the good work. Dave. |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Getting close now. Can play a complete game from start to finish. Still not happy with the ghost's intelligence and what is causing the biggest problem is that I have reached the speed capacity of MMBASIC where I feel the game starts to become slower than I would like. I have taken the scissors to the code and tried to cut out as much as possible to the main game loop part of the code. I have also found that the insertion of even a space in a line of code takes up cpu cycles as the BASIC interpreter has to skip the space in search of the next piece of code. As a result, REM lines are removed to avoid losing cycles as it skips the REM. Heavy use of multi statement lines provides a slight improvement and generally looking for every optimisation I can. Game speed is very important and so the coding has become a game in itself of sacrifices and optimizations. I have begun adding sound. Joystick control is last. I must find myself a Wii Nunchuck or do Darth's Atari Stick type mod. It seems the nunchuck is the most popular although adding support for both wouldn't be so hard. Until I get a joystick myself, what is the code to read up,down,left and right movement on these sticks? |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Hi Nick, Check this post for Nunchuck joystick control details: http://www.thebackshed.com/forum/forum_posts.asp?TID=4712&PN =1 You should be able to extract the essentials from there. Cheers. |
||||
Page 2 of 8 |
Print this page |