Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 39
1  Discussions / General Discussions / Re: JDK: upcoming features on: 2013-05-21 22:09:50
Well I got too disappointed by how the java developers added features. Really. Probably they had no choice, but making it like that, but it's still ugly. I hate the new Lambdas in JDK 8, for example. They're nothing but little syntax sugar (+ clojures, but you can fake them very easy too).

So in JDK 8 it's like that:
1  
2  
3  
4  
5  
// main:
int result = 0;
new Thread(() -> {
    result = 5;
}).start();


And in JDK 7 it could be translated like that:
1  
2  
3  
4  
5  
6  
7  
8  
9  
class Clojure {
    int result = 0;
}
final Clojure clojure = new Clojure();
new Thread(new Runnable() {
    public void run() {
        clojure.result = 5;
    }
}).start();


So I started switching to scala.
1  
2  
var result = 0
new Thread(() => result = 5).start();

Or much cooler stuff:
1  
2  
3  
4  
List("Hello", " ", "world").foreach(println)
// prints "Hello world"
"Hello world".split(" ").foreach(println(_ + " "))
// prints "Hello world "

Anyways, enough code rambling, also, lambdas aren't the only thing which made me switch to java. Also, I started learning scala and scheme before trying out JDK 8 lambdas. And they pretty much disappointed me. They're still explicit classes. Really? :/

One last thing I'd like to show, which is always handy for me Wink
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
def time(thunk: => Unit) = {
  val begin = System.currentTimeMillis()
  thunk
  System.currentTimeMillis()-begin
}
val timeInMillisceconds = time {
  computePi()
}
// or:
val timeInMilliseconds = time(computePi)

So, KTHXBYE Smiley
2  Game Development / Networking & Multiplayer / Re: [KryoNet] 'Field not declared as byte: 0' on: 2013-05-21 15:56:22
No, impossible, I use the same codebase for both client and server...
3  Game Development / Networking & Multiplayer / [KryoNet] 'Field not declared as byte: 0' on: 2013-05-21 12:49:15
I'm getting an Exception I've not got before, after I added another type of Message (simply a class for me):
Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: Field not declared as byte: 0
   at org.matheusdev.ror.net.packages.CreateEntityFieldAccess.getByte(Unknown Source)
   at com.esotericsoftware.kryo.serializers.FieldSerializer$ByteField.write(FieldSerializer.java:403)
   at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:213)
   at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:571)
   at com.esotericsoftware.kryonet.KryoSerialization.write(KryoSerialization.java:50)
   at com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:192)
   at com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:59)
   ...


But what does that mean?

In my game all Messages extend one class
NetPackage
. I've changed it to include some info like that:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public abstract class NetPackage {

+   public static final byte TCP = 1;
+   public static final byte UDP = 2;

    public long time = 0;
+   public byte type = 0;

    public NetPackage() {
    }

    public NetPackage(long time, byte type) {
        this.time = time;
+       this.type = type;
    }
}


Now I get that exception (which says nothing useful to me, btw), and I don't know why. I simply sent a subclass of NetPackage (both classes are registered, I checked it) over TCP to the Localhost on a port which worked all the time before...

What's wrong?
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] Linking a Sprite (Or another image) to a Box2D Body on: 2013-05-21 11:49:15
I'm asking because I'm interested in how to utilize userData...

Usually it's used for storing the java side object representing the Entity. When a collision happens, the Entity should be notified. But upon collision, you only get the Box2D Body, so you have to save user data (the entity to call the #collide(Entity) method) Smiley
5  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-05-19 22:40:31
That's weird, are you using the jar or the package ? If you're using the jar, how do you launch it ( double click, command line, from what folder .. ) for the game ? The game is reading from the current directory so if you launch using for instance "java -jar ./download/daedalus.jar" it should try to load from the wrong folder.
This is something I may be able to fix .. have to figure out how Smiley

Err, no, I'm starting with the daedalus.sh file Smiley

