I've been conceptualizing a game for a few days now, but I can't seem to get my mind wrapped around how I would get it to work in MMF2.
What I want is a basic slot machine, but wherever I've looked for examples, I've been stuck. I found the application that was on MMF2 bonus CD, but that only shows the Slot Machine game itself, none of the MMF2 coding. I assume the payline schedule is as simple as background coding. It's randomizing the reels that I can't wrap my head around. I figure what I could do is have the reels already created, and just start it at a random point as it starts falling. Then a collision check once the reels stop spinning could determine the payout.
If anyone has any advice, or, better yet, an example that they could provide, I'd really appreciate it.
Hmm...Maybe this is an example I can come up with. Unfortunately I'm not at my MMF2 computer right now (I'm on break at the day job). Here's a quick-and-dirty explanation...
What I recommend you do is have animations set on three Active Objects as slot machine tumblers. Have a different animation frame set up for each result.
When the player pulls the lever/presses the space bar/inserts a coin etc. then the tumblers start spinning. To indicate this, set a flag ON for each of the tumblers:
IF Player Presses SPACEBAR
AND IF Tumbler's Alterable Value A = 0
THEN Tumbler 1 set Flag 0 ON
AND Tumber 2 set Flag 0 ON
AND Tumber 3 set Flag 0 ON
While the tumblers are spinning, make a random animation frame appear. Meanwhile, a counter will steadily add up for each counter:
IF Tumbler Flag 0 is ON
THEN add 1 to Tumbler's Alterable Value A
AND set Tumbler's Animation Frame to Random(x) [where "x" is the number of animation frames for the Tumbler]
When the timer reaches its limit, the tumblers will stop, and the player can press the spacebar again to start the process over again:
IF Tumbler Flag 0 is ON
AND IF Tumbler's Alterable Value A =/> 50 (or whatever)
THEN Set Tumbler's Flag 0 to OFF
AND Set Tumbler's Alterable Value A to 0
I think the only snag you'll find is something to do with the animation frames; they're set to be Base 0 (starting with "0" instead of "1"), but then again I am fairly sure Alterable Values are as well. Just keep aware of it, and you ought to do fine.
It worked pretty much right away, and that's a great first foray into this idea. What I'm thinking about trying going forward is designing five reels in their entirety, and then determining what values are in the 4 lines by looking at the position of the reel itself. Once it reaches a certain threshold, a duplicate of the reel would be created, and start from the top again. The only thing I have to make sure of is that it is a tight fit. It's probably more events than I'd prefer, but it'll make the reel system look a little classier. Good news is, most of the code that you provided should, in theory, still fit.
Once I've a moment to spare, I'd like to put together an example of different slot machine mechanisms, and how to set up betting, payouts, and so on. If you can share the Event List you come up with this, it could be a great base to build on.
I need to get much better at this first . I don't even have something cognizant so far. Just testing the pieces to see what I can do.
This all stemmed from a slot machine I played in AC this last week. My MMF2 coding skills are messy at best for now, but I'm trying. I'll try and get together some cash for someone to tutor me.
I tried my hand at this for a few days now. It was ridiculously messy. When the reel would cycle back to the top, it would make a mess of the one that was leaving the bottom (in theory, they should have met exactly). After 100 or so events that are beginning to cancel each other out, I'm going to throw in the towel with this trial run.
I know what I want to do, but getting it to work is absolute carnage. My biggest disadvantage is that I'm probably just making it too complicated for myself.
Michael: I now see what you mean by having the images return back to the top of the "reel." I hadn't been working in that direction, but I may be able to. From first glance however, I don't think the example I posted above would be workable for that effect. I do want to pursue this myself, as I'm curious as to how it can work.
I finally had a chance to fiddle around with a basic slot machine setup myself yesterday, and there were some notable changes I'd made from my original post so it could actually work.
For one thing, attempting to force animation frames manually didn't work for me at all. It didn't seem like animation frames could be linked up with changing states of Flags. I ended up creating three counters - one for each tumbler of the slot machine - and then forced the tumbler to match up with the value of the corresponding Counter.
With that method, I was easily able to set it up so that the tumblers could stop all at the same time, or each at different times. This creates a conventional "1, 2, 3" sequence of tumblers rolling, and then stopping.
In the coming days/weeks I'll pick away at this and see if I can come up with some sort of reel effect, and display the graphics like you're seeking, Michael. It'll be an interesting project and I have an idea or two already that might work just fine.
That's wonderful! I decided to pick up the thrown towel as well, and keep looking into it also. It's still going to be messy, and overly robust, but for now, I'm just testing things. Once I have something worth looking at, I may post it for others. I know there is an easier way to do this, for sure. Right now, I just want to prove to myself that, even if it's not pretty, it is possible.
I have just started work on a Slot Machine game for the Funtition and have designed a three reel single win line machine.
The reels consist of three active objects each. They are laid out like this:
Reel 1 Top
Reel 1
Reel 1 Bottom
Reel 1 has an Alterable Value called Reel Image and this is used to choose from the reel images available. The images have been placed in the Stopped animation and are individual frames for the animation.
For example:
Frame 1 - Cherry
Frame 2 - Bar
Frame 3 - Red 7
etc...
So to spin the images i have the following bits of code. (this is purely for Reel 1 only)
Always
Force Animation Frame of Reel 1 Top to Reel Image of Reel 1 + 1
Force Animation Frame of Reel 1 to Reel Image of Reel 1
Force Animation Frame of Reel 1 Bottom to Reel Image of Reel 1 - 1
The above code means that the top and bottom parts of the reel will display the previous and next parts of the reel.
The next part of code handles if the images are at the limits of the reel. i.e the first and last image
Reel image of Reel 1 = 0
Force Animation Frame of Reel Bottom to 14
Reel image of Reel 1 = 14
Force Animation Frame of Reel 1 Top to 0
I then use 3 individual counters to designate how much spin time is allocated to each reel and this is done whern the spin button is pressed.
Spin is pressed
Set Reel 1 counter to Random(24)+10 - This ensures that the first reel will spin through at least 10 frames
Set Reel 2 counter to Reel 1 counter + 6
Set Reel 3 Counter to Reel 1 counter + 12
The staggering in the code ensures that reel 1 stops then reel 2 and then reel 3
The next bit of code controls the spin itself.
Reel 1 counter < 0
Add 1 to Reel Image of Reel 1
Subtract 1 from Reel 1 counter
To make sure that the images flow properly i have added the following little bit of code into it to stop white space being displayed:
Reel image of reel 1 = 15
Set Reel image to 0
This makes for a very smooth animation albeit very quick.
There is probably a much cleaner way of doing it but it's version 1 so we'll see how it goes.
I want eventually to make a modular version of this engine.
I don't know if it is going to be possible though with all the different reel images you could do but we'll see.
Once i have got 3 reels down solid i might progress to 3 reel 5 winlines and then 5 reels and god knows how many win lines and wild symbols and allsorts of other things
I wish I had half the talent that some of you guys seem to have in your little fingers alone. I've got so much creative juice flowing, but hardly the raw ability.
Honestly dude, I threw this together after jotting it down on paper first.
I originally did it using 1 active with the 1 full image then 2 half images above and below but it looked poor.
If you have any questions about the example i posted just hit me up and i'll do my best to help.
I tested what you provided, and it looks awesome. I attempted to test the current frame of reel 1 against the current frames of the other reels, and while that works, it's not really the way you'd want a real slot machine to work. I have to rewire my mind to think logically for that.
My thought process at the moment is to try and map each frame within the reels to specific values. For example, the sunglasses would all be alterable value a = 1, sun would be a = 2, etc. I'm not sure how that'd work off the top of my head, and it'd probably be more work as well, but I can't think of a more coherent process just yet.
I'm also going to try and see if there's a way to get the full reel to work the way it should, as in that example I showed from YouTube.
I'm not 100% sure what you mean by this. The animation speeds can be slowed down with some trickery, Due to the way the reels are setup it would be virtually impossible to assign an alterable value to the reel images which is why i had to go through manually and write down the position of each image,
As far as getting "the full reel to work the way it should" I'm a little confused as to what you are trying to achieve.
Are you talking about the animation speeds, the staggering of the reels or the bounce?
Sorry if I'm a little unclear in what I'm saying. I'll try and go through your post piece by piece.
I'm not 100% sure what you mean by this. The animation speeds can be slowed down with some trickery, Due to the way the reels are setup it would be virtually impossible to assign an alterable value to the reel images which is why i had to go through manually and write down the position of each image,
Slowing down the animation speed is as easy as making the counter drop down slower (I made it happen every 5/100ths of a second, I think).
Assigning an alterable value to a reel image should be easy too. If the current frame = 0, it's the first frame that you see. With that in mind, you know what each image's value should be thereafter. I tested it by looking at the current frame. If it was 0, I set a counter to 1. If it was 1, the counter was 2. If it was 2, the counter was 3. And so forth and so on. It worked without error for me. I would think that instead of assigning the value to a counter, you could just as easily set an alterable value in its stead.
As far as getting "the full reel to work the way it should" I'm a little confused as to what you are trying to achieve.
If you look at the youtube example I provided, the entire reel moves as one giant image. It's probably anywhere from 80-150 symbols long, but it moves as one. Whereas in this example, each reel space (Reel 1, Reel 1 top, Reel 1 bottom, etc.) cycle through symbols individually. The ones that you see in casinos (and in that Youtube video) may use the same individual symbols method, but they animate it differently to give the illusion that it's one reel. At this point, I don't know, and all my attempts ended fairly messily. I like your method for how clean it is.
Are you talking about the animation speeds, the staggering of the reels or the bounce?
Everything that you had in your example were done splendidly. I'm a big fan of the staggering reels (I was doing the same thing in my testing as well). I'm not entirely sure I understand what you mean by "the bounce" though.
I sort of understand what you are saying. I hate having to do things this way as it is really difficult to convey your meaning through words when you have it clear in your head but i'll try my best.
Ok, here we go.
Assigning an alterable value to a reel image should be easy too. If the current frame = 0, it's the first frame that you see. With that in mind, you know what each image's value should be thereafter. I tested it by looking at the current frame. If it was 0, I set a counter to 1. If it was 1, the counter was 2. If it was 2, the counter was 3. And so forth and so on. It worked without error for me. I would think that instead of assigning the value to a counter, you could just as easily set an alterable value in its stead.
This is in essence what i have done however as you said it could be done using alt. values but as I am coding this for the competition i have had to limit my use of them.
If you look at the youtube example I provided, the entire reel moves as one giant image. It's probably anywhere from 80-150 symbols long, but it moves as one. Whereas in this example, each reel space (Reel 1, Reel 1 top, Reel 1 bottom, etc.) cycle through symbols individually. The ones that you see in casinos (and in that Youtube video) may use the same individual symbols method, but they animate it differently to give the illusion that it's one reel. At this point, I don't know, and all my attempts ended fairly messily. I like your method for how clean it is.
I think i have achieved something like this in the second example i posted. You could go one step further with this and use quarter images aswell as half images but you would have to increase the spin counter accordingly.
I'm not entirely sure I understand what you mean by "the bounce" though.
If you watch the video you posted you will see that the reels bounce a little just after they stop.
--------------------------------------------------------------------------------
Assigning an alterable value...
--------------------------------------------------------------------------------
This is in essence what i have done however as you said it could be done using alt. values but as I am coding this for the competition i have had to limit my use of them.
If you don't mind, when you're done with the competition, could you describe/show what you've done? I'm all for streamlining things as long as I know how
--------------------------------------------------------------------------------
If you look at the youtube example I provided...
--------------------------------------------------------------------------------
I think i have achieved something like this in the second example i posted. You could go one step further with this and use quarter images aswell as half images but you would have to increase the spin counter accordingly.
That gives it the full reel effect, which, again, is awesome, but not the mechanic. Whereas the ones that you and I have made has the animation (or in your second example, the direction) changing frame by frame, the one from YT seems to slide - I don't know if that's just an advanced style of animation. Maybe that individual piece contains all the frames as well - Maybe it has more than one frame per symbol, but only stops at a certain one, which would cause that bounce perhaps, and would still make it look like it was sliding?
You could achieve the sliding using one hell of an animation sequence. I'll throw something together now. give me a few mins and you'll see what i mean.
I often have to stop what I'm looking at and think about the next step overnight, and you seriously come up with an answer like a second after I'm done asking the question. It's unreal.
I'm hoping this is what you were getting at, obviously it's not the full reel. It would take me ages to create it but it will use a combination of the principals used in both my previous examples:
Yep, that was pretty much what I meant, and that was mostly the way I thought it would work. I'm assuming the nudge/bounce could be achieved by picking a certain value and shifting it to the nearest full value (so instead of 2/5 Watermelon, 5/5 Watermelon, as an example). That's pretty much spot on what I was thinking, and I think that you could still use the alterable values to calculate that (or however you're using it). I'm very excited to see how your game in the competition turns out. Once you've got that up, I want to see what I can make on my end. I have a hell of an idea, and the examples you keep providing are definitely helping me see the ways that I can streamline it. Once I have something that I think would be up to snuff, I'll post my own example, and see what you think. Thanks for all your help!
register on fruit-emu.com and download a fruit machine emulator, download a fruit machine and then go into design mode, load the layout from the fruit machine you downloaded and then open the reel editor. You can save the reel images into a folder for use in other apps.
That'd be awesome. From the testing standpoint, having reels that are already available are great to work with. On top of that, it might be extra easy, with that in mind, to adjust the images with fully customized art afterward.
If you like what I have to show a few days/weeks from now, I'd be glad to collaborate on something of that nature. Like I said before, I'm much more on the creative side of things than the programming side, but the ideas that I come up with are pretty interesting most of the time.
That'd be awesome. From the testing standpoint, having reels that are already available are great to work with. On top of that, it might be extra easy, with that in mind, to adjust the images with fully customized art afterward.
If you like what I have to show a few days/weeks from now, I'd be glad to collaborate on something of that nature. Like I said before, I'm much more on the creative side of things than the programming side, but the ideas that I come up with are pretty interesting most of the time.
I have been busy beavering away on this engine and have come with what i believe to be a very customisable engine. It is only a beta so far as some of the features are not coded in yet and is undergoing a rewrite to be adaptable for most ideas that people have, but here you are. Take a look at this:
More modifications made to streamline the code. I've really enjoyed doing this and i'm gonna start a project page soon. Michael i'll add you if you want as you have helped push me to the point i have got to now.
The project i have in mind is an All-in-one Fruit Machine Player and Creator or AiO-FruMPlaC (name to be decided) for short. The Creator allows you to specify the number of reels, the number of images on the reels, which images and other such things. I have attempted something similar inn the past with another genre but didn't get very far (due to lack of interest on my part).
I think that's incredibly robust for something so small. I like it. It gives people a lot of options, and I can't wait to see it through to its completion. Add me if you'd like, but don't feel like its a necessity. I feel satisfied just knowing that I played a minor inspiration, haha!