Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (428)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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 ... 8
1  Discussions / General Discussions / Re: Need C programs to practice for debugging competition on: 2014-04-05 16:27:28

Actually I spotted that bug as soon as I saw the if statements and the first if statement didnt have brackets, when I did a course in University, our tutor kept pretty much nailing it into us to try and not use single line if statements, he said if your working on the project by your self go ahead, but in a group project, someone may have the standard of always using brackets, and could just shove some new code for the if statement in the single line if statement.

so soon as I saw the if statements, I checked and saw the second
goto fail;
immediately.

but knowing I was looking for a bug may of helped me spotting it as soon as I saw it.
2  Game Development / Newbie & Debugging Questions / Re: Web Hosting My Java Server Code - How? on: 2014-04-01 14:02:22
I had a 123system VPS for a year, I found they were pretty good. I had some small issues, but I think most of them was my fault.

The node my VPS was on did go down, and I waited a few days for it to go back up but it didn't, so I contacted them and they said the node my VPS was down and they were trying to fix it and should be a day or 2. after a few days, they offered to transfer people to a new node, but they would lose some stuff from the old VPS, or they could wait it out to how ever long it took to get repaired. I opted for a transfer, as I had nothing important on mine that I couldn't redo in like 20 mins.

123Systems VPS's are cheap, so I would suggest trying one of them, and seeing if you can manage to just use that without many problems.

I would suggest there OpenVZ VPS due to their cheap prices (e.g. 1gb ram is $19, 2gb ram is $30 USD for one year, 4gb ram is $59).

also here is my referral: https://123systems.net/billing/aff.php?aff=1311

not sure to much about their referral benefits.
3  Game Development / Newbie & Debugging Questions / Re: Libgdx how to send arrays to Shader on: 2014-01-22 12:54:21
I am no expert on shaders its just how I learnt to send an array to a shader, and how many lights will you be sending, i think you will need to be sending literally thousands to notice a difference. (notice a difference at sending data to the shader)

remember if your using a fragment shader, its effect every single pixel that you are rendering, chances are you are rendering to many lights at once without restricting the area that the light modifies.
4  Game Development / Newbie & Debugging Questions / Re: Libgdx how to send arrays to Shader on: 2014-01-22 12:49:04
You need to specify the array index in the location, this is pretty much what i use in my shaders

1  
2  
3  
4  
for(int i = 0; i < totalLights; i++){
int loc = shader.getUniformLocation("shaderColor[" + i + "]");
//setuniform here
}
5  Game Development / Newbie & Debugging Questions / Re: GLSL - setting uniform problem on: 2014-01-21 14:48:56
if it is "weird" it is your shader. not my fixed code, i just re arranged your draw call.

how shaders should be used:

1  
2  
3  
4  
5  
shader.begin(); //Begin the shader we want to use

spriteBatcher.draw(...); //put EVERYTHING we want to draw between "begin()" and "end()"

shader.end(); //Our draw call is over, lets stop the shader
6  Game Development / Newbie & Debugging Questions / Re: GLSL - setting uniform problem on: 2014-01-21 14:42:21
You are not using your shader to draw the square.

Fixed code:
1  
2  
3  
4  
5  
map[mapPos].light = Lighting.checkSunLight(mapPosY, mapPosX, this); // It works good.. returns float
Shaders.blockS.begin();
Shaders.blockS.setUniformf("lightBlock", map[mapPos].light); // Problem is here!!!
batch.draw(map[mapPos].getBlockTexture(), (mapPosX * Block.WIDTH), (mapPosY * Block.HEIGHT), Block.WIDTH, Block.HEIGHT); // Doesn't draw the block.
Shaders.blockS.end(); //end the shader as the draw call is over


You should end the shader once you have finished drawing everything with the shader. Basically the shader was useless as you ended your shader before you actually begin drawing with your sprite batcher.
7  Game Development / Newbie & Debugging Questions / Re: NullPointer - TextureRegions on: 2013-12-13 14:33:13
if you re read it, you will know I never said TextureRegion constructor, but the TextureRegion region[][] is null, I showed him how to initialize the array, because either region[][] or playerSheet is null as they are the only variables that can produce a null pointer, like I said in my post that you only read the code snippets of.

To remove your confusion, I will edit the code and use his class name that he had the exception in.
8  Game Development / Newbie & Debugging Questions / Re: NullPointer - TextureRegions on: 2013-12-13 14:15:56
You have 2 possible variables that could be causing the problem

first, either
1  
playerSheet


or

1  
regions[][]


