Pacman Problem

Discussion in 'Programmer's Corner' started by Art, Jan 31, 2008.

  1. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi Guys,
    I've been writing my own Pacman from scratch,
    without having ever looked at any Pacman code I'm doing well.
    I am studying the game as the end user who never really played it much.

    Does anyone know when fruit is offered? Is it offered every level?
    I think some event in the game triggers it, and have found with a bit of MAMEing
    that they seem to arrive after the first energiser is eaten (but I don't know if that's a rule).

    Any Pac-wisdom would be appreciated from a player or programmer.
    Cheers, Art.
     
  2. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Wow, what a great project - I love Pacman and still play it now!

    The fruit is offered twice per level and is positioned near the centre of the maze, which is considered the most risky area, as a goad to pacman. The value of the fruit increases with every level and IIRC there are 7 different fruits available.

    Don't forget to programme the Pacman Killscreen on level 256! (ref. http://content.answers.com/main/content/wp/en/f/f0/Split_Screen_in_Pac_Man.gif)

    What are you writing your game in? (language, Dev EnV)?

    Dave
     
  3. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi Dave,
    Yes I read about the split screen in Wickopedia while searching for the fruit problem.
    You could do a fake one, but the real one, being the result of a bug, would be hard
    to emulate exactly without the original source.

    The one I'm doing is in C, and is a bit of a joke really.. you'll understand when I've upped the YouTube video.

    I have just made it arrive at a random time each level.
     
  4. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Just store you level in a single byte adjacent to the fruits subroutine; then watch it over flow into mayhem! :D

    Yes, as far as I can see it is at a random time. Let us know when you've done it, I'd be interested in seeing what you come up with.

    Dave
     
  5. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
  6. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Great effort! :D

    All it needs is a slightly more complex maze and your on a winner. If you're feeling brave you could code a couple of different mazes to make things interesting. All in all, impressive stuff. Along with your pi-calculator you have quite a software repertoire.

    Dave
     
  7. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    You must be kidding right? :D
    It is supposed to be a well programmed joke, but still a joke.
    I am serious about my aim to emulate Pacman, but not really make it playable ;)

    I found out that the fruit appears after a certain amount of dots are eaten,
    and the number is about a third of the dots. Then the second fruit appears when
    about two thirds are eaten.
    Cheers, Art.
     
  8. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Aww, I found it quite entertaining! :D

    Mind you, I have also enjoyed a couple of beers with friends tonight!

    Seems a logical progression. When you asked the original question earlier I did think is could have been related to position of Pacman since the fruit pops up near the centre of the maze, however firstly I doubted the code capabilities of Pacmans creators (could they have done that with their shoe-box technology), and secondly what would be the criteria of such an implementation (how far from the centre would trigger the fruit).

    Get coding on them mazes - you could have a release by Christmas! :p

    Dave
     
  9. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    I mean the number of dots on the screen that are left.
    No matter where the Pacman is on the screen,
    the programmer has to check how many dots are left on the screen for every movement
    already, to check if the last one eaten was the last one in the maze.
    While doing that, it's not too hard to check for a certain number of dots left as well.

    The program also has to know where the Pacman is all the time just to draw the sprite on the screen,
    but I don't think the game is driven by matching X and Y coordinates at all,
    I think the programmer actually looks ahead of the Pacman's direction to look for
    edges of the maze (or the colour pixel the wall is made of) to decide where he can and cannot move.
     
  10. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Yes, I got that from your previous post. It seems the most logical method of doing it.

    Given that Pacman is essentially motion bound by the maze this would be the easiest implementation - knowing about a) Pacmans position, or b) details of the surroundings of Pacman are superfluous to where he can move - when Pacman can no longer move along the direction he was already going, check where you can move to.

    Dave
     
  11. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    The control of Pacman has always been my fav part of the game.
    It starts by checking the joystick.

    If Pacman can move in the direction of the joystick, then do it.
    Otherwise keep him moving in the last valid direction, if he can.
    Otherwise stop.

    That is how that pre-emptive turning corners thing works.
    It's cool that you can push up while still travelling sideways and turn the next corner,
    but of course the game is almost unplayable otherwise.
     
Loading...