Show Posts
|
|
Pages: [1]
|
|
5
|
Java Game APIs & Engines / OpenGL Development / Re: Two squares/cubes (basic question OpenGL 3.x LWJGL)
|
on: 2013-01-27 13:51:43
|
Not quite, now you tell it to draw the same square twice. Think of the vertices as if they are on a numbered list, the first 4 vertices in your vertices array are those of the first square. The next 4 vertices are those of your second square. So your indices should look something like this. 1 2 3 4 5 6 7
| byte[] indices = { 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4, }; |
The indices simply tell the gpu which of the vertices you have sent it, it should draw, and what order to draw them in. The advantage of this approach is that you don't need to send the same vertex several times to join multiple triangles together. As an example you only sent 4 vertices for each of the squares, but you need 6 to make a square by combining two triangles, but two of them is already on the same location.
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: Nullpointer exception at render
|
on: 2012-12-18 00:52:31
|
|
getSprites()? In the code you posted before currentFrame isn't being instantiated either.
Edit: by the way, you really should check your code an extra time before posting more of these NullPointerException errors, because they are often easy enough to spot, make sure you have a clear idea where your variables is instantiated.
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Re: Tile-based game help!
|
on: 2012-10-14 01:34:06
|
|
There is nothing there that requires it to be static, but you made the field static, so the it has to be called statically when you draw it.
On the line g.drawImage(Tiles.tileImg, Level.thex, Level.they); remove "Tiles." and remove the static modifier on the field "tileImg".
|
|
|
|
|
19
|
Game Development / Newbie & Debugging Questions / Re: Serialize Image
|
on: 2012-02-05 18:11:55
|
1 2 3 4 5 6 7 8 9 10 11 12
| public void nullifyImages(){ uSelImage = null; uNorImage = null; uActiveImage = null; } public void loadImages() throws SlickException{ uSelImage = new Image(uSelImageDest); uNorImage = new Image(uNorImageDest); uActiveImage = new Image(uActiveImageDest); } |
Try putting these in your unit class. Call nullifyImages() on you object just before out.writeObject(object) and call loadImages() just after loading in.readObject(). If your program still need the object after saving you can either. 1. pass the images to somewhere else, where you can retrieve them from, before you nullify the fields. 2. reload them with loadImages() after saving.
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Re: Serialize Image
|
on: 2012-02-05 17:36:08
|
|
Do you actually need to save the images into a file?
Otherwise you could simply save the Image paths, then set your image fields to null before saving the file, and then after loading the file, load the images based on the path you saved.
|
|
|
|
|
22
|
Game Development / Newbie & Debugging Questions / Re: Memory leak(?) and inefficient buffering problem
|
on: 2012-02-01 23:05:01
|
Looking at your code i don't see anything obvious that would cause memory leak, but i do have a few criticisms.  The first one, and possibly causing the memory leak, is that you silence exceptions, i see you do this a few times. Try not to silence exceptions, because if your program is throwing a lot of silenced exceptions, it could easily cause all sorts of performance problems, and try to use specific exceptions that you know could be thrown rather than the standard Exception. The second one, try to add more comments or arrange you code based on functionality, to make it easier to read, because large walls of code is tend to be hard to read, and limits the amount of people who would post here. As for your drawing algorithm, it looks fine, i don't know how much of an improvement it is as i have little experience with it, but you could try using bufferstrategy rather than a bufferedimage its supposed to be faster.
|
|
|
|
|
23
|
Game Development / Newbie & Debugging Questions / Re: Slick2ds entity engine
|
on: 2012-01-16 13:19:52
|
I don't recall slick 2D having an entity manager, only some of its extensions that have and a few tutorials that explains how to make one. My advise, make your own, it will be alot easier to understand whats going on, than using someone else's system. My idea's: For your crowd manager(npc-director), make it an entity, and make all the npc's entities too, have the npc-director create and remove npc's first thing per loop, maybe using an npc pool, npc-director could assign them behaviors too. Then have the npc's control what they do on their own. This is what i would do based on your description. But its up to you, to decide how it should work. 
|
|
|
|
|
24
|
Game Development / Game Play & Game Design / Re: Game Graphics Style Opinions
|
on: 2012-01-15 23:03:32
|
|
For looks, i'd clearly say the sketched one. When i compare the screenshots, i look at the tile-based and think "why? another one of those." but when i look at the sketched one i think "This seems interesting, wanna see more."
But for control, i'd say that the tile-based might be easiest for the player to understand and interact with, when using click and drag, while the sketched one would be better of with a different control system such as point and click.
My conclusion would be, pick the sketched one, it have the best "feel".
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|