Advertisement

Multiplayer Pac-man Challenge

Started by February 02, 2018 07:23 PM
62 comments, last by DexterZ101 6 years, 6 months ago
6 minutes ago, Rutin said:

Hmm. Those both pre-date this article, which seems to imply the opposite.

Anyway, not to derail the thread :)

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Just now, swiftcoder said:

Hmm. Those both pre-date this article, which seems to imply the opposite.

Anyway, not to derail the thread :)

I just had 1 bad run in for doing this, and sadly I did infringe under law (which doesn't matter if a person knows they've infringed or not, or had any intent to cause the infringement regardless of any financial gain) so it's not worth going back to a potential legal case for me. :D Some companies just send C&Ds, others will exercise their rights to make an example. I would need an official notice from them to do so otherwise.

I did a quick look, and it does look like they've opened up rights to use, but on approval only.

"But before they can use those IPs, individuals and companies will have to register to Bandai-Namco before beginning development."

Programmer and 3D Artist

Advertisement

Just to clarify, images/music/sound are off limits.  Direct character use is off limits(making Mario be your character even if you make your own graphics of Mario), unless its parody and can be proven as such.  But, gameplay is FAR from off limits.  Platformers abound, so do other clones, and there are no issues with this.

 

All that being said...I think I'll make this project happen, especially since a 2 months were given.  I'll likely use Gamemaker Studio 2, and I'm thinking local multiplayer, 2, 3, or 4 possibly.  I'm also thinking at the least a vs mode, but I kind of like a coop as well.  I also think my graphics(just because I can and like it) will 3d pre-rendered sprites, done with normal-mapping in the game.  In fact, lighting should be a nice thing here since it is easy enough to do if you have the code ready ahead of time.



Question...

Graphics representative and capturing the spirit of a Pac-man clone

This means I couldn't do something space themed, like a spaceship running from aliens while collecting energy capsules?  I saw in the specific section pertaining to art, it doesn't say the art has actually resemble pac-man, but this quote is kinda unclear.



I would like to know too because I'm making the game with a similar idea, just not using copyrighted/restricted assets. I hope it will still be accepted as a valid submission.

Just a thought, but maybe for future challenges we should stick to making games with certain ideas and concepts with requirements, not clones as this touches on that whole IP and Copyright issue.

Programmer and 3D Artist

That's what I'm unclear on...I know it isn't supposed to be a clone, as the rules mention "capture the spirit" but the graphics part is my question.  I'm sure a spaceship tractoring in energy capsules played in a top-down fashion, running from aliens is close enough to "capture the spirit" if it is done in a similar grid, with similar movement as Pac-Man.



Advertisement

If you're concerned about IP/copyright with Namco, then capturing the spirit simply means capturing the gameplay mechanics of Pac-man. The point of the challenge is the gameplay, not the graphics.

I've reworded the challenge to make this more clear. Hopefully that helps.

And shame on Namco for attacking educational development.

Admin for GameDev.net.

I'm not officially participating because I'm likely to get stucked somewhere along the way, probably when dealing with sound xD

Anyway I've got this so far:

Spoiler

8RUlPj7.png

The green cells are the "rules" which I still need to input in my massive switch statement to get all the corner looking right, kind of tedious x_x

I have a question regarding it: considering my code below, is this the usual way to match the correct tiles frames? Or I'm just doing it the dumbest way possible? (basically brute-forcing it one line at a time) xD

Spoiler