by 3 types you mean normal/burn/light ? ( by the way I should remove "light" blending as it's almost never usefull Smiley )

I was talking about the three smoke textures, but actually I don't even know any other kind of texture which could be useful Cheesy
6  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-05-19 18:37:42
I've now tried myself at creating a map, a little bit Smiley


Awesome stuff! Smiley

It has to be noted, that whenever you create a map and the editor saves it. If it's not inside ~/.shoot/res/maps, then you need to move it there (from relative to the executable directory from the editor).

Else, you can't choose that map Smiley

Also, loved making particle effects! Even tough there are only 3 different types available.
7  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-05-19 16:47:44
Awesome! I'm still a big fan of this game, voted on greenlight, and downloading at the moment! Can't wait to play again! Smiley
8  Games Center / Cube World Projects / Re: A different Cube World on: 2013-05-19 11:02:53
How the f**k does the system I used look isometric, seriously;

rotate by 45° along the up axis, and you'll still have an isometric setup.
It's a terminology. Afaik the Pokemon graphics were called isometric, too, for example.
9  Game Development / Newbie & Debugging Questions / Re: 2D Isometric View on: 2013-05-19 10:59:35
Wow... with that you could...
actually make a rotating isometric viewport, by simply rotating the axes!

But in the end you'd probably be better off with letting opengl do that kind of stuff, but still very, very cool! Smiley
10  Game Development / Shared Code / Re: Entreri 1.7 Released (Entity-Component Framework) on: 2013-05-19 10:55:06
This is really interesting. All those names for the Entity component frameworks are always so special: Artemis, Apollo, Entreri. What's going on? Cheesy

Anyways, the example looks very cool, and - in contrast to other entity frameworks mentioned above - you have a very special iterating concept, which looks really cool and well designed. Good work!

Didn't check it out completely yet, though.
11  Game Development / Newbie & Debugging Questions / Re: 2D Isometric View on: 2013-05-18 23:33:12
Awesome! understood that, really awesome...! Smiley

Do those axis vectors need to be normalized, or is it okay to have them un-normalized, or what would be the effect of having them big? The values scale?
So If I have Vec(10, 0) for x and Vec(0, 10) for y, and I'd convert Vec(1, 1), I'd get Vec(10, 10)? (scaled?)
12  Game Development / Newbie & Debugging Questions / Re: STILL having trouble determining which side collided.. on: 2013-05-18 22:00:59
I just jumped into the discussion, but...

There is some very, very, simple trick:
1. Move object on x axis by the amount it wants to move
2. check whether collides, if true => collision on x axis

3. Move object on y axis by the amount it wants to move
4. check whether collides, if true => collision on y axis

That's it Smiley
Hope it helps. Not got that much time to read atm...  Undecided
13  Game Development / Newbie & Debugging Questions / Re: 2D Isometric View on: 2013-05-18 20:56:01
You can also use vector math. I have some Scala code here that shows how to translate coordinates in any arbitrary coordinate system into screen coordinates and back.
http://pastebin.com/qKjxeCPj

YES! Another scala guy! Awesome!

<edit>what exactly do the second and third argument for the CoordinateSystem mean?</edit>
14  Game Development / Newbie & Debugging Questions / Re: 2D Isometric View on: 2013-05-17 19:20:08
Very, very, very helpful read:
http://www.java-gaming.org/topics/drawing-isometric-tiles-inside-a-screen/24922/msg/212780/view.html
15  Java Game APIs & Engines / OpenGL Development / Re: Shader Program Fatal Error on: 2013-05-17 16:54:55
This:
1  
glEnable(GL_BLEND);

(above needs ordered rendering (back to front, back drawn first))
or, when you only want to have the functionality to simply discard transparent pixels and have to semi-transparency (no need for ordered rendering):
1  
2  
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f);

