Show Posts
|
|
Pages: [1] 2 3 ... 5
|
|
2
|
Game Development / Game Play & Game Design / Re: Game name and artwork
|
on: 2011-07-26 17:18:27
|
I kinda like those names, do you have any more?  You gotta be kidding me : D Wouldn't put any of those names on anything serious, but they make great temporary names  I kinda like those names, do you have any more?  Uh, gimme a theme or something and I can come up with one?  Uhm, how about: you get shrinked down to about the size of a bloodcell. Then you have to enter another person's body and eliminate the evil virus inside him to save him/her?  However, to reach the final boss you have to collect five sacred stones which are guarded by their own boss. Or something like that.
|
|
|
|
|
4
|
Discussions / General Discussions / Re: Eclipse vs. Netbeans
|
on: 2011-07-10 09:54:03
|
The choice of IDE's really comes down to personal choice. I do all my game development on a Linux netbook, and I've noticed that Eclipse preforms far better than Netbeans. Netbeans is suppose to have a nifty Swing designer for fast GUI apps, but it always seemed kinda clumsy.
On my netbook it's the opposite: eclipse is slow while netbeans is much faster 
|
|
|
|
|
7
|
Java Game APIs & Engines / OpenGL Development / libgdx vertex attribute naming?
|
on: 2011-06-05 21:30:44
|
Hi guys! I just started looking into libgdx and OpenGL (ES 2). Once I felt comfortable with rendering some easy, basic shapes I decided to try to import a .obj file. The file loaded fine, however it wouldn't render at all. So I started digging in the source code for the ObjLoader and found that the loader names the attributes as "a_Position" and "a_TexCoord" while both the tutorials and the SpriteBatch class names them "a_position" and "a_texCoords". Doesn't that break functionality since the wrong variable names get sent to the shaders? The model rendered (kinda) when I manually edited the attribute to "a_position" after loading the model. I don't know, maybe I'm wrong and it's supposed to be like this? If so, please explain why. cross-post: http://badlogicgames.com/forum/viewtopic.php?f=11&t=1202
|
|
|
|
|
11
|
Game Development / Newbie & Debugging Questions / Re: How does java handle Threads?
|
on: 2011-05-23 17:19:05
|
What is double-checked locking?
Short story: Using lazy initialization to init a field by checking if the field is null twice (first one is outside a synchronized block, the second is inside a synchronized block) to make sure the field only gets initialized once. Kinda like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| class Foo { private Helper helper = null; public Helper getHelper() { if (helper == null) { synchronized(this) { if (helper == null) { helper = new Helper(); } } } return helper; }
} |
It may seem to be correct code, but that code can go very wrong since the compiler can re-arrange instructions. Making the helper field volatile will solve this problem though. Longer story: Wikipedia and Google
|
|
|
|
|
12
|
Game Development / Newbie & Debugging Questions / Re: How does java handle Threads?
|
on: 2011-05-23 09:27:39
|
Math holds 1 instance of Random. Here is the code inside Math.random: 1 2 3 4 5 6 7 8 9
| public static double random() { if(randomNumberGenerator == null) initRNG(); return randomNumberGenerator.nextDouble(); }
private static synchronized void initRNG() { if(randomNumberGenerator == null) randomNumberGenerator = new Random(); } |
Does anyone know why Math.random() uses double-checked locking? I read that dcl can cause very unexpected behaviours (like assigning a reference to an object before the constructor has run)
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Re: True Type Font problem
|
on: 2011-05-21 12:17:04
|
1
| return Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(24); |
The reason to why that line doesn't work is because you are calling Font.deriveFont(int style); instead of Font.deriveFont(float size); You have to append an f to the parameter (to make it 24f instead of just 24) in order to call the right method.
|
|
|
|
|
17
|
Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game
|
on: 2011-05-08 15:42:58
|
|
For the size problem, try calling (in Snake.java) setResizable(false); before you call pack();
Also, I would recommend you to use BufferedImage instead of Image. They work pretty much the same way (you paint them using the same methods), but Image is a very old class and it is outdated.
|
|
|
|
|
18
|
Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations
|
on: 2011-05-07 17:01:33
|
To op: I see what you mean by that weird rotation thingy, it does seem like when you rotate around the x-axis, the y and z axis switch places with each other. I haven't worked with opengl that much before, but wouldn't it be better to just have one glRotatef call? Like glRotatef(1.0f, rotX, rotY, rotZ); or something like that.
Maybe, but from what I understand is that glRotatef(angle, x,y,z) where angle is the angle of rotation, and x,y,z is either 1.0f or 0.0f, depending if you want to rotate that angle on that axis. The problem is that the angle for each axis is not the same, say maybe I want to rotate 90 degrees on the X-axis, but 180 degrees on the Y-axis. Maybe, I just heard somewhere that you should minimize your calls to opengl. I should probably let someone more experienced answer this though 
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations
|
on: 2011-05-07 16:40:59
|
I get a NullPointerException in org.lwjgl.opengl.GL11.glShadeModel() at line 160 in rubikEngine.Engine.initGL() I also get a RuntimeException saying "Image based resources must be loaded as part of init() or the game loop. They cannot be loaded before initialisation." (haha they misspelled initiali zation) This was thrown inside the Slick library at line 426 in rubikEngine.Engine.loadTextures() Hope that helped  The game worked fine here on W7. To op: I see what you mean by that weird rotation thingy, it does seem like when you rotate around the x-axis, the y and z axis switch places with each other. I haven't worked with opengl that much before, but wouldn't it be better to just have one glRotatef call? Like glRotatef(1.0f, rotX, rotY, rotZ); or something like that.
|
|
|
|
|
22
|
Game Development / Newbie & Debugging Questions / Re: Minor confusion about booleans
|
on: 2011-04-30 23:29:07
|
I expect he means he wants to call a method with a void return type.
Exactly! What if both are true? That if-case means "if either a or b is true, run this block". Since both of them are true, it will run the block. The only way to make it not run the block is if both a and b are false.
|
|
|
|
|
26
|
Games Center / Archived Projects / Re: Archer Vs Zombies
|
on: 2011-04-13 19:21:55
|
Could you please release an applet or a normal desktop application (.jar file). I tend to avoid webstart applications since they clutter the add/remove programs list. But by judging from video this may end up pretty nice 
|
|
|
|
|
30
|
Game Development / Newbie & Debugging Questions / Re: Where are my pixels!!???
|
on: 2011-03-25 20:47:36
|
the problem is that my red rectangle right and bottom lines does not appear, as my original code in the first post. The best I could do was: 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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| import java.applet.Applet; import java.awt.Color; import java.awt.Dimension; import java.awt.Frame; import java.awt.Graphics; import java.awt.Image; import java.io.File; import java.io.IOException;
import javax.imageio.ImageIO;
public class Game extends Applet {
private boolean isApplet;
private Image image;
public Game() { this.isApplet = true; this.setPreferredSize(new Dimension(640, 480)); }
public void init() { this.setPreferredSize(new Dimension(640, 480)); this.setSize(new Dimension(640, 480)); }
public void paint(Graphics g) { g.setColor(Color.black); g.fillRect(0, 0, 640, 480);
g.setColor(Color.red); g.drawRect(0, 0, 640, 480);
g.drawImage(image, 0, 0, null); g.setColor(Color.green); g.drawLine(0, 0, 640, 480); }
public void update(Graphics g) { }
public void buildFrame() { Frame f = new Frame("Game"); f.add(this); f.pack(); f.setVisible(true);
f.setLocationRelativeTo(null);
System.out.println(f.getInsets().bottom); System.out.println(f.getInsets().top); System.out.println(f.getInsets().left); System.out.println(f.getInsets().right); System.out.println(f.getWidth());
f.setSize(640 + f.getInsets().left + f.getInsets().right + 1, 480 + f.getInsets().top + f.getInsets().bottom + 1);
try { image = ImageIO.read(new File("image.png")); } catch (IOException e1) { e1.printStackTrace(); }
this.isApplet = false; this.init(); }
public static void main(String[] args) { Game g = new Game(); g.buildFrame(); } } |
Using those insets() worked a little bit better but I still had to add a magic number (+1) there. Now running application mode in both Linux and Windows get almost the same result. There shouldn't be a problem in Applet mode, since you've got the entire viewing area to paint
Have you tried my code and run as applet? Even running as applet in both Windows and Linux I'm not able to see right and bottom lines of the red rectangle. 1
| <applet code=Game width="640" height="480"></applet> |
This is really weird, in fact, I haven't stopped to check this before... but it'd be nice to have one solution for both applet/application modes... any other tips? thanks When you tried my code, did you remove the f.setSize... part? Since f.pack() automatically calculates (and sets) the size of the frame needed to properly display all components. Also try what Abuse just said.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|