Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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 ... 9
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-24 13:56:51
Tune Locks 2

A sequel to my Ludum Dare game "Tune Locks" for LD26.

EDIT: Link to my Tune Locks LD26 Entry
What the player can see without placing down lights:


When the player places lights down:


It it not all done today, I have been working on it for ages, now and again on and off. For a long time, it turned into my "tech demo" where I was just updating the rendering to VBO's, and trying to get more performance, as well as playing with shaders.

The game started out with just Immediate Mode rendering, then I learnt how to do VBO's more, so I changed the rendering. Then it became my text rendering test. I then decided to learn more about shaders, so I had to learn how to send the VBO data to the shader, and started to learn how to create lights.

By about the time that I learnt all of those, I set the project as "tech demo", planning to never finish the game, but use the current state to just learn new stuff. University started shortly after, and I didn't do much for a while, other then redo my text rendering, it is definitely not great, but idea was, lets just get text working, how ever ugly it looks, then polish it later, not just the code, but the image for the text is definitely not great and some letters are to far over, or to far up.

I then improved on the rendering again, fairly recently (within the last 2 or 3 weeks), I use to cap my lights at 10 or 20, because I would started to get like 300 FPS, down from like 2500 FPS with like 2 lights, and any more it would just go down a lot more. By the time i fixed the rendering, I was getting about 5000 FPS with 2 lights, and 300 FPS with about 126 lights. I can probably increase it a bit better, at the current state, the light is not limited to a certain distance. As well as making the puzzles a lot more easier and cleaner to implement into the game.

What I have done today, and yesterday was removed the limitation of having the level restricted to 32x20 pixels, as well as made the camera follow the player, but not go past the edge of the level, the player will stay in the middle until the camera locks to the side, then the player can gets unlocked until moved in the opposite direction to unlock the camera. I have also decided that I am going to remove it from my "tech demo" and try and finish the game, I have always wanted to, but never got around to it.
2  Game Development / Newbie & Debugging Questions / Re: How to reset the game ? on: 2014-07-19 15:50:12
If you want to reset a game, you don't want to "close the game" and restart it within the application.

To achieve the reset, just reset any variables back to the default.

I am going to assume you have an array of aliens, where you first put the aliens in the array, you could put it into a new method

1  
2  
3  
4  
5  
6  
7  
8  
9  
   public void createLevel(){
      aliens = new Alien[levelSize];
      for(int i = 0; i < levelSize; i++){
         alien[i] = new Alien();
      }
     
      //recreate or have a method inside player to change it back to the default values
     //and anything else you need to create for your game level
  }


something like that, and you can create new levels of any size pretty fast.

Edit: Ninjad, I hate formatting inside the post, so I always open up eclipse to format Sad just as i finished the code you posted it, but it was to much effort to delete!
3  Game Development / Performance Tuning / Re: Efficient Fog of War on: 2014-07-02 15:26:42
I am assuming it is 2D.

First of all, you shouldn't need to search through every tile, you should just check the tiles being rendered on the screen.

you can just recheck the fog of war when an actor moves.

you could only update the fog of war in locations where an actor moves, instead of checking every actor within view every time it updates, you could have only the tiles around the actor to update.

if your using shaders, you could just send an array of vectors, and create lights around the points, with the rest of the tiles being black / darkened.
4  Games Center / WIP games, tools & toy projects / Re: [Slick2d] Retro-Pixel Castles >>MAP EDITOR TECH DEMO RELEASED!!<< on: 2014-06-22 08:44:19
Don't think anyone mentioned it:

When hovering over the buttons in the tools on the map editor, you need to position the mouse more towards the center or even pretty much the last pixel of the last button, as the text starts off the edge of the screen.

not sure how you code your text rendering, but you should just check to see if the beginning x is less then 0, if it is put it to like x = 5 or something, so their is a little gap from the edge.
5  Game Development / Game Mechanics / Re: How would I do fading images? on: 2014-06-22 03:37:52
1  
GL11.glColor4f(red, green, blue, alpha);


4f meaning 4 float values.
6  Game Development / Game Mechanics / Re: How would I do fading images? on: 2014-06-22 03:34:19
A super easy way is to just change the alpha value.

To fade the image out, reduce the alpha. To fade it in, increase the alpha.
7  Game Development / Newbie & Debugging Questions / Re: Questions about port speed and game bandwidth required on: 2014-06-20 01:44:01
I am pretty sure most VPS (atleast the ones I have looked at) atleast provide 100/100 Mbit internet.

that "4000" players is theoretical in a perfect scenario, I am sure your ISP tells you you will get a certain amount, but really only get half of it. e.g. in my case I am suppose to get around 20Mbit down, but I only get between 5-7 MBit down. Also, 250Mbit may see like there super advanced, but more and more people are starting to get 1000Mbit internet (I believe the University I go to, their provider also supplies 10gbit internet, rumors that mine have it, but I have only heard people getting around 800 Mbit).

Also for that 4000, you are just taking in account of the network speed required to maintain 4000 players, are you sure your server can handle 4000 players and send 120000 (30 * 4000) packets and update the game at the same time?


TL;DR: You also need to take in account of the hardware required to have 4000 players at one time, which will most likely be the issue.
8  Game Development / Networking & Multiplayer / Re: How safe am I? on: 2014-05-03 10:58:45
go buy the cheapest server you can (http://www.123systems.net/ they have been pretty reliable for me, most likely you only need 1gb or 2b max) that has enough performance for what you need.

IF your game suddenly happens to become huge and your cheap server cant handle it, you can just change to a new company where your getting a better server.

IF your game turns out that you don't get the thousands of players you intended, you lost $50 (most likely $30 max) max for a years worth of server hosting to what you can recover from and try a new game and use the same server to host your game.

This $20-$50 you spent for 1 years worth of hosting saved you in electricity bill, which probably would of cost more if you used a home server based on the fact you had a spare computer. if you had to build a new computer to host the server, well you just saved a few hundred initial cost.
9  Game Development / Newbie & Debugging Questions / Re: glOrthod problem LWJGL on: 2014-04-26 07:22:26
What ever tutorial you are using is horrible.

IF you learn to debug, and start reading java docs, you will relise where you failed.

LWJGL javadoc for glOrtho
10  Game Development / Newbie & Debugging Questions / Re: LWJGL import problem (Rewritten) on: 2014-04-26 04:36:28
I think if you are having problems with setting up a Display, LWJGL is not for you yet. you need to learn to debug and research more into your problems.

I think you should take a step back and maybe use another library. Use something like LibGDX which is based on OpenGL, to learn more. LibGDX is probably more new user friendly, in the way of resources to learn how to make a game. You will get stuck a lot more in the future with using just LWJGL, and to solve problems you will need to convert from different languages, as to get the best resources for OpenGL most articles / tutorials are in C++.


Fixed code:
1  
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));




11  Game Development / Newbie & Debugging Questions / Re: How to control the game time-line. on: 2014-04-25 10:16:23
true, trollwarriors method would be better if your having a pausing within the game.
12  Game Development / Newbie & Debugging Questions / Re: How to control the game time-line. on: 2014-04-25 09:45:59
I highly doubt you will be having a problem with the CPU not being able to keep up, especially if it is 2D which I am thinking it is.

If you are having a CPU problem,  I think you may be doing something horribly wrong.

To pause the game, in your game loop, have a if statement around your update, and only let the game update if the game is not paused.
13  Game Development / Newbie & Debugging Questions / Re: How to control the game time-line. on: 2014-04-25 09:21:28
somewhere inside your wizards update, work out how to fit it into your code but something like this can detect if 2 seconds has past.

1  
2  
3  
4  
5  
6  
   long oldTime = 0; //set oldTime to when your wizard started the cast
  long timeDelay = 2000; //2000 milliseconds is 2 seconds

   if(System.currentTimeMillis() > oldTime + timeDelay){
      //your wizard has completed your 2 second cast
  }


EDIT: If you want to be more precise, you could use nano time instead of milliseconds, but I don't think you after precise timing, you just want it to work.
14  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.
15  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.
16  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.
17  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
}
18  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
19  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.
20  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.
21  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.
22  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
23  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.
24  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.
25  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
26  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);
}
27  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
28  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.

 
29  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
30  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.
Pages: [1] 2 3 ... 9
 

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

The first screenshot will be displayed as a thumbnail.

pw (22 views)
2014-07-24 01:59:36

Riven (20 views)
2014-07-23 21:16:32

Riven (17 views)
2014-07-23 21:07:15

Riven (20 views)
2014-07-23 20:56:16

ctomni231 (48 views)
2014-07-18 06:55:21

Zero Volt (44 views)
2014-07-17 23:47:54

danieldean (35 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!