hope this helps Smiley
16  Game Development / Articles & tutorials / Re: Real 4D World Rendering on: 2013-05-17 16:46:53
@DQQAYME:
If you wonder how to make those awesome-looking headers (the blue font), use headers:
1  
2  
3  
4  
5  
6  
/*
[h1]Top header, it's big[/h1]
[h2]Second header, slightly smaller[/h2]
[h3]Third header[/h3]
[h4]Fourth header, not available[/h4]
*/

The result is:

Top header, it's big


Second header, slightly smaller


Third header


[h4]Fourth header, not available[/h4]
17  Game Development / Articles & tutorials / Re: Real 4D World Rendering on: 2013-05-16 16:37:42
I tried to correct your typos and grammar errors in your article, it's such a high level in terms of math and understanding, but such a low level in English...
I'm not native English speaker myself, so it's not 100% right Smiley

I don't know if it's even possible to modify Article posts, but here it is:

What is the 4th dimension and how to program it =)


Let's start simple.

1st dimension:


Imagine a corridor.
It's simply a line, you can look into 2 directions: forwards or backwards.
In a program this would be a 1-dimensional array, i.e.
int[x]


2nd dimension:


Imagine a corridor that has doors to rooms.
The line we had before can now have many more lines (or corridors / rooms) along the walls of the corridor.
You see can now look into 4 directions: forwards, backwards, left, right.
In a program this would be a 2-dimensional array (an array of arrays):
int[x][z]

For rotating we use one defining angle and sin and cos:
  • Sin = first and second direction (forwards, backwards)
  • Cos = third and fourth direction (left, right)

In different angles we move into different directions:
  • angle 90°: x+
  • angle 180°: x-
  • angle 0°: z+ (<- Huh Both this and the one below were "-" before)
  • angle 90°: z-

3rd dimension:


Imagine a building, which has floors, which have corridors with rooms and doors to them.
You can look into 6 directions: forwards, backwards, left, right, top and down.
In a program this would be a 3-dimensional array:
int[x][z][y]

For rotating we use 2 defining angles:
Sinus for up and down and
Cos for the XZ plane.

More dimensions


Every new dimension adds a new Plane, which has 2 sides.
We only see a particular direction, if we look into it's angle.
To show the effect, we give those directions (sides) different colors.
If you look diagonal in 3D by 2 angles, we can see 3 sides:
Green Y, Blue Z, Red X:

If we look diagonal with only 1 angle, we can only see 2 sides:

This is how it looks like, when we see 2 X sides, 1 Z side and 2 Y sides:

Every new dimension adds 2 planar sides on one positive dimension and on one negative dimension (+/-).
They may have any color or texture.
Every new plane after 2 planes adds a new rotation axis, which is able to render it's own 2 sides and the 2 previous planars.
In 3D the angle 0 and 180 look along the Y-axis, and 90 and 270 along the XZ plane.

4th dimension


Imagine a group of buildings.
You can look into 8 directions: forwards, backwards, left, right, top, down, D+ and D-.
We call the new dimension D.
In a program that is a 4-dimensional array:
int[x][z][y][d]


So we now have 2 new planes on which we can travel or look along.
If it's possible to cast a ray in 1d, 2d and 3d, it should be able to move in 4d!
And it is!
If we have a 4x4 matrix we can easy calculate Ray position with it,
but how to render it?
Let's use raycasting.
Every pixel casts a ray, which sets the color for a pixel to the color of the obstacle it collides with.

The maths:
To cast a ray, we have to properly normalize it:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
// 2D normalize
length = sqrt(x * x + y * y)
invlen = 1 / length
x *= length
y *= length

// 3D
length = sqrt(x * x + y * y + z * z)
invlen = 1 / length
x *= length
y *= length
z *= length

// 4D
length = sqrt(x * x + y * y + z * z + d * d)
invlen = 1 / length
x *= length
y *= length
z *= length
d *= length


'Moving in 3d looks like having the same XZ position, but we move up or down on the y axis.
And the other way around' (quotes for a reason here Grin )


