The Hearts Card Game Finished!

Its been quite a while but after taking a little break from working on my role playing game, I decided to work on my Hearts Card game. I mainly made this for my wifey who loves to play the game. I originally made this game in Java and Monkey X which helped me figure out how to create some of the methods required to complete the game in Unity.

Hearts Card Game 1

The main thing that took me so long was figuring out how to use Unity Game Objects for everything in the game. From the cards, the deck to the players, they are all represented in the game as game objects which allows for some really nice object manipulation and keeping track of whats going on in the game. I wrote a few scripts to help manage the objects in game like a card script for assigning and tracking specific card variables and positions. I also wrote a deck script for keeping track of the status of the deck, handles the shuffling and the dealing of the cards. The player script keeps track of each player, their specific variables like scores and names along with positions and avatars. The last script I wrote was the main script that handles the actual game play and puts all the individual game objects to work along with keeping track of them and their states.

Hearts Card Game 2

I originally used a deck of cards I found online when I originally wrote the Java and MonkeyX version but after using it for my Unity version, I noticed how low of a resolution they were so I had to get a new deck. I found a public domain deck at Byron Knolls Blog. I was able to use this deck as a base and do a few customization’s to it. The cards are a higher resolution and look pretty good. I just wanted to add an inner rectangle on each card and make a custom card back with The Game Realm Logo.

One of the main issues I had was getting the game to work properly in a web browser using the Unity WebGL build. The game wouldn’t scale properly no matter what and if the user changed the browser window size, the game wouldn’t scale with the new window size. I finally got the settings correct inside the Unity Editor using screen overlay and scale with screen size on the canvas. I then had to use the A Better Template unity package from Greggman which allowed the game to scale properly with each window size. The problem was though that if the user resized the window after starting the game, the scale would be off. I fixed this by forcing a page reload if the browser window gets resized.

Basically, overall, it took me about a month and a half to get the game completed. Get some bugs worked out and get it on the website. I will be looking at adding some multiplayer after a bit. I will be working on a few more single player games first, like The Dice Game which is next in line.

I appreciate you taking a look at the game and reading the post! If you have any questions, please feel free to ask or comment below!

Thank you!

Multiplayer Browser Games and the Big Deal!

Hello All!
I just wanted to write up a quick update on my progress with the website and creating multiplayer browser games. I’ve been hard at it for months and during that time I have looked into every possible scenario when it comes to creating and publishing browser based games that can be played in a multiplayer environment. After spending all this time writing prototypes, examples and test projects, I have finally decided to move away from it. The biggest reason is due to the very high maintenance of these kinds of projects. The fact that you really have to have a dedicated server to handle the games, data and information. With all the available options out there for this kind of structure, it can get pretty heavy really quick.

One of the biggest setups for this kind of system is the Node.js. In order to incorporate this system along with using wordpress, it quickly become pretty bloated. That was even before I included 1 line of game code! I wrote a log in server and a chat system that were pretty functional, but in the end I just didn’t like it. At all. This was after a few months of trial and error with it. Eventually I decided to move away from the whole Multiplayer browser based game idea and focus on pure stand alone Multiplayer Games.

I will be using Unity of course and I still plan on creating the type of games I have listed on the home page. I pretty much just finished up with my core networking code that will pretty much be used as a template for all my games. Of course, over time this will change as new features get added to the core base code or things change.

The first game I will be completing here shortly will be Tic Tac Toe. Its a basic game that doesn’t require too much game code and an easy to implement way of testing out the network code. As soon as I get done with the game, I will post it in the games section.

As always, if you have any comments, questions or feed back, please let loose in the comments section below!

Thank you!
Jeff

Added The Game Realm Chat!

After getting the website up and running, getting the layout and styles to somewhere near where I wanted it to look, my first step was to get the chat system up and running. Since The Game Realm is all about multiplayer browser games, implementing a networking system was the number one priority.

Chat Screenshot

During my never ending search for the different architectures available for browser based or even non-browser based networking, I looked into everything that was available. My first adventure led me to socket.io. After spending quite some time learning what it was, how to use it and implementing it into the website, I decided it wasn’t the direction I wanted to go. Socket.io was great for sending messages back and forth but I would need to go alot deeper to incorporate a game server using it. I decided to look into the Unity Unet system (again).

One of the main reasons I wanted to use Unity to create my networking system is that I love Unity. I love the editor, the fact that I can port to just about any device and I wanted the server and client to share some code, which will make writing games for the web site a lot easier.

The first thing I needed to do was to learn what Unity UNet was all about. I will say that it was quite a learning curve. Trying to figure out what HLAPI and LLAPI was and how to do the a simple implementation of a network put my brain into overdrive.

My goal was to create a simple chat system. Since a multiplayer game is in reality nothing more than a server and a client sending messages to each other when broken down to its most basic level, I figured a chat system is the place to start.

While delving into the Unity UNet system and learning LLAPI and the HLAPI, I was finally able to narrow down the most basic usage of networking code as possible to get a server and client up and running. Of course it used a system I didn’t see in the forums or anywhere online, just something I came up with. So far I’m very excited about it and can see how I will be using it to create the games here at The Game Realm!

TGR_Chat-keyboard-SS

One of the things I found out is that the Unity WebGL doesn’t allow the mobile Keyboard to open when using the chat on a mobile browser. After seeing this I had to incorporate a home made virtual keyboard for the mobile browser chat which you can see in the screenshot above. I’m not very happy with it since the buttons are small, don’t respond as well as I would like and it isn’t very pretty. But until Unity fixes this, I don’t have any other options, yet!

 

Update as of June 2nd, 2018…
I decided to move away from hosting my own chat and decided to use the Wise Chat plugin. It was a lot easier, had all the features I needed and easy to implement plus no Maintenance! Check out the Chat link in the main menu! 🙂