English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 07 August 2017, 19:51   #1
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 359
Ms Pacman

I was surprised that there is no Ms Pacman port for the Amiga. (or that I totally missed it?)

And then, I started wondering, what it would need if you were to try to port it.

Levels (excluding, lines of text on top for score/hiscore and bottom number of lives and fruit level) are with width 224 and height 248.

Levels (excluding the ghosts' house door-line) are with three colors+black. Two colors for walls, one for dots/superdot and black. So, four in total. 2 bitplanes.

Game sprites are 16x16 which can comfortably be addressed with hardware sprites. 1 for MsPacman + 4 ghosts + 1 for ghost scores (200,400,800,1600) which stay for a little when you eat a ghost. Probably would be easier to have that line on ghost's house as a sprite as well. 6 so far. 1 more for the fruit. 7. Might need one for the fruit's score when you eat it. 8.

So all is plain and simple. Let's go to the hard parts now.

I'll start with the most difficult one. How to make ghosts behave _exactly_ like the original? I don't see any other way than studying the disassembly of the original. (z80) This is _very_ critical. Fans of the game wouldn't consider a game with altered behavior. It wouldn't be a port. Just some random pacman.

Problem number two. The original plays at 60Hz. Pal amigas are at 50Hz. I read that Ms Pacman moves a pixel every 1/60th of a sec. So, 60 pixels per second. Pal would give 50 pixels per second smoothly. (-16.67% speed) Not good. I guess one could have timer interrupts at 60Hz (or each 5 vblanks call update_game() two times) and the screen at 50Hz would have some hiccups on the smoothness of motion. Not good. Ntsc amigas would be ok, but then can you have 248 height even with overscan on Ntsc amiga? And what to do with Pal?

Problem number three. Aspect ratio. So, the levels are 224x248 and can be placed within 320x256 but the aspect ratio is horribly wrong. Feels like the level is wider than it is taller and should be the other way around. Could go for 640x256, but that would leave almost two thirds of the width unutilised for the level.


Thoughts?
alkis is offline  
AdSense AdSense  
Old 07 August 2017, 20:29   #2
Akira
Registered User

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 17,678
Yeah, without the game logic, the game is nothing. You'd need to reverse engineer it or be very good at replicating. This should be the #1 thing to get right . everything else is secondary.

As for 50/60 Hz, any Amiga with a Fat Agnus or above can do 50 and 60 Hz. Limiting the game to 60Hz is not a bad idea. Dynablaster does this.
Akira is offline  
Old 07 August 2017, 23:12   #3
demoniac
Registered User
 
Join Date: Jul 2005
Location: -
Posts: 1,268
This disassembly of Ms. Pac-Man has quite detailed comments:
http://umlautllama.com/projects/pacdocs/mspac/mspac.asm

I looked at the disassembled code for the Sega Genesis and that wasn't very helpful.

The task of creating an Amiga version would quite similar to what the original Ms. Pac-Man engineers did -- they reversed engineered Pac-Man to create this game.
demoniac is offline  
Old 07 August 2017, 23:18   #4
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 45
Posts: 1,884
I confirm that you have to get everything right or this won't feel right (speed, A.I.). Not only the graphics.

I love those projects. I remade "Bagman" (another Z80 game) by reverse engineering it. And the result is very satisfactory because the A.I and the speed of the characters match.

A shame no-one ever ported those gems at the time (Moon Patrol, PacMan, Galaga) because they would have been perfect on the miggy.
Publishers were interested in "newer" games, which were a lot more difficult to port right. Only a few were successful, the rest was ... US Gold
jotd is offline  
Old 08 August 2017, 00:30   #5
Old_Bob
BiO-sanitation Battalion

Old_Bob's Avatar
 
Join Date: Jun 2017
Location: Scotland
Posts: 24
Taking problems two and three first...

I don't think the difference between 50 and 60fps would be a big deal when the Amiga game is played in isolation. Someone can correct me if i'm wrong but I think i'm right in saying that most(?) Mega Drive and SNES games run at different speeds on PAL and NTSC. But if you've only played on one system and have never experienced the other, you're not missing anything.

If you're sticking to PAL and OCS, you could tune the speed of the enemies so they move slightly more than one pixel per frame using a fractional part added to their screen coordinate. That way they will move the same distance over a second, let's say, but then you impair the game's smoothness as every so often it will have to move something two pixels over one frame. Not a huge deal, but certainly noticable.

Taking a quick look in MAME, the game's play area is 224x248 which isn't so bad. I'd just move the score text to the side, instead of up top and bottom.

A bit like this...



Problem one, however, is something i'm a bit stuck on myself. At least as far as my own game programming effort is concerned...

Quote:
Originally Posted by jotd View Post
A shame no-one ever ported those gems at the time (Moon Patrol, PacMan, Galaga) because they would have been perfect on the miggy.
Very true. And, if I can ever get Bombjack finished, i'd like to have a crack at something like that.

B

Last edited by Old_Bob; 08 August 2017 at 12:06.
Old_Bob is offline  
Old 08 August 2017, 01:43   #6
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 34
Posts: 2,584
Quote:
Game sprites are 16x16 which can comfortably be addressed with hardware sprites. 1 for MsPacman + 4 ghosts + 1 for ghost scores (200,400,800,1600) which stay for a little when you eat a ghost. Probably would be easier to have that line on ghost's house as a sprite as well. 6 so far. 1 more for the fruit. 7. Might need one for the fruit's score when you eat it. 8.
This isn't the best way to handle it I think. Remember you have the same set of 4 colors for each pair of sprites (3+1).... each ghost in Ms Pacman has 3 colours (Main color, blue and white for eyes).. none of them match with the colors of Ms. Pacman. You could use one of the sprites channel with matching colors for fruits, but then some fruits have green on them and none of the ghosts have green.

Also, I see no reason to make that line in the "Ghost Castle" a sprite since it has the same priority as the dots. Also, sprite with sprite collision is kinda messy on amiga, each sprite channel make collisions shared, so if you check a colision against sprite 0 you are also checking against sprite 1, unless you do it "manually" (i.e. check by position instead of sprites overlapping).

I'd use sprites 0, 2, 4 and 6 for the ghosts... change their pallete when they are scared and it works pretty well. Ms Pacman, fruit and all dots (including blinking ones) are Bobs. You'd have at most 6 16x16 updating bobs on screen (with no need to redraw background except with the fruit since they are always black... this actually can make erasing the dots "automatic" since when you erase Ms.Pacman bob to redraw it at other place you also erase the dot underneath it). Using sprites just for the ghosts you can basically test sprite collision against unique Ms.Pacman color and it will be fair.

Yeah, you'd need 3 bitplanes for that but, honestly, you can even use 4 bitplanes to get all fruits color 100% accurate if you want it, add some color to the game and it still would be fine. Heck, you could even use dual-playfield and add some background to the game if you want it

And move the score/lives panel to the side would work wonderfully for the resolution problem, it's how it was done in most of the 8 bits conversions of Pacman / Ms.Pacman anyway It fits nicely.

EDIT: No need for extra sprite to show score when eating ghost either. The game freezes and both Ms. Pacman and the eaten ghost dissapear while the game is frozen and the score is only shown while the game is frozen. So you can either use the same sprite channel of the ghost or just blit the score at the screen and delete it when the game resumes.
Shatterhand is offline  
Old 08 August 2017, 09:10   #7
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 45
Posts: 1,884
About Pacman, check Pucman a nice shareware pacman clone for the miggy. Looks really neat

http://hol.abime.net/1174

@Old Bob I did the same "move the score trick" in my Bagman remake. And check Elite "effort" on Bombjack! what a waste...

Click image for larger version

Name:	bagman.png
Views:	57
Size:	6.4 KB
ID:	54080

I had it finished, but that was slightly easier to do: using C++ & SDL on a "modern" PC gives a perfect rendering. I tried to port it on amiga, and it was darn slow even on a 68060. Probably runs ok on Vampire but what a waste. Dropping SDL is then a big step ahead in trouble, doing it old-style in assembly with blitter (maybe now with modern gcc it would be fast enough to use C++ code).

I really wonder how hard it would be to drop SDL for hardware banging but keep C++ code with all the A.I. etc, and how fast it would be. Not a job for me as I don't know enough about blitter & sprites & audio on the miggy.

Those kind of projects are unlikely to be a one-man job. One has to resource/code the exact behaviour of the arcade game (Mrs Pacman uses random for Ghost moves, even in "chase" mode, Pacman doesn't, only uses random when ghosts are scared BTW), and one has to code using the most efficient method on the miggy.

I know about Codetapper trying to re-code Gyruss old-style for ages... Lots of projects, but very rare complete releases (maybe Rygar?).
jotd is offline  
Old 08 August 2017, 12:05   #8
Old_Bob
BiO-sanitation Battalion

Old_Bob's Avatar
 
Join Date: Jun 2017
Location: Scotland
Posts: 24
Quote:
Originally Posted by jotd View Post
@Old Bob I did the same "move the score trick" in my Bagman remake. And check Elite "effort" on Bombjack! what a waste...
Yep, the port that Elite released is nothing short of a disgrace. My own early efforts show that an A500 is easily capable of an almost perfect reproduction of the coin-op. As soon as I can figure out how to control that damned mechanical bird. Much like the Pacman ghosts, it's central to how the game plays but i'm damned if I know what that code looks like.

I'll get back to you on that...

Quote:
Originally Posted by jotd View Post
I had it finished, but that was slightly easier to do: using C++ & SDL on a "modern" PC gives a perfect rendering. I tried to port it on amiga, and it was darn slow even on a 68060. Probably runs ok on Vampire but what a waste. Dropping SDL is then a big step ahead in trouble, doing it old-style in assembly with blitter (maybe now with modern gcc it would be fast enough to use C++ code).

I really wonder how hard it would be to drop SDL for hardware banging but keep C++ code with all the A.I. etc, and how fast it would be. Not a job for me as I don't know enough about blitter & sprites & audio on the miggy.
Having a brief look in MAME, it seems like something that an A500 should be able to do without too much trouble. I've got no idea at all about this mysterious SDL, C++ business but a mixed code sort of thing where you could call asm routines controlling the blitter and stuff might be possible?

Quote:
Originally Posted by jotd View Post
Those kind of projects are unlikely to be a one-man job. One has to resource/code the exact behaviour of the arcade game (Mrs Pacman uses random for Ghost moves, even in "chase" mode, Pacman doesn't, only uses random when ghosts are scared BTW), and one has to code using the most efficient method on the miggy.
Indeed. As it quickly became apparent to me when hacking away at even a fairly simple game like Bombjack, beyond the merely mechanical aspects of getting the graphics engine going and stuff, there is a order of magnitude more work in doing everything else.

B
Old_Bob is offline  
Old 08 August 2017, 12:16   #9
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 45
Posts: 1,884
Sooo to sum it up: the status on your Bombjack clone is

running on A500 with correct framerate but
not able to figure out how enemies move. Right?

would reverse engineering the original Z80 game help?

Quote:
I've got no idea at all about this mysterious SDL, C++ business but a mixed code sort of thing where you could call asm routines controlling the blitter and stuff might be possible?
SDL is a system where you're drawing the whole screen, then it's refreshed. On a PC it's not an issue, but it's too much effort for an amiga. Most emulators are built by refreshing the whole screen, which is too slow for our beloved machine (I had written an emulator a long time ago, and it had to use "dirty" zones to only refresh what had changed, a bit of a nightmare...)

I wonder if it would be possible to reuse the existing C++ code, but use custom blitter code for displaying gfx & playing audio, so it would run on maybe not A500 but A1200.

For Bagman (note: exists on the miggy as "Bagitman" but with inferior C64-like graphics), that would mean not blitting the background everytime (using sprites for characters would be doable since they're small) and using the blitter only for objects.

Last edited by jotd; 08 August 2017 at 12:22.
jotd is offline  
Old 08 August 2017, 12:58   #10
Old_Bob
BiO-sanitation Battalion

Old_Bob's Avatar
 
Join Date: Jun 2017
Location: Scotland
Posts: 24
Quote:
Originally Posted by jotd View Post
Sooo to sum it up: the status on your Bombjack clone is

running on A500 with correct framerate but
not able to figure out how enemies move. Right?
Yep. I haven't intergrated the enemies in to the engine yet, but test programs reveal that 50fps should be easily attainable with everything going. The A500 blitter can cope with pretty much twice the amount of stuff that the coin-op has going at its busiest periods. Even using ZX Spectrum style, CPU based sprite routines would, I think, be fast enough.

Exactly why Elite's version runs like a lethargic snail, is a complete mystery to me. Except to point out that the ST version seems more or less identical, albeit quite a bit faster. I propose that we may simply put this down to the usual reason when it comes to this sort of thing...

I've uploaded my current WIP to The Zone.

Quote:
Originally Posted by jotd View Post
would reverse engineering the original Z80 game help?
Sure, that would be a huge help.

Quote:
Originally Posted by jotd View Post
SDL is a system where you're drawing the whole screen, then it's refreshed. On a PC it's not an issue, but it's too much effort for an amiga. Most emulators are built by refreshing the whole screen, which is too slow for our beloved machine (I had written an emulator a long time ago, and it had to use "dirty" zones to only refresh what had changed, a bit of a nightmare...)
This sounds incredibly wasteful. If you've got 4000mhz worth of CPU to throw at it, I guess it's no big deal, but a selective screen refresh and double buffer approach would be far more efficient. And, I guess, easily within the Amiga blitter's abilities.

Quote:
Originally Posted by jotd View Post
I wonder if it would be possible to reuse the existing C++ code, but use custom blitter code for displaying gfx & playing audio, so it would run on maybe not A500 but A1200.

For Bagman (note: exists on the miggy as "Bagitman" but with inferior C64-like graphics), that would mean not blitting the background everytime (using sprites for characters would be doable since they're small) and using the blitter only for objects.
As far as anything C, or C++ goes, i'm not the person to ask, sorry. But I guess it sounds reasonable? Anybody else with more knowledge than me care to comment?

B

Last edited by Old_Bob; 08 August 2017 at 16:36.
Old_Bob is offline  
Old 08 August 2017, 13:07   #11
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 627
@Old_Bob
In the Zone you can find arcade bomb jack disasm which I found somewhere on internet. I don't remember when I found it. Should be helpful.
Asman is offline  
Old 08 August 2017, 15:00   #12
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 45
Posts: 1,884
Asman, looks like a lot of work is already done. Very interesting.

Doesn't mean it's going to be easy to figure out how the bird moves.

Last edited by jotd; 08 August 2017 at 15:36.
jotd is offline  
Old 08 August 2017, 17:05   #13
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 359
I found this on youtube yesterday.

[ Show youtube player ]

Trully awfull ports.(with the exception of c64 and atari 7800 maybe)
I mean, cover your ears in AppleII's port.
alkis is offline  
Old 08 August 2017, 17:07   #14
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 359
Also, this looks very well documented
[z80 disassem]
https://github.com/BleuLlama/GameDoc...mble/mspac.asm
alkis is offline  
Old 08 August 2017, 17:17   #15
Old_Bob
BiO-sanitation Battalion

Old_Bob's Avatar
 
Join Date: Jun 2017
Location: Scotland
Posts: 24
Quote:
Originally Posted by Asman View Post
@Old_Bob
In the Zone you can find arcade bomb jack disasm which I found somewhere on internet. I don't remember when I found it. Should be helpful.
Thanks, dude.

Quote:
Originally Posted by jotd View Post
Doesn't mean it's going to be easy to figure out how the bird moves.
Agreed. Even with the work that's already been put in to the disassembly, it's still a huge task.

B

Last edited by Old_Bob; 08 August 2017 at 19:26.
Old_Bob is offline  
Old 08 August 2017, 17:23   #16
Old_Bob
BiO-sanitation Battalion

Old_Bob's Avatar
 
Join Date: Jun 2017
Location: Scotland
Posts: 24
Quote:
Originally Posted by alkis View Post
Also, this looks very well documented
[z80 disassem]
https://github.com/BleuLlama/GameDoc...mble/mspac.asm

Now, that's a bit more like it.

B
Old_Bob is offline  
Old 08 August 2017, 18:37   #17
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 359
https://github.com/BleuLlama/GameDoc...spac.asm#L8000

;; #2a23 random number generator, only active when ghosts are blue.
;; n=(n*5+1) && #1fff. n is used as an address to read a byte from a rom.
;; #4dc9, #4dca=n and a=rnd number. n is reset to 0 at #26a9 when you die,
;; start of first level, end of every level. Later a is anded with 3.

They REALLY didn't want anything portable
alkis is offline  
Old 10 August 2017, 02:39   #18
demoniac
Registered User
 
Join Date: Jul 2005
Location: -
Posts: 1,268
Quote:
Originally Posted by alkis View Post
Also, this looks very well documented
[z80 disassem]
https://github.com/BleuLlama/GameDoc...mble/mspac.asm
That looks like a newer version of the disassembly that I posted earlier.
demoniac is offline  
Old 10 August 2017, 08:09   #19
oRBIT
Zone Friend
 
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 42
Posts: 218
Code a Z80-emulator, that will take care of the logic. Rewrite graphics-related parts to be more Amiga-specific.
Probably easier said that coded.
oRBIT is offline  
Old 10 August 2017, 09:17   #20
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 45
Posts: 1,884
oRBIT: what I did to emulate Oric games was to disassemble 6502 code and transform it so it's legal C language (with macros for the opcodes). Then compile, debug, add real C wherever you need.

The same trick can apply to convert to 68000 asm of course. (for some parts it's even simpler)

Works very well. I have adapted 4 or 5 games like this (pure asm) for windows. But that's more emulator-like, and you still have graphical refresh issues.
jotd is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
PacMan'96 fc.studio request.Old Rare Games 12 13 November 2015 12:55
Deluxe Pacman anyone? Madcrow request.Old Rare Games 4 04 October 2011 15:44
A polish pacman Dizzy Nostalgia & memories 3 05 August 2008 01:55
Deluxe Pacman v1.7 Graham Humphrey request.Old Rare Games 13 29 February 2008 17:33
3D Pacman Thingie? blade002 Looking for a game name ? 7 21 March 2007 19:25

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:06.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.27364 seconds with 13 queries