Solved

roulette games?

Posted on 2004-04-26
3
799 Views
Last Modified: 2013-12-04
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
0
Comment
Question by:painkil
  • 2
3 Comments
 
LVL 11

Expert Comment

by:bcladd
Comment Utility
(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
0
 

Author Comment

by:painkil
Comment Utility
which one can i used to be controlled  remotely and also be used for a touch screen?
0
 
LVL 11

Accepted Solution

by:
bcladd earned 125 total points
Comment Utility
(1) "controlled remotely"? What do you mean? You want to pick the numbers for the wheel from somewhere else? Or do you mean that you want one game to be played (viewed) from multiple machines? Most of these languages support networked communications with libraries (that are often part of the shipping language). Java has the NIO (new input/output) libraries, Perl has been network aware forever, Squeak has network libraries, C++ has network libraries.

(2) Touch screen: What is the target platform? If the touch screens are on Linux/Windows/Mac computers then I would bet that their drivers act pretty much like mice. Then most of these languages would work with the touch screen. If you're talking about mobile devises then I would look at J2ME, the mobile edition of Java. If it is ported to the device, it can probably use the IO of the device.

Hope this helps,
-bcl
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Surprisingly, there is a lot to Gym battles, and I thought it would be helpful to share knowledge about all the ins and outs of this feature!
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now