• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Viking

[java] Random numbers in JDK 1.1

7 posts in this topic

Hello, I use random numbers in one of my applets I am currently developing. I am using Forte4Java and everthing works fine. But when it comes to open the file in the browser I fail to get it going. As far as I figured it out the line (I snipped the rest) int diceRoll = r.nextInt(maxNumber) + 1; is the problem. Anyone got an idea how to get around this? thanks in advance Juergen
0

Share this post


Link to post
Share on other sites
1.1 doesn''t have any method

java.util.Random.nextInt(int n);

only

java.util.Random.nextInt();

Here''s how java 1.2 does it''s nextInt(int n) method


public int nextInt(int n) {
if (n<=0)
throw new IllegalArgumentException("n must be positive");

if ((n & -n) == n) // i.e., n is a power of 2
return (int)((n * (long)next(31)) >> 31);

int bits, val;
do {
bits = next(31);
val = bits % n;
} while(bits - val (n-1) < 0);
return val;
}

0

Share this post


Link to post
Share on other sites
Get Jdk 1.2 or 1.3, you are wasting your time with 1.1

and if you are going to use the random method, don''t forget to import java.util.* unless you like to type
0

Share this post


Link to post
Share on other sites
I''m not too awful sure which version this comes from, but the Math class has a psuedo random number generating function.. it''s just Math.random() If you are looking for a more sophisticated random number generation technique, like a guassian there is the Random class, where you can use
Random.setSeed(long seed); and
Random.nextGaussian();

But like I said I''m not sure which version of the java sdk supports this.

War doesn't determine who is right, war determines who is left.
0

Share this post


Link to post
Share on other sites
Thanks for your help. I know I am wasting my time with JDK 1.1 and I already code in JDK 1.3. But as I mentioned earlier I am about to write an applet and AFAIK Netscape 4.7 and IE 5.01 only support JDK 1.1 (well to be exact: the JVM only supports JDK 1.1)

I downloaded and tried the Mozilla browser and the JVM update for IE and now it works on both browsers. BUT I have to ask: Do I really want users of my applet have to download plug-ins or new browsers just to get it going ?

I have no idea when I will be finished with the applet - maybe the JVM''s of the browsers support JDK1.2+ until then :-)

thanks again for your help

Juergen
0

Share this post


Link to post
Share on other sites
1.3 comes with the Java Plugin so you can run Java2 classes in a standard browser. Get the HTML converter to change your web pages to use the plugin.

http://java.sun.com/products/plugin/1.3/features.html

IMHO, coding in 1.1 is not a waste of time if you need to run applets without plugin. It is a deployment issue. A pluggable design that runs under 1.1 or Java2, but takes advantage of Java2 features if it is present may be a good move for you. (The beauty of dynamic class loading...)

ManaSink
0

Share this post


Link to post
Share on other sites
I have to agree with ManaSink, JDK 1.1 definitly isn''t a waste of time. IMO most people don''t want to download a plugin and you can still achieve the same effects with 1.1 as you can with most of the other SDK''s it just depends on how much time you want to spend writing compatible code. ^_^ my $.02

War doesn't determine who is right, war determines who is left.
0

Share this post


Link to post
Share on other sites
And if they guy that signs your checks uses a Mac, you can''t very well tell him to "go get the plugin" when there isn''t a 1.2 plugin for macs. Well, you can, but that usually results in you not getting paid.
0

Share this post


Link to post
Share on other sites