SDL_Rect PlayState::calculateTileFrame(int row, int column, const vector<string> &inputMap)
{
    SDL_Rect source{0, 0, 32, 32};
    if (inputMap[row][column] != '#')
    {
        return source;
    }

    //Purpose: given the cell passed as input to this function, we know it can be surrounded by 8 cells.
    //The loop below shall set the 8 bits of a char with a 1 if a surrounding cell has a wall, 0 otherwise.
    //This bit pattern will determine which tileset frame is used for the given cell.
    /*
    8 7 6
    5 X 4
    3 2 1
    */
    int shiftValue = 7;
    unsigned char byte{};
    for (int i = -1; i < 2; i++)
    {
        for (int j = -1; j < 2; j++)
        {
            bool isWall = true;
            if (i == 0 && j == 0) //skip self
                continue;

            int x = j + column;
            int y = i + row;

            //index boundary check
            if ((x >= 0 && x < inputMap[0].size()) && (y >= 0 && y < inputMap.size()))
            {
                isWall = (inputMap[y][x] == '#');
            }
            byte += isWall << shiftValue;
            shiftValue--;
        }
    }

    //match bit pattern
    // 8 7 6
    // 5 X 4
    // 3 2 1
    row = 0;
    column = 0;
    switch (byte)
    {
    //top U semi-circle
    case 0b00000010:
    case 0b00000110:
    case 0b00000011:
    case 0b00000111:
    {
        row = 4;
        column = 1;
    }
    break;
    //right U semi-circle
    case 0b00001000:
    case 0b00101000:
    case 0b00001001:
    case 0b00101001:
    {
        row = 3;
        column = 1;
    }
    break;
    //bottom U semi-circle
    case 0b01000000:
    case 0b11000000:
    case 0b01100000:
    case 0b11100000:
    {
        row = 3;
    }
    break;
    //left U semi-circle
    case 0b00010000:
    case 0b10010000:
    case 0b00010100:
    case 0b10010100:
    {
        row = 4;
    }
    break;
    //all side surrounded
    case 0b11111111:
    {
        row = 1;
        column = 3;
    }
    break;
    //top wall
    case 0b00011111:
    {
        column = 3;
    }
    break;
    //right wall
    case 0b11010110:
    case 0b11010111:
    case 0b11110110:
    {
        row = 1;
        column = 4;
    }
    break;
    //bottom wall
    case 0b11111000:
    case 0b11111100:
    case 0b11111001:
    {
        row = 2;
        column = 3;
    }
    break;
    //left wall
    case 0b01101011:
    {
        row = 1;
        column = 2;
    }
    break;
    //top wall + innerCorner SE
    case 0b00011110:
    {
        row = 2;
        column = 5;
    }
    break;
    //top wall + innerCorner SW
    case 0b00011011:
    {
        column = 6;
    }
    break;
    //outward NW corner
    case 0b00001011:
    {
        column = 2;
    }
    break;
    //outward NE corner
    case 0b00010110:
    {
        column = 4;
    }
    break;
        //outward SE corner
    case 0b11010000:
    {
        row = 2;
        column = 4;
    }
    break;
        //outward SW corner
    case 0b01101000:
    {
        row = 2;
        column = 2;
    }
    break;
    default:
    {
        row = 4;
        column = 5;
    }
    }

    source = {column * 32, row * 32, 32, 32};
    return source;
}

 

 

When we're programming we're problem solving by creating solutions, as long as the problem is solved who cares? Some people go way overboard and complicate the process, other people find a quick and workable approach.

I'm not sure if we're supposed to provide guidance in challenges so I apologize beforehand. If you're just dealing with tile maps, you can pick any way that works for you. I normally use custom map editors I've made, but for this challenge I'm just hard coding the map by using a 2D array which holds int values, and each int represents a visual graphic tile. Then in my draw loop I just use two for loops and cycle through taking account of the tile size and how it fits into the screen.

Without the "screen and tile size part" it's just this: (You would need an if statement to draw a tile based on the value of myMap[y][x])


int myMap[5][5] = {
		{ 1, 2, 1, 2, 0 },
		{ 1, 2, 1, 2, 0 },
	    { 1, 2, 1, 2, 0 },
	    { 1, 2, 1, 2, 0 },
	    { 1, 2, 1, 2, 0 }
};

for (int y = 0; y < 5; y++) {

  for (int x = 0; x < 5; x++) {

    std::cout << myMap[y][x] << " ";
  }

  std::cout << std::endl;
}

You have 2 months, I'm sure you can find out how to implement sound. :) Doing these challenges is how you can push yourself to learn new things in game programming.

Programmer and 3D Artist

6 hours ago, Rutin said:

I'm not sure if we're supposed to provide guidance 

I'm the first one who worries about it because wouldn't be nearly as good to succed just by copy pasting other people stuff :D And that's why I've asked only after I got it working, I don't plan to re-implementing it no matter the answers, my question was only aimed to compare to the way other people do it to gauge the benefits of each methods and learn more out of it  :)

I've had briefly thought of hardcoding the specific tyle type into the map as you did, I didn't went that route only because I though would have been kind of painful to change stuff around watching at a table of symbols (since I don't have any visual map editor xD). This is how the map input look:

Spoiler


vector<string> inputMap = {
        {"############################"},
        {"#            ##            #"},
        {"# #### ##### ## ##### #### #"},
        {"# #### ##### ## ##### #### #"},
        {"# #### ##### ## ##### #### #"},
        {"#                          #"},
        {"# #### ## ######## ## #### #"},
        {"# #### ## ######## ## #### #"},
        {"#      ##    ##    ##      #"},
        {"###### ##### ## ##### ######"},
        {"###### ##### ## ##### ######"},
        {"                            "},
        {"###### ## ###  ### ## ######"},
        {"###### ## ##    ## ## ######"},
        {"###### ## ##    ## ## ######"},
        {"###### ## ##    ## ## ######"},
        {"###### ## ######## ## ######"},
        {"#            ##            #"},
        {"# #### ##### ## ##### #### #"},
        {"# #### ##### ## ##### #### #"},
        {"#   ##                ##   #"},
        {"### ## ## ######## ## ## ###"},
        {"### ## ## ######## ## ## ###"},
        {"#      ##    ##    ##      #"},
        {"# ########## ## ########## #"},
        {"# ########## ## ########## #"},
        {"#                          #"},
        {"############################"}};

 

 

This topic is closed to new replies.

Advertisement