may be null.

Check to see if your playerSheet is null, as I don't see that anywhere in your snippets you posted

you could use this

1  
2  
3  
if(playerSheet == null){
System.out.println("playerSheet is null");
}


for the array of TextureRegions

make sure you initialize the array

1  
2  
3  
4  
5  
private TextureRegion[][] regions;

public Player(){
regions = new TextureRegion[size][size];
}


edit: renamed the constructor so people don't have to read the non code snippets.
9  Java Game APIs & Engines / OpenGL Development / Re: Positions of VBO's with Shaders on: 2013-12-07 12:18:07
Shaders are in the Textured Quad:

http://lwjgl.org/wiki/index.php?title=The_Quad_textured
10  Java Game APIs & Engines / OpenGL Development / Re: Positions of VBO's with Shaders on: 2013-12-07 12:14:25
Yes, I have

1  
glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);


using SHC's VBO tutorial, it works fine with supply values of e.g. 800 and 600, but once I implemented shaders into it, i need to use -1 to 1, while I play around while I cant find out how to fix this, I have the position changed in the vertex shader and it works like SHC's tutorial.
11  Java Game APIs & Engines / OpenGL Development / Positions of VBO's with Shaders on: 2013-12-07 10:11:46
For a while now, I have been learning VBO's more and trying to move away from deprecated code.

My main struggle was sending the texture coordinates to the shader, I knew what I had to do, but I could never get the them to work.

I finally got the texture coordinates to the shader, but the problem now is the positioning in the VBO.

I have used SHC's VBO Tutorial and LWJGL Wiki on Textured Quads to produce my VBO Class.

It's probably not the best VBO class, but its good enough for my testing of drawing 2 squares on the screen currently as I am only testing before I implement it into my game.

The question is what have I done or what do I need to add to allow for sending the x, y, width and height parameters in addRectangle() for values such as 800, 600, 100, 200 etc. Currently I need to supply values in floats between -1f and 1f. Is their a way I can just send 800, 600 etc or will I need to create a method to convert 800 down to a float between -1f and 1f?

also any recommendations on improving my VBO class will be good, but this is not its final state, just its current working state.
12  Games Center / 4K Game Competition - 2014 / Re: Java4k Launcher on: 2013-12-06 10:34:09
someone already did:

http://www.java-gaming.org/topics/launcher4k-micro-version/31411/view.html
13  Game Development / Newbie & Debugging Questions / Re: Theory of 2d per pixel lighting. on: 2013-11-29 15:03:45
For a game I made for a assignment (in my projects, a horde style game, i am pretty sure i have day/night cycle turned on), I didn't spend much time and just stayed with immediate mode because the school computers suck, some of them didn't even support OpenGL.

vec4 old is a rgba value for the pixel, gl_TexCoord[0].st is a vector 2 of the texture coordinate (if you use the GL11.glTexCoord2f() method to set your texture coordinates you can use the gl_TexCoord[0], if not use the vec2 of your texture coordinates you passed in). the value of texture is the texture ID you set up when you bound it.

each update I change the value of timer, according to how dark it should get, the timer way is probably not the best, but it did good for my first time using shaders and rushing it.


fragment shader
1  
2  
3  
4  
5  
6  
7  
8  
9  
uniform sampler2D texture;
uniform float timer;
uniform float alpha;
float timeEffect;
void main() {
   vec4 old = texture2D(texture, gl_TexCoord[0].st);
   timeEffect = 1.0 / timer;
   gl_FragColor = vec4(old.s * timer, old.t * timer, old.p * timer, old.q * alpha);
}
14  Game Development / Newbie & Debugging Questions / Re: Theory of 2d per pixel lighting. on: 2013-11-29 14:22:57
put your lighting calculation in the fragment shader.

The fragment shader will do per pixel while the other is per vertices
15  Game Development / Newbie & Debugging Questions / Re: movement key press on: 2013-10-31 11:11:15
remove else from all the statements

currently in your current set of if statements, if one key is pressed, the other cant be pressed.

in your current code, left has priority, if you press left and down, left will always execute as its the first if statement. to fix this, you must have a separate if statement for each key press, so do not use
1  
 else if(statement) 
.

new code:

1  
2  
3  
4  
if(input.left.isPressed()) mx--;
if(input.right.isPressed()) mx++;
if(input.up.isPressed()) my--;
if(input.down.isPressed()) my++;