'4D matrix:
In one picture we don't have a floor and in the second we have it.
We now moved in the D plane, but the XYZ position is still the same.
And the other way around.'


It's even more interesting to see how the image will be if we make the D angle diagonal and see all 4 planes:


The purple plane is the 4th plane.
This can be explained like that:
Rays that collide in the first picture (3rd last picture) are out of draw range and have a black color (it doesn't have a floor).
Rays that collide in the second last picture have a green color (second world has a floor).
Rays that collide with the Plane side have a purple color.
(the purple D plane can have the same holes like any other plane)

So I have this Image:

Ray progression


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  
float y=0, z=2, x=2, d=1
float y=0, z=3, x=2, d=1
float y=0, z=3, x=3, d=1
float y=-1, z=3, x=3, d=1// black

float y=1, z=2, x=3, d=1
float y=1, z=3, x=3, d=1
float y=0, z=3, x=3, d=1
float y=0, z=3, x=4, d=1
float y=0, z=3, x=4, d=2// Purple

float y=1, z=2, x=3, d=1
float y=1, z=3, x=3, d=1
float y=1, z=3, x=4, d=1
float y=1, z=3, x=4, d=2
float y=0, z=3, x=4, d=2// Green


Every new plane adds a sin for itself and a cos for previous planes
Camera ray Projection in 3D
      ray.y += 1 * sin_Y;
     
      ray.x += 1 * sin_X * cos_Y;
      ray.z += -1 * cos_X * cos_Y;

Camera ray Projection in 4D
      pos.d += Dist * sin_D;
      pos.y += Dist * sin_Y * cos_D;
     
      pos.x += Dist * sin_X * cos_Y * cos_D;
      pos.z += -Dist * cos_X * cos_Y * cos_D;


Try it yourself and make a raycasting renderer and add a 4th vector component to the ray.
Is the 4 the maximum number of possible dimensions?
No, it could be any number of dimensions. 5D, 6D or even 111D =)

Binary link: http://www.2shared.com/complete/oWYgVUbR/4d_z.html
(couldn't put this into quotes...)

Hope this helps some people.
I've put some sentences into quotes ('), because I really couldn't understand what you wanted to say. Other than that, a cool article.

Also, your strange image host seems to make a lot of money with... stuff... (click on images Wink )
18  Game Development / Newbie & Debugging Questions / Re: LibGDX Actor - to use or not to use; or, *when* to use? on: 2013-05-15 21:10:21
Actors are a scene2d thing, representing an object in the scenegraph.  If you use scene2d, you're using scene2d.Actor.  Now Actors in general are cool, the sort you get from the likes of Akka or Kilim, but they don't have a ton in common with scene2d actors unless you squint and tilt your head at it.

Just want to note to readers, that Akka and Kilim have actually nothing in common with scene2d.Actor...
But sporingie is totally right, he just didn't say it that explicit.

When I rewrote it I separate the model and view. In the model I have the player and a bunch of enemies, gravity, etc. These objects are all just POJOs and knows how to update based on delta time, hit detection, etc. Separate from all that I have the view, which uses the model objects to determine where the camera is, draw everything, and handle input events.

The tricky part when doing model-view separation is that often you need some view information for each object. Where does this get stored? If you keep the separation pure, you can't put view stuff in the model. In this case you have to do some sort of look up the view object for each model object. I think it is better to break the separation by allowing the model object to have a single field that is for the view. This way the view easily has a reference to the data it needs for drawing and it doesn't mess up your organization too much. If you want a little enforcement so you don't accidentally make use of this view object in the model, you can make it of type Object.

What I do is: I have a generic type of viewing an entity: It's animated somehow, has some kinds of controlling types of the images (i.e. animations) and therefore (the view) needs to know more than only position, rotation and stuff. It needs to know whether the user currently presses a button to make the view animate a walking player.

I've solved the problem by simply allowing the view to have the controllers state-information. So the controller (which is responsible for processing key input) holds information about the player, i.e. whether the player moves, or not.

