I’ve no puns poor or otherwise using the word menu, so this time our title has a nice little metre to it instead. If you’d like to continue with this menu post, then you are in the right place!
Swiftly moving past the ill fitted rhymes above, this post genuinely is about the menu for my Pong game in C#. Now if you’ve read my previous posts you might be thinking, but it should be done already! Well it is, this is my last day on it and I finished the majority of the game last night. There’s literally 1 tiny boolean value I’d like to add to allow local multiplayer or just solo play, as options are always in the player’s best interest (admittedly to a point, also after writing this intro I went and added that multi/singleplayer functionality).
I’ve made a menu before, it was rather simple and it gave the controls, a small basic operation of the game’s volume, a non-working control remapping, a play and a quit button, pretty standard fare I feel. In this version of Pong I wanted to try and build upon that, or at least have it look more professional.
In this menu system, the player is confronted with 3 options; Play, Options, Exit. Exit will close the application, very simply, it is in fact the other 2 options that I’m proud of due to their level of interactivity. When clicking on the Options menu, players are taken away from the original menu and instead given a new 3 options; Resolution, Audio, Back. Back takes the user to the main menu again, Audio gives the player a slider, when the value is changed the games volume does too, however there is no menu music so it’s not entirely apparent at first glance. It works by having the slider value when changed set a playerpref for audio. When the game is loaded up (and sound therefore played), the AudioListener object is set to the playerpref value that the slider originally set.
When picking the Resolution option however, players are confronted with a dropdown box with the values 640 x 480, upon interacting with the drop down, they’ll soon find a list of resolutions all supported by the game, running up to 1680 x 1050. Now in a dropdown, Unity returns only the value of the list element chosen, so for instance 640 x 480 would just give the value 0, 1680 x 1050 would give the value 11. Instantly I saw this an an opportunity to create an Array. I already knew that to set the resolution Unity uses a command of “SetResolution(X, Y, Windowed)”. I decided to create two private arrays, one for the X resolution and another for the Y, whichever value was chosen in the dropdown box was going to equal the array index of both those arrays. I always set the game to windowed however.
That leaves the Play menu and this is honestly one I’m very proud of, when clicking play the user has several choices once more: Singleplayer, Multiplayer, Back. In singleplayer a playerpref called “PlayerMode” is set to “Single”, and with multiplayer it’s set to “Multi”. In the GameManager, when the scene is loaded, it will either instantiate a Right-hand Racket as player 2, or an AI. Getting this to work was slightly minor given my experience with instantiating objects such as the ball originally, and in my ProcGen game the map itself.
As a little aside, the pause menu when in game also includes options to continue playing, exit to the main menu, or re-select some of your options again, so Audio and Resolution are never far away. A player needn’t stop a game in order to have the game set to their prefered resolution or volume.
I am however most proud of the Play menu options, simply because of this reason: In my original game there was no resolution option admittedly, but there was also no play option either. You play solely against the AI, it will never change, it will always be the AI, the same AI not a Hard/Normal/Easy AI (this game also doesn’t have that but I think I know how I’d implement a Normal/Easy one), always the same. Allowing for local multiplayer makes the game the one things that games should be – a communal experience. Assuming this was a game many people played they might all have very similar stories of how they beat the AI, or how the AI was super tricky, but with local multiplayer that branches out into every person you’d ever want to play a game with. Now you could potentially have a story about a really fierce pong game you and your best friend played, and because it’s a shared experience I believe it to be a much stronger one.
Games are meant to be many things; Art, a storytelling device, an emotional playground, a challenge to be mastered, a challenge to be remembered. But I think more than anything they’re meant to be communal, we all hear at things like E3 about how you can share your experience, you can stream your experience, that games are accepting of everyone, young and old. Allowing my game to not just be you against a computer but you against a friend allows that type of experience. It’s admittedly a game by a young man with no significant impact on the gaming industry so it’s not a game that masses will flock to and want to play, and it’s a reskin of a classic game anyway, but it’s a personal achievement, and I love the idea that if even one person went and played that game, and better yet played it with a friend, then I’ll have done more to the game industry and community than I would dare ask.
Thanks for reading, have an awesome day, and keep keep designing.