Advertisement

How to start...very specific game idea and plan to use Unity

Started by August 11, 2016 08:07 PM
5 comments, last by RH101 8 years, 3 months ago

Hi, Im a beginning programmer. I started learning Javascript, but have found it a bit boring since I haven't done anything with it that fits in with what I want to do. My friend said C# is better for me, since right now, I want to make a very specific game. He recommended Unity as well.

I want to make a game that is like what you see on slot machines etc. The wheels spin, the pictures cycle through and then stop to form a pattern. Depending on the pattern, you earn points (instead of money), and the game plays on how many points you have. I originally thought maybe JS would work for this, but my friend said JS wouldn't be a good choice for this (I haven't even finished the real "meat" of JS). He said I should try unity and use C#. I have no knowledge of C# but could learn and use the unity tutorials etc.

My question is, is using Unity with C# best for this kind of game? Has anyone made this kind of game and has input? Thank you

You can use just about anything to implement a slots-like program as described.

There are many such programs that use HTML5+JavaScript. The top two results from typing it in Google are a howto from three years ago and an aggregator listing over 200 implementations.

There are similar tutorials to implement it in Unity, not including a best search but there are tons of them.

If you want to use Unity then use it. If you want to use HTML5+JavaScript then use it. If you want to use GameMaker:Studio then use it. If you want to code it all in raw assembly then use it.

Advertisement

What's your end goal, to learn any programming language, to learn to make games? To learn to make 2d games, to learn to make 3d games eventually?

What's your end goal, to learn any programming language, to learn to make games? To learn to make 2d games, to learn to make 3d games eventually?

Um...well...it's interesting that you ask. I want to be a web dev but do game programming as a hobby basically, or to eventually roll out games as apps or online. I have a lot more interest in making games, and would rather work for myself than a company. My boyfriend is a software/web dev and I originally wanted to do what he does, but as I have been learning my first language he recommended (JS; I already know HTML5 and most of css3) I have just hit a wall and found it not very interesting. I had no goal in sight that would happen soon, no idea on a project to work on as I learned JS. Then, my mom, who is addicted to slot games, asked me if I could learn how to make her a slot game. It sounded much more interesting. My goal has always been to make apps, but Id like to make game apps etc. So yes, Id like to learn 3d eventually.

edit- i did see above, I can make a game using JS, HTML5, and CSS3. I was told that C# is better for this though, and it would still translate to web dev. (Unityscript, their version of JS, doesnt translate to be the same as regular JS)

another edit- sorry, meant to state, like in my OP, that I plan to use Unity.

Okay, I think your headed down the right path. Try Unity, if it doesn't work for you, try that link of frob's. Or do both, if you'd like. I'm finding Unity to be pretty nice for making mobile games myself, though I'm a bit of a C# fan. Don't be afraid to try a few different engines or frameworks and find one that clicks.

You "were told that C# is better" - by whom? And for which reasons?

I personally believe that C# is a better language, but Javascript is perfectly capable of doing what you want. If you're familiar with that, it's better to stick with it for your first project.

Advertisement

My question is, is using Unity with C# best for this kind of game? Has anyone made this kind of game and has input? Thank you

FIrstly, you can use Javascript in Unity (well, Unity's own flavor of Javascript) to get you started, and you can use C# at the same time (in separate files).

Now, regarding making a slots game. It's not as easy as it may seem, but in no way is that supposed to turn you off attempting to create one. I've personally implemented slots games using many different game engines, including Unity, Cocos2D-x, Win2D etc, and regardless of which programming language or game engine you decide to use, the algorithms for slots games are always the same.

To create a slots game, you also have to factor in the mathematical model for the game, which includes things like the pay ratios, the RTP (return to player) percentage, the RTP contribution from the feature games (such as a free spins feature), the reel layout (for example, 5 reels by 3 symbols), the type of wins (line wins/scatter wins/all way wins etc), and the line patterns for line games.

You then need to work out how to calculate the wins based on the symbols visible on the screen (the symbol matrix). This alone may require a considerable amount of design and coding, since a different algorithm is required for each type of pay (left to right line pay, any position scatter pay, left to right scatter pay, left to right all ways scatter pays etc etc).

Working out the mathematical model behind the game is also not a trivial thing. If you get the mathematics wrong, your game will either pay too much or not enough, or just simply not engage the players in such a way as to keep them interested in the playing the game. There are sources of info on the internet with samples of game mathematics if you're keen to dive in and try to figure it all out.

Here are a few sites and research papers that may help:

http://wizardofodds.com/games/slots/atkins-diet/

https://www.researchgate.net/publication/247919295_PAR_Sheets_probabilities_and_slot_machine_play_Implications_for_problem_and_non-problem_gambling

http://slotdesigner.com/publications/

Search for "PAR Sheet", and it will show you the type of mathematics required for a slots game.

From experience, I suggest you focus on the following in the specific order set out below:

- Create test data (reel strips, pay tables etc)

- Implement the reel spin so you can see the reels spinning on the screen.

- Work out how to grab the current on screen symbols into a 2D matrix (Rows x Columns).

- Create a state machine to handle the different states of the game. The states may be something like this:

  • Idle State (wait for a button press in here)
  • Pre Play State (generate the random reel stop positions in here)
  • Play State (you spin the reels in this state)
  • Post Play State (do any animations you need if required in here)
  • Calculate Win State (calculate the wins based on the stop positions in here)
  • Show Win State (display the winning symbol animations in this state)
  • End Game State (you go back to Idle state in here)

- Work out the win calculation algorithms and implement them. The win calculation routines can use the 2D matrix of the current symbols on the screen to detect winning combinations.

- Add feature handling code

- Add any extra accounting code you need

- Now you can work out the real mathematics behind the slots game in order to make the game enjoyable. Leave the mathematics till the end since it's not required in order to get something displaying on the screen.

If you have any specific questions regarding slots games, then I'll do my best to answer them.

This topic is closed to new replies.

Advertisement