Link to home
Start Free TrialLog in
Avatar of painkil
painkil

asked on

roulette games?

Hi i want to know how to make a roulette game.I mean how to generate the numbers 0-36 map on an image and also which programming language its better to do it.thanks
Avatar of bcladd
bcladd

(1) Language: What language(s) do you know already? Almost without exception the answer to the question of which language should you use is what language do you know or would you like to learn. Okay, some languages are better at some things than others. You want interactive graphics.
  - Perl with Perl/Tk can draw buttons, images, and all of that. Users need a copy of Perl on their machine.
  - Java is cross platform (so is Perl/Tk), draws pictures and buttons and stuff, and users will need a copy of Java on their machine (lots of people have Java on their machine)
  - Flash and its programming language are almost designed to make this sort of thing; user needs Flash display program (and it is, to an extent, cross platform).
  - C++ is compiled into an executable program so it could be stand-alone. A given executable would NOT be cross platform (you COULD write it so that it worked on multiple platforms but any given executable would only work on one class of computers).
  - Squeak is a "visual" successor to Smalltalk. It is crossplatform, interpreted (they need a copy of Sqeak to run on a computer), and has a whole lot of graphics routines. It can be overwhelming to use for someone who uses another programming language but it can also make really pretty games.

(2) Random numbers: Depends on the language. Most modern languages support a random number generating funciton. Note that the sequence is not actually random, only pseudorandom with a very long period. Typically you can get a "random" number on some range, say 0 to 10000000. Then you figure out how to quantize the value to your desired range (many languages will even give you a number on the range 0-n-1 with a call like random(n)). So this is a specific question for the language manual

(3) Map it onto an image: Assume image is a picture of a wheel (with an appropriate alpha channel), you can use rotation to rotate the image about its center. Again, exactly how this is done depends on which programming language you use. In Java an AffineTransform could be applied before drawing the image with the amount of rotation set by which section should be at the top. Changing the amount of rotation every frame would permit you to animate the wheel spinning. Note that depending on size of the image and amount of memory on your target platform, you might want to prerender the various frames of th wheel (applying an affine transformation is expensive in terms of CPU time).

Different languages, different mechanisms for setting the rotation with which to draw the image.

Note that the above assumes you want the game to run directly on the user's computer. If you are going to put this on a Web page, then things are more interesting. Java, Flash, and Squeak have plug-ins for many browsers.

Hope this gives you some ideas on where to start.

-bcl
Avatar of painkil

ASKER

which one can i used to be controlled  remotely and also be used for a touch screen?
ASKER CERTIFIED SOLUTION
Avatar of bcladd
bcladd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial