Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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
1  Game Development / Game Play & Game Design / Re: Where can I get nice spritesheets and images? on: 2014-11-19 13:45:33
You can find a lots of links at gamedev.stackexchange.com.
Maybe you'll find something like that Smiley
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-11-14 17:22:42
Installed Linux Mint 17 on VirtualBox to test it out.
Seems like an alternative to Windows! Cheesy
3  Discussions / General Discussions / Re: Someone pick my license! on: 2014-11-10 08:43:54
I would look here or here.

I think this one would be your best bet!
Quote
Under the following terms:
  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • NonCommercial — You may not use the material for commercial purposes.
  • NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
  • No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Or you could write your own license of course Wink

Hope that helps a bit Smiley
4  Game Development / Newbie & Debugging Questions / Re: Best way to iterate through ArrayList? on: 2014-10-17 21:40:27
If you think that's crazy...
Didn't want to make it too complicated Cheesy
5  Game Development / Newbie & Debugging Questions / Re: Best way to iterate through ArrayList? on: 2014-10-17 21:33:41
Streams are probably my new favorite way of going through some Collection to perform operations on it. They're like LINQ for Java! Smiley

I like Streams too, so if you use Java 8 you can use them!

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
// One Operation
array.stream().forEach(val -> val.doSomething());

// Multiple Operations:
array.stream().forEach(val -> {
    val.doSomething();
    val.doSomeOtherThings();
});

// You could even make crazy things like this:
array.stream().filter(val -> val.isAThing())
              .forEach(thing -> thing.doSomething());

Just wanted to show some examples for this Wink
For some more methods you can look into the Java Doc.
6  Game Development / Game Mechanics / Re: Connected Textures? on: 2014-09-28 17:18:49
Here's another tutorial for tiling:
http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/

There's also an example for the 8-bit case Wink
7  Discussions / General Discussions / Re: Looking for a good and detailed lwjgl tutorial on: 2014-08-16 09:28:48
There is also the List of Learning Resources here on JGO!
You can find some good tutorials there Wink
8  Game Development / Newbie & Debugging Questions / Re: Levels rendered sideways? on: 2014-07-27 09:42:25
That's because OpenGL has its origin in the lower left corner.
Like trollwarrior1 said already you could flip the y Coordinate with
screenHeight - y;
or else you could just initalize OpenGL with
glOrtho(0, screenWidth, screenHeight, 0, -1, 1);
, then you have your origin in the top left.
There's nothing wrong with changing the orthographic projection Wink
9  Discussions / General Discussions / Re: New feature: Embedded PDFs on: 2014-07-19 16:48:02
Sadly this feature don't work on Opera - even though it is using the same engine as Chrome. After clicking "click this page to load the PDF" download is initalized, but nothing appears.
I'm using Opera 12.17 (64-bit) and it works fine for me Smiley
Don't know if there's a different engine with other versions.
10  Game Development / Newbie & Debugging Questions / Re: LWJGL BufferedImage white image on: 2014-07-13 11:37:32
Hmmm, still not working...
Just saw that you do
glLoadIdentity()
between
glBegin(...)
and
glEnd()
.

You'll get an OpenGL Error when doing this:
GL_INVALID_OPERATION is generated if glLoadIdentity is executed between the execution of glBegin and the corresponding execution of glEnd.

So does it work if you delete that
glLoadIdentity()
? Smiley
11  Game Development / Newbie & Debugging Questions / Re: LWJGL BufferedImage white image on: 2014-07-13 10:49:52
You haven't set your texture scaling parameters.
Try calling this between
GL11.glBindTexture(...)
and
GL11.glTexImage2D(...)
:

1  
2  
3  
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
// Alternatively you could use GL11.GL_LINEAR instead of GL11.GL_NEAREST

After that you should see your texture Wink

Also you should do
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID)
before drawing your image.
Hope that helped Smiley
12  Game Development / Newbie & Debugging Questions / Re: Rectangles not drawn after Texture is initialized on: 2014-06-12 23:23:06
Ha. But I didn't actually draw the texture yet. When I do it gets rid of the rectangle. That's the problem.
Do you bind your texture? Roll Eyes
And instead of
glRectf(x1, y1, x2, y2)
you could try this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// Note: This method assumes that x1 < x2 and y1 < y2, and also that the texture origin is bottom left.
public void drawRect(float x1, float y1, float x2, float y2) {
    glBegin(GL_QUADS);
        glTexCoord2f(0f, 0f);
        glVertex2f(x1, y1);
        glTexCoord2f(1f, 0f);
        glVertex2f(x2, y1);
        glTexCoord2f(1f, 1f);
        glVertex2f(x2, y2);
        glTexCoord2f(0f, 1f);
        glVertex2f(x1, y2);
    glEnd();
}

