Jump to content
  • Advertisement

Multiplayer Pac-man Challenge

This topic is 577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!