I finally completely seperate my POJO's (model) with my view: I have .json's telling about how my player works (which controller to use), how it should be drawn (view) and how it looks like (actually model, my sprites, but not saved into my POJO later on). When I load the entity I automatically already create the controller, which is completely decoupled from the view, but coupled to the model, create the model, which is decoupled from everything, and create the view, which is coupled to the model and the controller.

One difference is it will be easier to snapshot the game's state (if this is actually needed) when it is described using just POJOs. In this case you can make the view objects you have in your model transient, as long as the view can restore them solely from model information. This is very likely, but in some cases maybe you have view only state that you want to persist. Then you could actually serialize the view object, not all of it but enough to restore it later. Of course if you aren't serializing game state none of this matters when choosing whether to use scene2d.

In my case I needed the mvc pattern (the decoupling of the view from the rest, i.e. my code works without view) for writing my networking code, so basically, yes, that's taking a snapshot of my game state and sending it over to the client Grin just wanted to add that...

And just wanted to share my variation of the MVC pattern in games. I hope you like it.

About Actors actually (god, I'm derailing so badly): I think they're a really cool Idea, but I just didn't have the Idea to use them when I should have...
19  Game Development / Shared Code / Re: Java Quadtree Implementation on: 2013-05-15 18:29:09
Immutability hurts you here.  In no way does it help.  People with distributions which aren't close to uniform prefer <method-X> over uniform grids.

Yes... I was talking about functional languages...  Cranky
You mean you're talking about purely functional languages. Wink


Grin just because that wasn't enough, here is a quote from my post before:

With 'functional' people, I mean people who write in purely functional languages.
20  Game Development / Shared Code / Re: Java Quadtree Implementation on: 2013-05-15 15:11:54
Immutability hurts you here.  In no way does it help.  People with distributions which aren't close to uniform prefer <method-X> over uniform grids.

Yes... I was talking about functional languages...  Cranky

Just a side note:

You don't copy immutable objects. As they never change (mutate) there is no point in holding more than one copy. You reference it (which is cheaper).

With 'copy' I mean 'create a new one with changed parameters'. Take the copy method from scala's case classes as example...
(just so you know:)
1  
2  
case class Person(name: String, age: Int)
val john = Person("john", 21).copy(age = 22); // Results in "john", 22
21  Game Development / Newbie & Debugging Questions / Re: [LibGDX] TiledMapTile IDs or something else to determine... on: 2013-05-12 20:47:22
Honestly, I am not sure what to do with tile ids Smiley I think I was going to do this:
1- Get the collision layer in which I only have two or three tiles filled. These tiles are my collision layers, the player won't pass through these.
2- Get the id of the tiles I filled in the collision layer in the Tiled software. I'm assuming this will give me some clues as to where these tiles are in the map.
3- Draw rectangles around these tiles so that I become able to use them as normal rectangles in the map.
4- Perform basic rectangle based collision detection.

Does that seem doable to you guys?
Yes. Definitely possible. Did that myself already with RuinsOfRevenge (see signature)... (though I did it somehow different)

The error handling (i. e. "
throw some kind of error
") is pseudocode, It's not actual code, it was some kind of comment...

You could run my code over the tiles you have in your collision layer and look what ID's they return. Or simply allow each tile in the collision layer to be a collidable. Finally with the x and y position in the loop, you have the position of the tiles and you finally create Rectangle's out of them.
22  Java Game APIs & Engines / OpenGL Development / Re: Programmable pipeline on: 2013-05-12 20:39:57
You really need to learn how to search for error fixes...

Whenever you get an OpenGLException, simply search for the name of the method which throws it, in this case
glGetProgram


Then open the OpenGL Reference page link (usually 1st in Google search (I searched "glGetProgram")), and the paper contains the point "Errors", where you see whats the problem with each type of Error:

Quote

Errors


GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.
GL_INVALID_OPERATION is generated if program does not refer to a program object.
GL_INVALID_OPERATION is generated if pname is GL_GEOMETRY_VERTICES_OUT, GL_GEOMETRY_INPUT_TYPE, or GL_GEOMETRY_OUTPUT_TYPE, and program does not contain a geometry shader.
GL_INVALID_ENUM is generated if pname is not an accepted value.

We search for our error: In your stacktrace lwjgl tells us 'Invalid operation', and there in the manual page it is: GL_INVALID_OPERATION.

Now whats the problem? The error is generated, if the program does not refer to a program object.

You never called
glCreateProgram()
it seems. Or at least it's return value is not what you give to check the log info...
Try to print 'obj' in your code. If it's <= 0, then something is wrong.
Also, use davedes' code. Or try out his tutorial. He explains it very well.

<edit>Fixed 'glGetProgram' to 'glCreateProgram'...</edit>
23  Game Development / Newbie & Debugging Questions / Re: [LibGDX] TiledMapTile IDs or something else to determine... on: 2013-05-12 20:28:41
I thought I could read the tile info from map.tmx and get the collision tile with its id. But it is encoded with Base64 Smiley So, that failed.
I tried to get all of the tiles, then list their ids etc. But that failed too as the ids are something like this: com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile@69acd952

Ough... that's not the tile id Wink It's the output of the tile with the default toString() method. (what's after the @ is the heap space location of the instance, if I remember that correctly... try out
System.out.println(new Object());
to get what I mean.

Moving on. This is you would get the ID of a Tile with libgdx:
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  
// First, we need to get the layer in which you create the tiles.
// In this case I assume you call the layer 'collision' layer in Tiled.
private int computeCollisionLayerIndex(TiledMap map) {
    for (int i = 0; i < map.getLayers().getCount(); i++) {
        // This is used to get the layer with the name "collision" from all layers
       // (The layers name in Tiled)
       if (map.getLayers().get(i).getName().equalsIgnoreCase("collision")) {
            return i;
        }
    }
    return -1;
}

// Now we surround getting the layer from the index
// with a little error handling:
public void whatevername(TiledMap map) {
    int collisionLayerIndex = computeCollisionLayerIndex(map);
    if (collisionLayerIndex != -1) {
        MapLayer layer = map.getLayers().get(collisionLayerIndex
        if (layer instanceof TiledMapTileLayer) {
            getCollisionTilesFrom((TiledMapTileLayer) layer);
        } else throw some kind of error
    } else throw some kind of error
}

// And finally we print the ID of each tile in the layer
// I don't know what you would do with the tiles in the end,
// and since I don't know what tile ID's your tiles have,
// I simply print them.
public void getCollisionTilesFrom(TiledMapTileLayer layer) {
    for (int x = 0; x < layer.getWidth(); x++) {
        for (int y = 0; y < layer.getHeight(); y++) {
            TiledMapTileLayer.Cell cell = layer.getCell(x, y);
            if (cell == null) continue; // There is no cell
           if (cell.getTile() == null) continue; // No tile inside cell
           
            System.out.println(cell.getTile().getID()); // Get the ID.
       }
    }
}
24  Discussions / General Discussions / Re: Weirdest Practical Programming Language on: 2013-05-11 15:50:38
HAI
I think that HAI maybe just defines that it is a file?

Yeah. I think it's just that the author thought it's more funny.
KTHXBYE
25  Discussions / General Discussions / Re: I cant modify my posts! on: 2013-05-11 10:58:48
Your topic was idle for 180 days, so it was locked. I'll add WIP to the boards that won't be locked automatically.

This is pretty strange though, since only his post was 180 days old, not the whole topic... (maybe we should calculate the 'oldness' of topics by the time from the last post?)
26  Discussions / General Discussions / Re: Weirdest Practical Programming Language on: 2013-05-11 10:29:01
It seems like it checks to see if the variable is greater than 10, then it gets out of the method.

Yes.
KTHX
seems to be like the
break
in java... translated into java that code looks like this (with never ever having known LOLCODE before...):
1  
2  
3  
4  
5  
6  
7  
8  
9  
// HAI
// sth. like #include<stdio.h>
int var = 0;
while (true) {
    var++;
    System.out.println(var);
    if (var > 10) break;
}
// KTHXBYE


Somewhere near that.
The other one is this maybe:
1  
2  
3  
4  
5  
6  
7  
8  
9  
// HAI
// again, #include<stdio.h>
File file = new File("LOLCATS.TXT");
if (file.isReadable()) {
    System.out.println(/* files content actually */ file);
} else {
    System.err.println("ERRROR!");
}
// KTHXBYE
27  Game Development / Newbie & Debugging Questions / Re: How do I get a team coding with me on a indie game? on: 2013-05-09 22:01:51
Depends on what 'skilled' means. It always helps to tell a little story about yourself.
28  Game Development / Performance Tuning / Re: Using software rendering instead of GPU rendering? on: 2013-05-08 20:17:12
@theagentd - That sounds very cool but it might actually be slower than just cpu rendering. You would have to send the info to opencl on the gpu then it works stuff out, then it has to send it back to the cpu so you can send it back to the gpu to tell it to be rendered. Or maybe I'm missing something.

If I look at openGL it looks like it's likely not slower Smiley I know, openCL and openGL is not the same thing, but the difference shouldn't be too big.
29  Java Game APIs & Engines / OpenGL Development / Re: Am i good student :D ? Hows the code? background drawing on: 2013-05-08 18:50:55
Yes. Now what could the create() method be for? Wink

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  
[...]
public class ShooterGame implements ApplicationListener {

[...]
    private Sprite sprite;
    private SpriteBatch spritebatch;

    public ShooterGame() {
        plane = new Plane();
        background = new Background();
    }

    @Override
    public void create() {
        fpsLogger = new FPSLogger();
        spritebatch = new SpriteBatch();
        Sprite sprite = new Sprite(texture);
       
        //Start bg draw
       Texture backgroundTexture = background.getBackgroundTexture();
        //Don't draw in create(), draw in render(), as you already do it:
       // drawBackground(backgroundTexture,512,512);
       //End bg draw
       
        Texture planeTexture = plane.getPlaneTexture();
        draw(planeTexture,plane.getxPos(),plane.getyPos());
    }
[...]
    public void draw(Texture texture,int xPos,int yPos)
    {
        sprite.setX(xPos);
        sprite.setY(yPos);
        //
       spritebatch.begin();
       

        //
       sprite.draw(spritebatch);
        spritebatch.flush();
        spritebatch.dispose();
        //
       spritebatch.end();
    }
[...]
}
30  Game Development / Performance Tuning / Re: Fast/Efficient method to filter a numeric Value on: 2013-05-08 18:29:56
I'm looking for a generic approach, given that I might need different output types in different parts of the program.

When you say generic do you mean Java generic?  i.e. You'd want the same code but for integer, float, double, etc. as required?

I think the OP doesn't mean Java generic, but 'works for each primitive type'. In that case I'd just write the same implementation multiple times. (optimized for
int, long, float, double, short
(but who needs short anyways ^^) )
Pages: [1] 2 3 ... 39
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (73 views)
2013-05-17 21:29:12

alaslipknot (85 views)
2013-05-16 21:24:48

gouessej (114 views)
2013-05-16 00:53:38

gouessej (109 views)
2013-05-16 00:17:58

theagentd (120 views)
2013-05-15 15:01:13

theagentd (109 views)
2013-05-15 15:00:54

StreetDoggy (154 views)
2013-05-14 15:56:26

kutucuk (176 views)
2013-05-12 17:10:36

kutucuk (173 views)
2013-05-12 15:36:09

UnluckyDevil (182 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.415 seconds with 20 queries.