Show Posts
|
|
Pages: [1]
|
|
4
|
Discussions / General Discussions / Re: Which Compiler do you use to Make games ?
|
on: 2009-05-05 15:58:01
|
Eclipse 3.2 Sun JDK 1.6 Features that I really appreciate: autocomplete, easy refactoring, incremental compiling, tooltip class help, plugins! (like for SVN), the fact that you can edit, compile, build, version, debug, and deploy from one GUI... There's more but that's what comes to mind. It definitely makes me more productive. Caveats: You can find these features in other IDEs, of course. Also, there are some people who really prefer using CLIs and scripting everything themselves, which in some cases, results in quicker results than IDEs doing the same work --- since the scripts don't usually have a lot of overhead code. Bottom line, just experiment and find what works best for you. It's nice to have choices... 
|
|
|
|
|
6
|
Game Development / Newbie & Debugging Questions / Re: Problem Changing Scene on Timer Event
|
on: 2007-11-05 19:36:44
|
Could you post the relevant code? Here is some sample code that uses a timer to send repaint events to a JFrame at a specified interval. It alternates the color of some text on the window with each update. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| import java.awt.Color; import java.awt.Graphics; import java.lang.reflect.InvocationTargetException; import java.util.Timer; import java.util.TimerTask;
import javax.swing.JFrame; import javax.swing.SwingUtilities;
public class TimerTest implements Runnable { JFrame f = new MyFrame(); int repaintCount = 0; public static void main(String[] args) { try { SwingUtilities.invokeAndWait(new TimerTest()); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
public void run() { f.setBounds(0, 0, 500, 500); f.getContentPane().setBackground(Color.BLACK); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.setIgnoreRepaint(true); Timer t = new Timer(true); t.scheduleAtFixedRate(new MyTimerTask(), 0, 250); }
private class MyTimerTask extends TimerTask { public void run() { f.repaint(); repaintCount++; } } private class MyFrame extends JFrame { public void paint(Graphics g) { super.paint(g); Color c = (repaintCount % 2 == 0) ? Color.RED : Color.BLUE; g.setColor(c); g.drawString("THIS IS A TEST", 200, 240); g.dispose(); } } } |
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: Enum in Java 6 on eclipse
|
on: 2007-11-03 03:07:40
|
|
If you can post the error(s) you see and the code you are using, that would help. My suspicion, though, is that your compiler compliance level isn't set correctly.
Right-click on the project and choose Build Path -> Configure Build Path. On the window that appears, click on the Java Compiler entry and then look at your Compiler Compliance Level. Is it 6.0? If not, try setting it to 6.0 and see if that helps.
|
|
|
|
|
8
|
Discussions / General Discussions / Re: subtle blips while playing java games?
|
on: 2007-11-02 02:32:12
|
|
To figure out the JVM version, run the java command with the -version option:
java -version
Also, you can supply the following options (if you're running the Sun HotSpot JVM) if you want to correlate GC operations to the blips you are seeing:
java -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
|
|
|
|
|
9
|
Discussions / General Discussions / Areas of study or book suggestions for mathematics for 3D programming?
|
on: 2007-10-29 18:40:53
|
|
I'm pretty new to 3D programming. I know there are books out there that cover the Java APIs that handle 3D operations, but I'm interested in any recommendations for good books that helped you to understand the math behind or in front of the code.
For lack of book suggestions, what areas of mathematics should I study to get a good grasp of the math behind 3D concepts?
|
|
|
|
|
10
|
Java Game APIs & Engines / OpenGL Development / Re: Help with LWJGL?
|
on: 2007-10-27 18:38:35
|
|
I haven't used NetBeans or JCreator, but I have seen errors like those before...
The first error is a classpath issue and so if you can find a way to configure the classpath for the java command that is used to run the code, I think it may resolve the issue.
The second error looks like it has to do with a file path that uses spaces. Notice how the error message cut off the path right after C:\Documents? If you can quote the path, as in... java -classpath "C:\Documents and Settings\eng06itara\Game\build\classes" (full name of class w/package), it should work.
As I said, I haven't used those IDEs and so hopefully someone can answer for those specifically, but I thought these suggestions might help you.
|
|
|
|
|
11
|
Discussions / General Discussions / Re: Useful Design Patterns for Games
|
on: 2007-10-27 09:14:26
|
Thanks for your responses. purpleguitar, I found that javaworld article very interesting, even came with examples.  I'm going to make some adjustments to my code to reflect what I've learned. I don't have access to the paper you mentioned and so no joy there. JonathanC, I'm trying to learn more about game implementations and design patterns at the same time. For me, it's sometimes difficult to realize the benefits of a design pattern from dry descriptions of the design patterns themselves, as you might find in some books. I was also hoping that I could narrow my focus for which patterns to better study. I understand what you are saying about not trying to force patterns into a game, but I think there must be a common set of design patterns that are naturals for the various parts of common game types.
|
|
|
|
|
12
|
Discussions / General Discussions / Useful Design Patterns for Games
|
on: 2007-10-26 12:36:57
|
|
Would anyone care to share which design patterns they found useful in game development and what problem those patterns solved in their games?
For example, the Template Method design pattern could be useful for a reusable game loop template because game loops are so similar between games.
|
|
|
|
|
14
|
Discussions / General Discussions / Re: Java Gaming book
|
on: 2007-10-25 11:44:27
|
|
In the previous post, I mentioned that the author of "Killer Games..." was *writing* another book. As you can see from the links, it's been out for several months. Sorry about the confusion.
|
|
|
|
|
16
|
Java Game APIs & Engines / Tools Discussion / Re: A Java update came out. Do I need to update files and environment variables?
|
on: 2007-10-25 04:07:14
|
|
You should be able to tell from the Package Explorer window in Eclipse whether your projects are now using the new JRE. If not, you can right-click on the JRE listing, click configure, and browse your way to the new JDK directory.
In terms of changing anything, you probably won't have to if you haven't hard-coded any JDK paths yourself anywhere (e.g. in an Ant build file).
If you're upgrading from 1.5 or earlier, you might want to check the setting for your compiler compliance level (Build Path -> Configure Build Path -> Java Compiler -> Compiler Compliance Level) and adjust it as you see fit...
|
|
|
|
|
17
|
Game Development / Newbie & Debugging Questions / Re: Thread.sleep accuracy?
|
on: 2007-10-22 02:52:47
|
|
Thanks DzzD (and others) for your responses. I did try your suggestions and was able to get a steady rate of 10 millisecond waits.
I'm still playing around with which changes made the most difference, but I had to apply almost all of them to get the desired result
I will also include the Thread.sleep call and see if I can reproduce the problem from before.
|
|
|
|
|
18
|
Discussions / Business and Project Discussions / Can independent Java game developers make a buck (or two)?
|
on: 2007-10-21 21:12:53
|
|
My question concerns whether an independent developer creating Java games can make enough income to sustain themselves (and a family) in an age where there are millions of dollars spent on console and computer games, with huge teams of developers, artists, musicians, and others...
I'm starting on a path to write Java games and (hopefully) either sell them on the web or host a site that offers them for free at the expense of users having to deal with advertisements. Pretty standard stuff, I think.
It's been my dream to write games for a long time, and I'm very excited to finally start. However, how realistic is my vision?
For any indy developers out there, please let me/us know your experiences in this department...
|
|
|
|
|
19
|
Discussions / General Discussions / Write once, run anywhere --- with Java games?
|
on: 2007-10-21 20:56:57
|
|
I'm curious if anyone is willing to share their experiences with the areas of pain while trying to make sure that their Java games ran correctly across platforms, such as Mac OS, Linux, and Windows XP? What kind of compromises needed to be made, if any?
Also, are there any statistics to show what platform is used most to run Java games?
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Re: Thread.sleep accuracy?
|
on: 2007-10-21 20:43:46
|
I'm using Linux (kernel 2.6.2.2) and I thought I read that the timer that Thread.sleep uses has a 1 millisecond resolution time on that platform. However, I took Thread.sleep out of the equation completely, and I'm still not getting constant results, which leads me to believe that unless others can reproduce these numbers that it must be something specific to the OS or the JRE and System.nanoTime/System.currentTimeMillis call on this platform that's problematic. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public class ClockTest { public static void main(String[] args) { for (int i = 1; i <= 20; i++) { long start = System.nanoTime(); long delay = start + 10000000; while (System.nanoTime() < delay); long end = System.nanoTime(); System.out.println("Attempt " + i + ": " + ((end - start) / 1000000) + " millsecs"); } } } |
Attempt 1: 10 millsecs Attempt 2: 10 millsecs Attempt 3: 10 millsecs Attempt 4: 10 millsecs Attempt 5: 10 millsecs Attempt 6: 17 millsecs Attempt 7: 10 millsecs Attempt 8: 10 millsecs Attempt 9: 10 millsecs Attempt 10: 10 millsecs Attempt 11: 17 millsecs Attempt 12: 10 millsecs Attempt 13: 10 millsecs Attempt 14: 10 millsecs Attempt 15: 10 millsecs Attempt 16: 16 millsecs Attempt 17: 10 millsecs Attempt 18: 10 millsecs Attempt 19: 10 millsecs Attempt 20: 10 millsecs
|
|
|
|
|
21
|
Game Development / Newbie & Debugging Questions / Re: Thread.sleep accuracy?
|
on: 2007-10-21 05:12:23
|
Orangy, I tried your suggestion but I'm still not getting the constant timing delay that I would need, for example, for a game or rendering loop. I even switched from a 5 to a 10 millisecond delay. (broumbroum, I also tried setting the main thread to the max priority without good results either.) My system resources utilization is very very low: CPU, memory, disk I/O all very low usage. I don't know what the kernel scheduler time slice per process is, don't know what the Java scheduler time slice is per thread (using the Sun HotSpot JVM), and haven't turned on GC logging to know what GC activity is happening --- but I'm assuming that a steady 10 millisecond delay rate should be achievable. With a 10 millisecond slice of time, the game loop would proceed at 100 cycles per second, which sounds like a reasonable number. If the problem is really the OS process scheduler or the JVM thread scheduler (e.g. with time it's giving to the GC native thread), how are other Java games achieving any kind of constant frame rate? Are their threads using Thread.sleep at all? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public class ClockTest { public static void main(String[] args) { for (int i = 1; i <= 20; i++) { long start = System.currentTimeMillis(); long delay = start + 10; try { Thread.sleep(0); while (System.currentTimeMillis() < delay); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1);; } long end = System.currentTimeMillis(); System.out.println("Attempt " + i + ": " + (end - start) + " millsecs"); } } } |
Results: Attempt 1: 10 millsecs Attempt 2: 13 millsecs Attempt 3: 10 millsecs Attempt 4: 10 millsecs Attempt 5: 10 millsecs Attempt 6: 11 millsecs Attempt 7: 10 millsecs Attempt 8: 10 millsecs Attempt 9: 10 millsecs Attempt 10: 10 millsecs Attempt 11: 20 millsecs Attempt 12: 10 millsecs Attempt 13: 10 millsecs Attempt 14: 10 millsecs Attempt 15: 10 millsecs Attempt 16: 10 millsecs Attempt 17: 10 millsecs Attempt 18: 10 millsecs Attempt 19: 10 millsecs Attempt 20: 10 millsecs
|
|
|
|
|
22
|
Game Development / Newbie & Debugging Questions / Thread.sleep accuracy?
|
on: 2007-10-21 00:30:16
|
I'm new to game development with Java and I've noticed some odd behavior with Thread.sleep. It seems that the accuracy of Thread.sleep is suspect. Take the following code as an example... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| public class ClockTest { public static void main(String[] args) { for (int i = 1; i <= 20; i++) { long start = System.currentTimeMillis(); try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } long end = System.currentTimeMillis(); System.out.println("Attempt " + i + ": " + (end - start) + " millsecs"); } } } |
...which produces... Attempt 1: 6 millsecs Attempt 2: 6 millsecs Attempt 3: 5 millsecs Attempt 4: 5 millsecs Attempt 5: 5 millsecs Attempt 6: 5 millsecs Attempt 7: 5 millsecs Attempt 8: 5 millsecs Attempt 9: 5 millsecs Attempt 10: 5 millsecs Attempt 11: 21 millsecs <-- ouch Attempt 12: 5 millsecs Attempt 13: 5 millsecs Attempt 14: 5 millsecs Attempt 15: 5 millsecs Attempt 16: 5 millsecs Attempt 17: 6 millsecs Attempt 18: 5 millsecs Attempt 19: 5 millsecs Attempt 20: 5 millsecs I'm using the 1.6.0_01 JDK under Linux (Intel single core CPU). As you can see, sometimes, Thread.sleep can take over 4x the amount of time requested. Most of the time, it seems that it can handle a 5 millisecond request time, and so it's not that the OS time facilities that the JVM uses can't handle that small of a resolution. It would seem that other factors are involved... maybe JVM native threads (e.g for garbage collection)Huh Can anyone explain the difference in the numbers? Also, how do you release CPU time to other threads (e.g. the AWT thread) while still being able to keep a constant frame rate if Thread.sleep durations are not consistent?
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|