Advertisement

Multiplayer Pac-man Challenge

Started by February 02, 2018 07:23 PM
62 comments, last by DexterZ101 6 years, 8 months ago
1 hour ago, MarcusAseth said:

value=void(*)()

Since you appear to be using C++, you can use the (much safer) std::function<void()> instead of that C function pointer abomination :)

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

5 minutes ago, swiftcoder said:

Since you appear to be using C++, you can use the (much safer) std::function<void()> instead of that C function pointer abomination :)

I agree, I wasn't sure if this was going to change to a different more general solution because I still have no idea about how to send input to the ghosts, so I made it the quick and dirty way using the function pointer :P 

Advertisement
1 hour ago, MarcusAseth said:

I'm not even sure this work since is the first time I try, furthermore since the Ghost are Creature type too, how are they supposed to get inputs? I guess I need to figure out a secondary method to give input to them.

Typically I abstract "character input" out from "user input".

You can define an enum of character inputs, say:


enum Input {
	Left, Right, Up, Down
}

Characters (whether player or AI controller) take all their inputs as a queue of inputs in that form.

Now the user input is handled by translating keys into Input values, and pushing them into the player character queue. And the AI is implemented as a generator of Input values, which are pushed into the AI character queue.

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

I'll give it a try, thanks for sharing :) 

Hello. This is a great challenge! 

This time I didn't want wait for last days as last time. And rush out quickly something out. So I worked really hard for a few weeks and this is what I came up with. Totally original implementation. Credits to sprites and sounds for old Pacman. I only modified them slightly. As it was required to resemble the original pacman. So I didn't want to get too creative. 

Pacmanjs is written in JavaScript since I know it well. Probably could have used python+pygame for a change. I used my old game FlyBirdFly game as a layout and starting smashing out code. AI was a bit problematic since I didn't want to slow down Pacmanjs. So I tried find a fine line between performance/AI-smartness.

This is my entry: https://mystikkogames.itch.io/pacmanjs

Project page: https://www.gamedev.net/projects/204-pacmanjs/

 

Game name is Pacmanjs 1.0rc. 

It has a ( single player mode / player vs AI mode / player vs player mode / team mode )

You can also play on mobile. Just press around pacman to move it around.

Pacmanjs should scale on different resolutions well.

esc - button returns to home screen as usual.

It only has 2 levels which keeps rotating. After passing a level the number of ghosts increases by 1. It has highscore lists for each category. Only #1 spots are noted tho.

I hope Pacmanjs works well! The last Firefox update killed my last entry ( MissileComm4nd ). There was a little bug. So I updated it too so it works as well!

 

ScreenshotPacmanjs1.png

Nice job! :)

I still gotta start my entry, hopefully tomorrow!

Programmer and 3D Artist

Advertisement

Great job, @mystikkogames! I haven't tried it on mobile yet but would multiplayer work on it as well?

On 2/18/2018 at 8:01 PM, Rutin said:

Nice job! :)

I still gotta start my entry, hopefully tomorrow!

Thanks. It takes time. Good luck with your pacman game!

 

19 hours ago, redblue said:

Great job, @mystikkogames! I haven't tried it on mobile yet but would multiplayer work on it as well?

 

Thanks. You can test mobile with browser when you activate "toggle devide toolbar". Multiplayer works on mobile "vs ai". "player vs player" and "team" modes require keys atm (arrows for Player#1 and WASD for Player#2). The simple fix is to find the closest pacman and apply direction to it. Will update it. I have played Pacmanjs in my mobile phone works fine. But it's not hitting 60fps in mobile phone constantly as in my laptop. I have to speed up things.

 

I forgot to mention that in team game, the game continues as long as there is lives left for any team member. In starting screen you can see pacman-ai playing itself. As I didn't want a static screen with just buttons.

I'm not sure If I can finish this on time, still on the lobbying phase and I'm still using programmer's art, but here's my progress so fat first time of me writing multiplayer game.
 


 

I'm still stumbling. I've so concentrated on getting the original behaviour done I'm basically stuck :)

Let's see if I can manage to get something playable...

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement