Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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 4
1  Discussions / Miscellaneous Topics / Re: Starbound on: 2014-01-09 01:54:04
Pong was pretty original...

Those four games are all generally the same. Sure, graphics and some game elements are different, but the underlying concept and how they are built is pretty much similar. Not the same, but similar.
Pong was based on table tennis, which is still a game even though it isn't a video game.
2  Game Development / Newbie & Debugging Questions / Re: EMERGENCY! Java & Eclipse on Surface Pro? on: 2013-08-24 22:18:31
I imagine it would be if you were using an on screen keyboard, but the surface pro has a removable keyboard:
3  Game Development / Newbie & Debugging Questions / Re: Can you spot the error? on: 2013-08-21 22:22:52
Actually, from looking it up, it looks like it is system dependent? Tell me if I'm wrong. So you are right, the file separator isn't the problem.
4  Game Development / Newbie & Debugging Questions / Re: Can you spot the error? on: 2013-08-21 19:49:55
I'm going to guess that the problem is because you are using backslashes, for one, instead of forward slashes.
Also, unless the files are located under C:/XML/Items/Armor, you should use "XML/Items/Armor".
Of course, this is just a guess.
5  Games Center / WIP games, tools & toy projects / Re: 'Zombie Outbreak' a top-down zombie survival game using LWJGL on: 2013-08-18 16:29:17
Hmmm... that's a shame Cranky
Unfortunately I do not have access to a Linux machine and Linux porting will apparently be a no-no

I may look at Linux porting in the future, but for now, there are more pressing matters at hand
(sorry Wessles)

EDIT:
But if anyone could suggest any fixes, that would be great  Grin
It looks like you compiled for Java 7, while wesly.laferriere is using Java 6. So either wesly can get Java 7 or you can compile for Java 6 (which Java 7 is backwards compatible with).
6  Games Center / Cube World Projects / Re: Let's Play With Cubes! on: 2013-08-16 22:49:56
Have you tried making chunks one model?I believe that it would render faster if you do that.
7  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Decals and Models on: 2013-08-16 21:16:47
@sirkarpfen: To render with a decal batch you simply add a Decal, and then call DecalBatch.flush(), and it will render.

Also, decals are not automatically depth buffered, so he ordered them, not models.
8  Game Development / Game Play & Game Design / Re: Auto-Tiling on 2D map. on: 2013-08-15 15:31:37
I put my code into eclipse and fixed some things up to see if it would work, and as it turns out, it is not possible to store all the information in one byte in Java. The smallest type of number you could use is a short, but I'm not sure how much it would affect performance.

Also, for convenience you could do want Longarmx did, and instead of typing numbers, make them into variables. Example code: http://www.java-gaming.org/?action=pastebin&id=682

The code example also adds a function that ANDs the transitionTile and the position then checks if they are equal.
9  Game Development / Game Play & Game Design / Re: Auto-Tiling on 2D map. on: 2013-08-15 06:13:52
Nope, you are spot on.
10  Game Development / Game Play & Game Design / Re: Auto-Tiling on 2D map. on: 2013-08-15 05:16:40
In the example that I gave you, I used bitwise operations. The '&' operator is a bitwise operator that takes the bits and does this:
1  
2  
dec: 2 & 3 = 2
binary: 10 & 11 = 10

So, you can store multiple values in a number, up to 8 booleans in a byte.

However, in Java, it isn't quite so simple. Bytes in Java range from -127 to 128 (inclusive), so it is more difficult* to store 8 booleans in a byte, but possible by writing the numbers in hexadecimal instead of decimal.

So, instead of this:
1  
byte aByte = (byte) 255;


You would have to use this:
1  
byte aByte = (byte) 0xff; 


But thats only if you want to use only a single byte. Otherwise, you can just use the code in my example.

*In C++/C there are primitives called ubytes, which stands for unsigned byte. Unsigned bytes differ from signed bytes because they range from 0 to 255 (inclusive), or basically don't have negatives. Java does not have unsigned numbers.
11  Game Development / Game Play & Game Design / Re: Auto-Tiling on 2D map. on: 2013-08-14 16:16:48
Well, I think that instead of modifying your original array, you could make a new one that tells which tiles around it are need to be auto-tiled. After rendering how you are right now, go through it a second time, and then render the correct auto-tile by checking the tiles in the positions around it.

I wrote some code that, in my head, works: http://pastebin.java-gaming.org/4de8a8a7162

I haven't tested it, and it doesn't do everything so it might not work.
12  Java Game APIs & Engines / JInput / Re: On button release on: 2013-08-12 23:15:06
No, buttonPressed would already be false or it couldn't get through the if statement.
13  Game Development / Game Play & Game Design / Re: [LibGDX] 2D (top down) procedurally generated terrain. on: 2013-08-10 18:32:35
Two things.

First, instead of using a bunch of if statements, you should try using a switch statement. It would make it look like this:
1  
2  
3  
4  
5  
6  
7  
8  
switch(map[x][y]) {
    case 0:
        batch.draw(deepwater, w, h, scalex, scaley);
    case 1:
        batch.draw(water, w, h, scalex, scaley);
    case 2:
        //so on and so forth
}


Secondly, instead of checking to see if the tile is in the view, use math to find where the view is:
1  
2  
3  
4  
5  
for(int x = x0; x < x1; x++) {//Subtract from x0 and add to x1 to render a little outside of the viewport
   for(int y = y0; y < y1; y++) {//Same as above
       //*Insert rendering code*
   }
}

This should make it faster, as you don't have to check every block in the map.

Edit: I forgot to add in break statements to the switch statement! With them it looks like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
switch(map[x][y]) {
    case 0:
        batch.draw(deepwater, w, h, scalex, scaley);
        break;
    case 1:
        batch.draw(water, w, h, scalex, scaley);
        break;
    case 2:
        //so on and so forth
}

Breaks are important because they break out of the switch statement, so that you aren't checking for the value multiple times.
14  Game Development / Game Play & Game Design / Re: Pitch your Game Idea/Concept here! on: 2013-08-10 03:06:52
A Platformer style kart racing game? Players race by running kart in a platformer level.

PS: I require a credit for it
This isn't exactly that, but it is a platformer racing game.
15  Game Development / Newbie & Debugging Questions / Re: Can I use a Touchpad without using a stage? on: 2013-07-31 03:07:30
Yes, you can. To check it, simply use:
1  
2  
3  
Gdx.input.getX(); //Touch x
Gdx.input.getY(); //Touch y
Gdx.input.isTouched(); //If it is touched


This, however, won't give you the right right coordinates. First you have to translate, using something like this:
1  
2  
3  
4  
5  
6  
Camera camera = new Camera();
Vector3.tmp.x = Gdx.input.getX();
Vector3.tmp.y = Gdx.input.getY();
camera.unproject(Vector3.tmp);
float gameX = Vector3.tmp.x;
float gameY = Vector3.tmp.y;


This will give you the correct in game coordinates.
16  Game Development / Game Play & Game Design / Re: Data structure for voxels? on: 2013-07-12 00:27:19
Well, think about when you are doing collisions. If you go with an Arraylist of voxels, you'll have to loop through every voxel to check for collisions, rather than do some simple math. Also, when will you have to loop through the blocks, other than when you are rendering? And a simple if statement doesn't take that much processing power.
17  Games Center / Featured Games / Re: Blue Saga on: 2013-07-10 02:01:21
I think it looks good, and I especially like the background.
18  Games Center / Featured Games / Re: Blue Saga on: 2013-07-09 18:00:40
I get a crash whenever I pick up a bag:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
java.lang.NullPointerException
   at i.c.b(Unknown Source)
   at c.i.a(Unknown Source)
   at game.BlueSaga.update(Unknown Source)
   at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:657)
   at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
   at game.BlueSaga.main(Unknown Source)
Tue Jul 09 10:52:04 CDT 2013 ERROR:Game.update() failure - check the game code.
org.newdawn.slick.SlickException: Game.update() failure - check the game code.
   at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:663)
   at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
   at game.BlueSaga.main(Unknown Source)


But I love the game so far!
19  Discussions / Miscellaneous Topics / Re: Yippieeee! Got my new Graphic card! on: 2013-06-25 00:02:31
Using a Dell Latitude E5500 with a Intel® 4500MHD Graphics Accelerator. Yeah, not the best graphics card around...
20  Games Center / Featured Games / Re: Blue Saga on: 2013-06-17 19:28:12
Ok, hopefully I can run it on linux after that. Cheesy

Also, I dual boot with windows, and I got the same error as HerosGraveDev when I tried to run it.
21  Games Center / Featured Games / Re: Blue Saga on: 2013-06-17 16:22:28
I am on linux, and when I try to run the game I get this error:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
   at java.lang.Runtime.loadLibrary0(Runtime.java:845)
   at java.lang.System.loadLibrary(System.java:1084)
   at org.lwjgl.Sys$1.run(Sys.java:73)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
   at org.lwjgl.Sys.loadLibrary(Sys.java:95)
   at org.lwjgl.Sys.<clinit>(Sys.java:112)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
   at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
   at game.BlueSaga.main(Unknown Source)

And I have to terminate manually.
22  Discussions / Suggestions / Re: [bug] top bar being drawn oddly on: 2013-06-13 17:17:10
Well, I see it as well. I assume it's just a design.
23  Discussions / Miscellaneous Topics / Re: Quadratic equations on: 2013-06-13 02:12:05
Oh, I didn't read your post closely enough. I don't know the process of getting from "x² + 2x + 1", how I remember solving it in math class is by plugging in random numbers into (ax + b)(cx + d), until it would form the quadratic equation through FOIL.  I'm sure there's a better way, I just don't know it.  Tongue
24  Discussions / Miscellaneous Topics / Re: Quadratic equations on: 2013-06-13 01:48:52
Basically,you multiply (x+1) by (x+1). So you go
First, (x+1)(x+1), which is x*x, or x^2
Outside, (x+1)(x+1), which is x*1, or simply x
Inside, (x+1)(x+1), which is 1*x, or simply x
Last, (x+1)(x+1), which is 1*1, or 1
Then you put it together and it becomes x^2 + x + x + 1, which is then simplified to x^2 + 2x + 1. This process is called FOIL.
25  Game Development / Newbie & Debugging Questions / Re: Help with tile based movement on: 2013-05-29 14:11:33
The code I gave you should ignore the keyboard until it is done moving one tile (Oh, and I forgot to mention that the 16 is the tile width / height). I can't think of why it would be doing that, unless you are moving in a different way. Perhaps I can see your code?

Also, if you want to make sure that they don't move diagonally, make the ifs a chain of else-ifs.
26  Game Development / Newbie & Debugging Questions / Re: Help with tile based movement on: 2013-05-29 05:50:59
If you already have a game loop up you can use this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public void tick() {//or whatever your update method is
   if(x % 16 == 0 && y % 16 == 0) {
        motionx = 0;
        motiony = 0;
        if(/*If left key is pressed*/) motionx = -4;
        if(/*If right key is pressed*/) motionx = 4;
        if(/*If up key is pressed*/) motiony = -4;
        if(/*If down key is pressed*/) motiony = 4;
    }
    x += motionx;
    y += motiony;
}


The important thing to remember is that 4 can be any number that goes evenly into 16, otherwise you will go more than one tile.
27  Game Development / Newbie & Debugging Questions / Re: Question about TileMap and Tiled on: 2013-04-26 23:58:37
I think he wants the game to scale, but not stretch. If so, I think that this is a solution.
28  Game Development / Newbie & Debugging Questions / Re: LibGDX - implements ApplicationListener or Extends Game? on: 2013-04-12 05:25:45
Pretty much, but it implements ApplicationListener itself. Game is basically just a Helper class to be used with the Screen interface. This is an easy way to set up multiple screens, like a menu screen, a options screen, the actual gameplay screen, etc.

Exact implementation is here.
29  Game Development / Newbie & Debugging Questions / Re: LibGDX - implements ApplicationListener or Extends Game? on: 2013-04-12 05:04:11
Game is an abstract class that implements ApplicationListener, so you do not have to implement ApplicationListener yourself.
30  Discussions / General Discussions / Re: Managing gamestates and entities, singletons on: 2013-04-08 23:54:24
I don't know if singletons are the way to go, and certainly aren't the simplest way, but I am using singletons myself. I handle this similar to a way minecraft handles blocks. However, unlike minecraft, I use two classes; an Entity class, which holds information, and an Abstract Controller class, which does the logic.

The abstract Controller has a few static variables/functions. Here is the basic code:
1  
2  
3  
4  
5  
6  
private static Controller[] controllers = new Controller[128];

public static Controller getController(int id) {
    if(id<0 || id>controllers.length) return null;
    return controllers[id];
}

This is where minecraft stops, and where minecraft gets block/item ids (assuming you've played enough minecraft to know that).

I take it a bit further. To increase compatibility/readability, I include a static HashMap:
1  
2  
3  
4  
5  
6  
private static HashMap<String, Integer> names = new HashMap<String, Integer>();

public static Controller getController(String name) {
    if(names.containsKey(name)) return getController(names.get(name));
    return null;
}


Next, we need to make a few controllers, but first they need a way to be added to the list. So in our abstract class, add in the following constructor/variables:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public final int id;
public final String name;
public Controller(String name) {
    for(int index=0; index<controllers.length; index++) {
   if(controllers[index]==null) {
       controllers[index] = controller;
       names.put(name, index);
       id = index;
            this.name = name;
        }
    }
}


Now, anytime we make one of our singleton controllers, it will be kept in our array of controllers. The last things to do are make something for the controllers to act on, and make the controllers act on it. I handled this by first making an entity class that has its controllers id:
1  
2  
3  
public class Entity {
    public int controllerId;
}


Then I made an update function in the Controller class:
1  
2  
3  
public void update(Entity entity) {
    //do stuff
}


And an update function in the Entity class:
1  
2  
3  
public void update() {
    Controller.getController(controllerId).update(this);
}


And that is about all for basic singleton Controllers. Of course, you will have to add in more, like an x and y to the Entity class, but I think you can figure that out yourself.   Cheesy
Pages: [1] 2 3 4
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (53 views)
2014-04-15 18:08:23

BurntPizza (51 views)
2014-04-15 03:46:01

UprightPath (65 views)
2014-04-14 17:39:50

UprightPath (48 views)
2014-04-14 17:35:47

Porlus (65 views)
2014-04-14 15:48:38

tom_mai78101 (89 views)
2014-04-10 04:04:31

BurntPizza (149 views)
2014-04-08 23:06:04

tom_mai78101 (245 views)
2014-04-05 13:34:39

trollwarrior1 (203 views)
2014-04-04 12:06:45

CJLetsGame (210 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!