Before calling
drawRect(x1, x2, y1, y2)
you should do
glBindTexture(GL_TEXTURE_2D, textureId)
.
Does that solve your problem? Smiley
13  Game Development / Newbie & Debugging Questions / Re: Should I use Java Observer? on: 2014-06-11 14:10:09
Well the benefit from using the Java Observer is, that you don't have to write it yourself Roll Eyes

The only things you would have to do:
  • Create your Entity class (extends java.util.Observable)
  • Create an EntityObserver class (implements java.util.Observer)
  • When creating a entity do
    entity.addObserver(observer)
  • When a change in your entity happens do
    setChanged()
    and
    notifyObservers()

I wouldn't bother writing your own Observer pattern Wink
14  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-28 17:24:06
JavaFX is supposedly the future, but so far it's a *tumbleweed* - who's making anything beyond trivial demos with it?
I'm making a WM 2014 Live Ticker for a lecture project... then again, it is a trivial application... Roll Eyes
It probably won't even be completed because my teammates are rather lazy... I neither have the will nor the time to program their parts too Emo

In the end I still prefer Swing over JavaFX.
15  Games Center / Featured Games / Re: [Slick2d] Retro-Pixels Castle Survival - Top Down Survival Mayhem! on: 2014-05-25 10:04:12
There was a good tutorial that I found (though I can't find it again) that explained how to use powers of two.

The first tutorial that comes to my mind is this one.
Is that the tutorial you had in mind? Smiley
16  Game Development / Shared Code / Re: json on: 2014-05-23 14:59:52
Now that you have a JSON Parser you could expand it to a YAML (v1.2) Parser Grin

And +1 for the recursive descent parser Smiley
17  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-07 17:52:27
Instead of Swing you could also use JavaFX, there you could even do some 3D Graphics an such.
And you can style your GUI like you want with Cascading Style Sheets. Wink
A easy start would be this tutorial Pointing

I actually think that Oracle wants JavaFX to replace Swing someday... in every Swing-Tutorial there's something about learning JavaFX.
18  Discussions / General Discussions / Re: [Web Games] What is the best second language? on: 2014-05-01 09:44:09
Well you could also use HTML for making games Roll Eyes
19  Game Development / Newbie & Debugging Questions / Re: Opening an inventory Screen on: 2014-04-10 21:37:57
Hey I'm trying to put in your StateStack right now and the issue I have is on line 8 where it reads " pushState(states.get("MainGame")); "
I get an error that reads
"The method pushState(String) in the type StateStack is not applicable for the arguments (State)"

however if I make it so that
the pushState Method in line 22 takes a state instead than it compiles, I cant really test it yet cause I dont have my inventory and all set up yet, but any idea on whats going on with that?

Oh... that's my bad Lips Sealed
Of course it should be like this:
1  
2  
3  
4  
5  
public StateStack() {
   addState("MainGame", new MainGameState());
   addState("InventoryState", new InventoryState());
   pushState("MainGame");
}

I messed it up when I copy&pasted the StateMachine and changed it to the StateStack Roll Eyes
Maybe I should change it in the StackMachine as well so it looks similar persecutioncomplex
I'll fix it in the code above! Thanks Wink
20  Game Development / Newbie & Debugging Questions / Re: Opening an inventory Screen on: 2014-04-10 16:28:45
Thats pretty sweet, I actually might use it!

Well in that case you might consider using a state stack instead of a state machine, it could be somewhat more flexible:
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  
public class StateStack{
   private Map<String, State> states = new HashMap<String, State>();
// private Stack<State> stack = new Stack<State>();
// But Stack<E> extends Vector<E>, so you should probably use Deque<E> instead:
   private Deque<State> stack = new ArrayDeque<State>();

   public StateStack() {
      addState("MainGame", new MainGameState());
      addState("InventoryState", new InventoryState());
      pushState("MainGame");
   }

   public void update() {
      State currentState = stack.peek();
      currentState.update();
   }

   public void render() {
      State currentState = stack.peek();
      currentState.render();
   }

   /** Enter new State */
   public void pushState(String stateName) {
      State newState = states.get(stateName);
      stack.push(newState);
   }

   /** Exit current State and return to the State before */
   public void popState() {
      stack.pop();
   }

   public void addState(String stateName, State state) {
      states.put(stateName, state);
   }
}


With that approach you don't have to remember which State was before the current State Wink
But with a few States (like about two) the state machine is entirely sufficient.
Glad if it helps Smiley
21  Game Development / Newbie & Debugging Questions / Re: Opening an inventory Screen on: 2014-04-10 15:19:04
Another way to do this could be that you make a State System.
With that approach you could easily add more States like a game menu or battle menu, etc.
Could look like this pseudo code snippets:

1  
2  
3  
4  
public interface State {
   public void update();
   public void render();
}

1  
2  
3  
4  
5  
6  
7  
8  
9  
public class InventoryState implements State {
   public void update() {
      // insert update code here
   }

   public void render() {
      // insert render code here
   }
}

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public class Game {
   private StateMachine stateMachine = new StateMachine();
   private boolean running;

   public void gameLoop() {
      // initialize etc.

      while(running) {
         // getting delta time and so on

         stateMachine.update();
         stateMachine.render();

         // some fps mechanism like Thread.sleep()
      }
   }
}


And for changing the State you could use a state machine:
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  
public class StateMachine {
   private Map<String, State> states = new HashMap<String, State>();
   private State currentState;

   public StateMachine() {
      addState("MainGame", new MainGameState());
      addState("InventoryState", new InventoryState());
      changeState("MainGame");
   }

   public void update() {
      currentState.update();
   }

   public void render() {
      currentState.render();
   }

   public void changeState(String stateName) {
      currentState = states.get(stateName);
   }

   public void addState(String stateName, State state) {
      states.put(stateName, state);
   }
}


Free to use for anyone Smiley
22  Game Development / Networking & Multiplayer / Re: Game Networking Framework on: 2014-04-07 19:12:58
Well when I worked with a Client-Server-System the Server send messages in some pseudo XML, something like this:
1  
2  
3  
4  
5  
6  
7  
8  
begin:foobar
begin:intlist
0
1
2
end:intlist
length: 3
end:foobar


So let's assume you have a Player class with an ID, x, y, hp and mp. Your server messages could look like this:
1  
2  
3  
4  
5  
6  
7  
begin:player
id:1234
x:5
y:8
hp:321
mp:234
end:player

After that you could parse that messages, possibly with a recursive descent parser.
You could also send a message "Player(1234,5,8,321,234)", you just have to know how to parse your message for the constructor.

Does that help? Smiley
23  Game Development / Articles & tutorials / Re: Tutorial: stutter-free texture streaming with LWJGL on: 2014-03-24 16:59:23
That's interesting to read!
Thanks for that tutorial Smiley
24  Java Game APIs & Engines / OpenGL Development / Re: LWJGL library path for Eclipse on: 2014-03-23 17:32:07
One slight change is that you have to set a string parameter as the property:

1  
      System.setProperty( "org.lwjgl.librarypath", new File( "target/natives" ).getAbsolutePath() );


i.e. the absolute path at the end.

Oh... you're right, I overlooked that! Thanks Wink
Fixed it Smiley
25  Game Development / Newbie & Debugging Questions / Re: What to use for config files? on: 2014-03-11 21:15:05
If you wan to use the standard library, Properties is a (somewhat old, but usable) way to save key-value pairs in files. You use it as a hashmap, and can store it to a file via a stream, or read a hashmap in from a stream. It also supports xml. Properties is good for using as a simple config file.

Edit: Also Preferences is probably even better than properties, check it out.

+1 for Properties, that's the way I learned to do setting files in lecture. Really easy to use!  Smiley
That Preferences thing looks also quite interesting. Wink
26  Game Development / Newbie & Debugging Questions / Re: Compile and Debug Java on: 2014-03-11 19:52:04
Fighting over this is like fighting over which engine/graphic api is the best Roll Eyes

Oh well we had that too Wink

Yeah and not only once Cheesy

Though i wanted to try oracle IDE, forgot the name...

You mean Oracle JDeveloper?
27  Game Development / Newbie & Debugging Questions / Re: Compile and Debug Java on: 2014-03-11 19:46:12
Why fighting over which IDE is the best?
I switched from Eclipse to NetBeans some time ago, so what?
Fighting over this is like fighting over which engine/graphic api is the best Roll Eyes

In the end it is you who decides what you do with it or how you use it Smiley
28  Game Development / Newbie & Debugging Questions / Re: LWJGL and LibGDX - Little comprehension problem (What is low level?) on: 2014-03-11 16:45:08
Well it's pretty easy:
LWJGL is just a wrapper to OpenGL , OpenCL and OpenAL for Java.
LibGDX uses LWJGL underneath and do some of the boilerplate code for you.

If you going to start and want to learn pure OpenGL/OpenCL/OpenAL use LWJGL, if you want to make games faster then use LibGDX Wink
29  Discussions / General Discussions / Re: Making everything by yourself. And loving it! on: 2014-03-10 09:37:26
Good to see, that I am not the only one with this opinion Smiley

On the one hand reinventing the wheel could be a waste of time, but on the other hand you'll learn a lot of things through reinventing the wheel!
I don't think it would be a waste of time, and if you learned how to build that wheel you still can take some high level api if you want to.

Now I've got to go, lecture is waiting Smiley
30  Discussions / General Discussions / Re: What are your brainstorming techniques? on: 2014-03-05 22:02:00
Usually I first decide what kind of game it should be, e.g. a RTS game.
Next I think about the setting, first the basic like let's say medieval setting, from that point I write down everything what comes to my mind.
After that I think about mechanics and the story, if there will be one.
And of course if it will be a bigger project I start to write a Game Design Document which grows over the period of time Roll Eyes
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (33 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (65 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!