Team Pokers (2018-2022)
11:11
The biggest project of my career till now. Worked on it for more than 4 years in my time with Hornet Dynamics.
It's a Professional Poker game built for Android and Windows PC platforms and it grown to a Casino platform in those years with additional games including Baccarat, Power Ball etc. The game was released under different titles for multiple clients, unfortunately I'm not allowed to share those names. What I can do share the things I did on that project.
//Technical Highlights:
1. A MIX OF MVC & OBSERVER PATTERN
This is probably the best way you can build ANY multiplayer game! I know it may sound weird using these architectures for games, but it works wonders.
Let me explain how the mix works, so MVC inspired me to keep my data and views separate. View in a game could be your player, the game room itself etc. But they all are just data on server, so data layer here is pretty much replicating that data here. This data is in one place and completely separate from view. It's critical when you want to reuse your work where your designs (views) are ever changing. Now, in standard MVC you would have controllers updating the views but here views themselves are observing the data itself. It allows us to have multiple views for the same data and they simply work on their own. I'd probably have a dedicated post about this entire architecture sometime.
This is probably the best way you can build ANY multiplayer game! I know it may sound weird using these architectures for games, but it works wonders.
Let me explain how the mix works, so MVC inspired me to keep my data and views separate. View in a game could be your player, the game room itself etc. But they all are just data on server, so data layer here is pretty much replicating that data here. This data is in one place and completely separate from view. It's critical when you want to reuse your work where your designs (views) are ever changing. Now, in standard MVC you would have controllers updating the views but here views themselves are observing the data itself. It allows us to have multiple views for the same data and they simply work on their own. I'd probably have a dedicated post about this entire architecture sometime.
2. A LOCAL TCP SERVER-CLIENTS
For what? You may ask. Not for running a local multiplayer session if you guessed that. The need arises when we're trying a target professional players. They like to play multiple games simultaneously, but a unity game can only run in one window, we could run all the games in one window fullscreen but then they got more monitors. Only practical solution was to have multiple windows, like a real Windows application. Alright, so build 2 games, one for lobby and one for game room. Nothing is stopping us from running multiple instances of them, right? Yes, pretty much. But now we have a new problem, each game room will make a new connection to server, so potentially one user could consume 10CCU if he wanted to, which is not very cost effective. That's where I built this small local TCP server, where lobby maintains the connection from remote server while itself being a local server to the game rooms, those are communicating through lobby using this local connection.
For what? You may ask. Not for running a local multiplayer session if you guessed that. The need arises when we're trying a target professional players. They like to play multiple games simultaneously, but a unity game can only run in one window, we could run all the games in one window fullscreen but then they got more monitors. Only practical solution was to have multiple windows, like a real Windows application. Alright, so build 2 games, one for lobby and one for game room. Nothing is stopping us from running multiple instances of them, right? Yes, pretty much. But now we have a new problem, each game room will make a new connection to server, so potentially one user could consume 10CCU if he wanted to, which is not very cost effective. That's where I built this small local TCP server, where lobby maintains the connection from remote server while itself being a local server to the game rooms, those are communicating through lobby using this local connection.
3. EMBEDDING UNITY RUNTIME
Embedding where? To Windows Forms. Windows forms are one way to build Windows software, the each window they open is called a Form. Since we were making a multi-window game we needed to have those features, because that's how a windows user would expect a multi-window software to work on his machine. Now we wouldn't want to build the entire game in a completely different development environment right, what's the point of using cross platform game engine then. Luckily Unity allows us to embed it's windows build into a separate windows software, which is what we did.
Embedding where? To Windows Forms. Windows forms are one way to build Windows software, the each window they open is called a Form. Since we were making a multi-window game we needed to have those features, because that's how a windows user would expect a multi-window software to work on his machine. Now we wouldn't want to build the entire game in a completely different development environment right, what's the point of using cross platform game engine then. Luckily Unity allows us to embed it's windows build into a separate windows software, which is what we did.
4. CUSTOM UI AND ANIMATION FRAMEWORK
No we didn't reinvent the wheel here, it would be #1 highlight otherwise. What I mean by framework is set of components which allowed us to create any functional UI with pretty much no new code at all. The way it works is every basic data type are turned into a "provider" and then there are handlers to each of these providers. There are not many ways you'd handle the data if you think about it, an image url is most likely be shown as sprite. Some amount will be shown on text field. Some bool will toggle on and off the objects. So components broken down to this granular level provided a great amount of flexibility.
What about the animations? Well there's nothing wrong about animating objects using unity, you can move around objects, change colors of things. But we wanted to do more and they were not really static. So again animations were broken down into small component, a component to move around things, one to change color of things, one to animate texts etc. Magic happens the way you can combine them. So essentially an animation is a value interpolating from 0 to 1, and you want to do certain things in this transition. Now you could run multiple 0-1 together or push multiple 0-1 inside one big 0-1 to make a timeline, I don't know if this makes sense. I'll probably add few pictures here later to explain myself better.
There were more things as well, Like building a localization solution that works realtime to add/update translations, building a custom installer and updater for the windows version, implementing deferred deep linking for referrals etc.
No we didn't reinvent the wheel here, it would be #1 highlight otherwise. What I mean by framework is set of components which allowed us to create any functional UI with pretty much no new code at all. The way it works is every basic data type are turned into a "provider" and then there are handlers to each of these providers. There are not many ways you'd handle the data if you think about it, an image url is most likely be shown as sprite. Some amount will be shown on text field. Some bool will toggle on and off the objects. So components broken down to this granular level provided a great amount of flexibility.
What about the animations? Well there's nothing wrong about animating objects using unity, you can move around objects, change colors of things. But we wanted to do more and they were not really static. So again animations were broken down into small component, a component to move around things, one to change color of things, one to animate texts etc. Magic happens the way you can combine them. So essentially an animation is a value interpolating from 0 to 1, and you want to do certain things in this transition. Now you could run multiple 0-1 together or push multiple 0-1 inside one big 0-1 to make a timeline, I don't know if this makes sense. I'll probably add few pictures here later to explain myself better.
There were more things as well, Like building a localization solution that works realtime to add/update translations, building a custom installer and updater for the windows version, implementing deferred deep linking for referrals etc.
0 comments