remember, when you have if else statements, it will continue to check each else if until the statement is TRUE, it will not check all if it does not have to.

 
16  Game Development / Shared Code / Re: Easy LibGDX sprite creator on: 2013-10-14 12:40:17
with OpenGL, you want less binding calls, so loading multiple textures is inefficient as you want a sprite sheet to contain all images allowing for 1 binding call.

you also would want a texture that is global and can be used to grab the texture from one image, this will allow for only one image to be loaded for all tiles.

what you would want to return is really just the texture location within the single image.

in OpenGL the max width is a value of 1, and the min width is 0 and the same for height.

EDIT: fixed a slight mistake
17  Game Development / Newbie & Debugging Questions / Re: animation looping using double buffering on: 2013-10-13 13:42:04
Your question is very unclear-- can you be more precise about what you want the image to do? Do you want to move it in a circle? I also have no idea what you're talking about with a "flag" to "get the image back".

a flag is another word for a boolean basically, e.g. some sought of if statement to get back to the original image.
18  Game Development / Newbie & Debugging Questions / Re: animation looping using double buffering on: 2013-10-13 13:38:40
The simplest way to create animation for 2D is to just reset a counter when it is greater then the amount of sprites in the animation.

e.g. for 6 sprites you could use code similar to this, and would have to be the most easiest way to produce animation,

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
   long oldTime = System.currentTimeMillis();
   int animationWaitTime = 200; //in milli seconds
 
   int animationIndex = 0;
   int amountOfSprites = 6;
   
   public void update(){
      if(System.currentTimeMillis() > oldTime + animationWaitTime){
         oldTime = System.currentTimeMillis();
         sprite[animationIndex].render();
         
         animationIndex++;
         
         if(animationIndex >= amountOfSprites){
            animationIndex = 0;
         }
      }
   }


if you want a pong sought of effect, using the exact same code above with a little alter

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
   long oldTime = System.currentTimeMillis();
   int animationWaitTime = 200; //in milli seconds
 
   int animationIndex = 0;
   int amountOfSprites = 6;
   
   int increacement = 1;
   
   public void update(){
      if(System.currentTimeMillis() > oldTime + animationWaitTime){
         oldTime = System.currentTimeMillis();
         
         sprite[animationIndex].render();
         
         animationIndex += increacement;
         
         if(animationIndex >= amountOfSprites){
            increacement = -1;
         }else if(animationIndex <= 0){
            increacement = 1;
         }
      }
   }


code is probably not perfect, but it will make you understand what to do, you could add an if statement in there to allow for pong effect to be turned on and off
19  Games Center / WIP games, tools & toy projects / Re: MERCury - 2d Game Engine on: 2013-10-05 17:34:03
aslong as the drive is not dead, use the drive as a secondary hard drive (pretty much like a usb that is always plugged in). then just transfer the files you need.

if the hard drive is dead, then I doubt you will be able to get them your self, but it is not impossible.

EDIT:

If you boot into your cd, and have the hard drive plugged in, you should see the hard drive in Ubuntu's equivalent to "My Computer" most likely in the same place the hard drive use to be in. havnt really used linux so I am unfamiliar with it.
20  Game Development / Newbie & Debugging Questions / Re: Multiple AlphaComposite Sources? on: 2013-09-06 16:46:52
If you see obfuscated code, you must have the wrong file, the code isn't obfuscated but the variable names are not the best as he had to fit it into 4 kb to fit the competition.

https://mojang.com/notch/j4k/l4kd/G.java

if it was obfuscated, you would literally have no idea whats going on, some things can give you hints, and you could probably be able to rename the variables to better ones, or comment sections of code to what is happening.

put the code into your IDE and just start changing stuff if needed to figure out what it does.
21  Game Development / Newbie & Debugging Questions / Re: Exporting Slick Game on: 2013-08-27 13:15:47
To what I can tell you, and anyone can tell you based on what you have given us.

1  
2  
Exception in thread "main" java.lang.RuntimeException: Resource not found: resou
rces/spritesheets/birk_anim.png


so  birk_anim.png is not found, and I bet it is the first image you try and load. you have something wrong with the path to your images.

You need to look into reading stack traces, you should be able to understand stack traces if your making games, they are easy to read, and will save you time. They usually point to exactly where the problem is.

1  
 at nl.tdegroot.games.nemesis.gfx.Resources.<init>(Resources.java:36)


The problem is within Resources file on line 36.
22  Game Development / Newbie & Debugging Questions / Re: Code runs in eclipse but wont run went exported as a runnable .jar on: 2013-08-21 14:34:29
run it in command prompt (or OS equivalent)

1  
java -jar jarFile.jar


where jarFile.jar is the name of your file.
23  Game Development / Newbie & Debugging Questions / Re: paulscode 3D sound issues on: 2013-08-20 14:45:46
For the small chance, your passing a global volume sound in, and its not specific to that sound file.

1  
soundSystem.setMasterVolume(1.0f);


Also, if you decide to reload the sounds into the sound system, you can specify the sound and specify the volume of a particular sound file.

1  
soundSystem.setVolume(sourceName, volume);


24  Discussions / General Discussions / Re: Music Licensees? on: 2013-08-17 16:33:34
For youtube music channels, if there a smaller channel, I am sure if you message them, they may be up for letting you use there music in your game. I know if you make youtube videos and you are going to use music from other music channels, they need to give you permission, or your account can get a strike.

another link for some sounds are:

http://www.freesound.org/

and Krasse's (who is a member on here) Abundant Music generator. The songs you make on it are public domain (I believe, unless he changed it)

http://www.java-gaming.org/topics/some-reasonable-output-from-my-generative-music-system/27309/msg/244046/view.html#msg244046

and if you can't find the link from his thread

abundant-music

25  Discussions / Miscellaneous Topics / Re: Yippieeee! Got my new Graphic card! on: 2013-08-16 07:50:18
In Australia a 8 core CPU (Intel Xeon E5 2650) is wroth $1295 and it is reduced to clear on the site I use to buy parts.

I think you have been lied to / misread the CPU, especially seeing as a 7670m is for laptops, I don't think you will ever find a laptop with a Xeon CPU in it.
26  Games Center / WIP games, tools & toy projects / Re: Phased's Horde Style Game on: 2013-08-06 14:45:03
Updated to V1.0.2

Accidently disabled time cycle before the original release for testing purposes. XD

Re-enabled Time cycle, the game should get darker and lighter as a day / night cycle.
Nothing new was added to the game, just removed a comment from a line of code!
27  Games Center / WIP games, tools & toy projects / Re: Phased's Horde Style Game on: 2013-08-06 07:38:20
Linux version should be fixed.

I used slashes instead of
1  
File.separator


Natives are pakced into the game, so it's not that.

If you get a error again. do these steps:

where you have the Launcher.jar a folder named Phased should be made.

Go inside the folder Phased.
Open CMD (Your Operating System equivalent)
and run Phased.jar through the CMD
"java -jar PathToFileHere"

and copy the error message and put it inside this thread or PM it to me.

Thanks Smiley

Updated and pushed to V1.0.1!

EDIT: Forgot to mention, you need to re-download the launcher, also changed a few lines of code.
28  Game Development / Game Mechanics / Re: How do you show blood? [STAY AWAY IF QUEEZY] on: 2013-08-05 13:07:45
I have had the texture for like a year or longer, If i remember right, it was on one of those free art sites.

and exactly what Opiop said, its not going to be used anywhere else then on here, and for my assignment, If I am going to sell a game, I would ask a friend to make them for me.

I am sure about 70% of the games in WIP, or more on this site, has at least one image that was found from google, another game.
29  Game Development / Game Mechanics / Re: How do you show blood? [STAY AWAY IF QUEEZY] on: 2013-08-05 05:44:27
For my blood texture, I really just googled an image, found one that looked alright, I could modify it to make it look a bit better, but it does the trick.

Like ReBirth mentioned, if you want it to be more accurate, you want to make it go in the right direction, mine is just random, starts from the player, and gets pushed out, It doesn't move for very long, and makes it look like its been pushed out a little.

To increase performance, you could check to make sure the blood is within the players view before rendering it, you could make the image fade away / disappear after a certain time, or after the player moves away from its view.

My game is pretty much the same concept as yours, so if you look how I do it, you may get a idea to improve it:

My Game
30  Games Center / WIP games, tools & toy projects / Re: Phased's Horde Style Game on: 2013-07-30 13:10:21
Updated to V0.1.2:
+ Added extra pick up items
+ Added a stat increase system
+ Health Regen item added, when picked up, the player will regen 10 hearts over 10 seconds
+ Damage increase item, when picked up, the player will do bonus damage for 10 seconds
+ Speed increase item, when picked up, the player will have increased speed for 20 seconds
+ Damage reduction item, when picked up, the player will receive less damage, (min damage to take is 1), lasts 10 seconds

Updated to V1.0.0 (1.0.0, because my assignment was due and handed in today)
+ New level
+ Changed some things around, nothing to notably
Pages: [1] 2 3 ... 8
 

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 (79 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (221 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!