Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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
1  Game Development / Shared Code / Re: EzEngine - Easy Wrapper for LWJGL on: 2013-04-19 10:44:33
Added for loops to TextRenderer.java, it now contains 70% less code Tongue
100 - (538 / (1771 / 100)) = 69,621682665160926030491247882552% reduction
2  Game Development / Shared Code / Re: EzEngine - Easy Wrapper for LWJGL on: 2013-04-17 13:43:07
hi I took a quick look at the source of your textrenderer and you probably should take a look at for loops

I know, just threw that TextRenderer together for an other project. (It's actually my first working text renderer Cheesy)
plus there are some font alignment issues(if you scroll down you'll see).
There were alot of copy-paste, but i'll probably look into adding some for loops at a later date.
3  Game Development / Shared Code / Re: EzEngine - Easy Wrapper for LWJGL on: 2013-04-17 12:00:31
After some a long time in the dark, this engine is now back.
I have already implemented TextRenderer and a 2D Graphics lib  Shocked

Example:
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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
import org.ezlwjgl.GL.*;
import org.lwjgl.input.Keyboard;

public class Example {

   public static void main(String[] args) {
      WindowManager.enableMouse = true;
      WindowManager.mouseGrab = true;
      WindowManager.enableKeyboard = true;
      WindowManager.createWindow("Test", 800, 600, 60);
      int texture = TextureLoader.loadTexture("/shop.png");
      while (true) {
         Renderer.make3D();
         Renderer.make2D();
         /**
          * ALIGN_CENTER align the text to center of screen
          * drawString(String text, int align) */

         Graphics.drawString("Center Aligned Text", Graphics.ALIGN_CENTER);

         /* drawString(String text, int textSize, double x, double y, double z) */
         Graphics.drawString("Absolute Coordinate Text", 1, 32, 250, 0);

         Graphics.drawString("Small text", .5, 32, 265, 0);

         Graphics.drawString("Big text", 2, 32, 275, 0);

         /* drawTexture(int textureID, double x, double y, double width, double height) */
         Graphics.drawTexture(texture, 0, 0, 32, 32);
         Graphics.drawString("<- Full texture draw", 1, 40, 8, 0);
         
         
         /**
          * Renders a tile from texture tile_x = tile x coordinate in pixels, tile_y = tile y coordinate in pixels, tile_w = tile width in pixels,
          * tile_h = tile height in pixels, size_x = texture width, size_y = texture height.
          *
          * drawTexture(int textureID, int tile_x, int tile_y, int tile_w, int tile_h, int size_x, int int size_y, double x, double y, double width, double height) */

         Graphics.drawTexture(texture, 0, 0, 16, 16, 32, 32, 0, 40, 32, 32);

         Graphics.drawString("<- Tiled texture draw", 1, 40, 48, 0);
         if (WindowManager.update() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
            break;
         }
      }
      WindowManager.destroyWindow();
   }
}

Produces:
4  Games Center / WIP games, tools & toy projects / Re: [WIP] [Open Source] RandomRPG on: 2013-04-04 13:44:30
Bug Fix:
Fixed problem where smoothing would pick the wrong tile.
Bug occured when two blocks(shore lines) were "touching".
5  Games Center / WIP games, tools & toy projects / Re: [WIP] [Open Source] RandomRPG on: 2013-04-04 12:45:00
UPDATE:
Added smooth textures, which are a little buggy.


Upcoming features:
Skill & Attributes system
Inventory & Equipment
Combat system

Possibly future features:
Convert rendering system to OpenGL(LWJGL or similar)
6  Game Development / Game Mechanics / Re: Smooth Graphics Algorithm? on: 2013-04-03 09:21:55
EDIT: Just to be clear, i already had the tiles. I only needed the code  Pointing

ME FIX Cheesy


Code: http://pastebin.java-gaming.org/24c7c4b2954
7  Game Development / Game Mechanics / Re: Smooth Graphics Algorithm? on: 2013-04-03 08:35:29
... Also how do you get the Memory Allocated?
Something like this:
1  
2  
memUse = (int) (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024;
bufferGraphics.drawString(String.format("Memory Usage: %sMB/%sMB", memUse, World.run.maxMemory() / 1024 / 1024), debugX + 1, debugY + 61);


It might not be completly accurate, but it works.
8  Game Development / Game Mechanics / [FIXED] Smooth Graphics Algorithm? on: 2013-04-02 15:31:42
I have a question:
What is the best way to do this: (smooth transitions, yellow is sand, blue is water, and white is "grass")

Hard edges:                                       Smooth edges:
 

currently, my plan is using this code(not finished): http://pastebin.java-gaming.org/2224c272c5b
S_NW / W_NW == SAND_NORTHWEST / WATER_NORTHWEST

But is this the fastest way? (probably not Tongue)

Screencap:

9  Game Development / Shared Code / Re: Reducing class file sizes (Java4K) on: 2013-03-19 08:17:33
Can you explain what this exactly does in more detail? How does it achieve the reduction?

I have made the reductions myself, I change Variable names and changes the code around.
So that the final class file would be smaller Cheesy

Code changes:
https://code.google.com/p/random-rpg/source/diff?path=/A.java&format=side&r=5 (First and final version comparison)
10  Game Development / Shared Code / Re: Reducing class file sizes (Java4K) on: 2013-03-15 17:23:16
Wait, you're talking about reducing class files for java4k but why all I see is lwjgl with physics?

Yes, this project originally was about using JBox2D with LWJGL as graphics lib.
But when i started editing(shortening variables), the class file started shrinking dramatically(~50bytes Tongue).

Then i started thinking why not try to make it smaller and smaller.
This way I will learn about shrinking games for Java4K (this game is not a Java4K game).
11  Game Development / Shared Code / Reducing class file sizes (Java4K) on: 2013-03-15 15:05:44
A little project i have, trying to reduce the size of a Java Class file.
Without removing any features.

Original Size: 5736bytes
Current reduction: 3150bytes removed (~55% reduction) (Pure javac compile, no compression or proguard)
With Proguard(class only): 3219bytes removed (~56% reduction)
Compressed Jar: 4219bytes removed (~73% reduction)
Compressed Proguard Jar: 4304bytes removed (~75% reduction)

NOTES:
Rolling your own builder in eclipse pays off, got a ~550b reduced class file size Cheesy

Fell free to leave any comments/tips which can help in my quest Cheesy

Source Code:
Final - http://pastebin.java-gaming.org/311b3907443
v1.4 - http://pastebin.java-gaming.org/e905a337341
v1.3 - http://pastebin.java-gaming.org/9e9052a7343
v1.2 - http://pastebin.java-gaming.org/19e90157a43
v1.1 - http://pastebin.java-gaming.org/619e900754a
v1.0 - http://pastebin.java-gaming.org/4619e996045 - This is not the first version, it's the first version i had access to.


I kept a little changelog: (Number prefixes are class sizes in bytes)
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  
Prefix = bytes

5736 First

5712 Changed .76f to .75f
5707 Chaged wall/roof/floor size to 50 instead of 1000
5693 .. Some random shit (but it still works)
5687 .. Some random shit (but it still works)
5449 Removed debugging(box pos)
5330 Removed boolean isAlive and changed to !Display.isCloseRequested
5169 Shortened some variable names
5096 Removed unnecessary code.
4984 Removed unnecessary code.
4708 Reusing variables
4640 Reusing variables
4638 Shortened Variable name
4610 Changed !Display.isCloseRequested() to !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)
4609 Removed unnecessary code.
4603 Changed some floats to ints
4055 Reused some variables FixtureDef, BodyDef & PolygonShape (used .clone())
3882 Removed unnecessary code.
3855 Removed unnecessary code.
3653 Removed unnecessary code.
3598 Changed Math.toDegrees() to Radian * (180 / 3.1415)
3547 Changed getContactList() to b.getPosition().y < .77f
3518 Removed unnecessary code.
3363 Reused some variables.
3339 Removed unnecessary code.
3275 Various fixes.
3238 Removed glDisable(GL_DEPTH_TEST) as it was never enabled by glEnable()
2683 Implemented custom builder into Eclipse. psuedo cmd: javac -cp "PROJECT_CP" -g:none SOURCE_FILE -d OUT_FOLDER
2586 Removed unnecessary code and various fixes.
12  Game Development / Newbie & Debugging Questions / Re: JBox2D & LWJGL Problem on: 2013-03-15 09:04:56
I found the problem Cheesy
I was using:
1  
2  
3  
float step = 1 / 60f;
// While and sutff here ----
World.step(step, 8, 1);

But this did not work as it should Sad

Fix:
1  
World.step(1/60f, 8, 1);

This works! Cheesy
13  Game Development / Newbie & Debugging Questions / Re: JBox2D & LWJGL Problem on: 2013-03-14 16:50:43
Oh. I guess that´s what happens when you just take "a quick look". Sorry about that. Smiley

Just to clarify: "right" and "left" works fine, it´s just "up" that´s causing a problem?


Yes, right and left works fine. But not up or the walls Sad
14  Game Development / Newbie & Debugging Questions / Re: JBox2D & LWJGL Problem on: 2013-03-14 15:56:28
I just took a quick look and in the shrunk version you overwrite bS, fS, pS all the time and in the other version you have separate objects for boxDef, groundDef etc. Perhaps that has something to do with it?

I read on the Box2D forums, that the *Def can be reused. But maybe i did something wrong somewhere... :s

Quote
On a sidenote: Is the shrunk version only shorter variable names? In that case I think you should ditch the shrunken version. Why would you want to change your code to something that´s much harder to read? Smiley
It makes the final Class file smaller Cheesy
I'm secretly practicing for Java4K!
EDIT: PolygonShape has a .clone() so thats not the problem, as I clone it before I reuse it.
EDIT2: On the other hand, maybe reusing variables only work in the C/C++ version Sad
15  Game Development / Newbie & Debugging Questions / [FIXED] JBox2D & LWJGL Problem on: 2013-03-14 15:28:17
Removed Cheesy
FIXED IT!
Moved to: http://www.java-gaming.org/topics/reducing-class-file-sizes-java4k/29004/view.html

Solution:
I found the problem Cheesy
I was using:
1  
2  
3  
float step = 1 / 60f;
// While and sutff here ----
World.step(step, 8, 1);

But this did not work as it should Sad

Fix:
1  
World.step(1/60f, 8, 1);

This works! Cheesy
16  Games Center / Cube World Projects / Re: Voxel - a start on: 2013-03-12 13:52:33
If you need terrain generation look at mine Smiley
http://www.java-gaming.org/topics/terrain-generator/27502/view.html

Local Copy: https://dl.dropbox.com/u/39535549/Volt.jar (Demo + Source)
17  Game Development / Performance Tuning / Re: Java Brute Forcing Algorithm Optimization. on: 2013-03-05 12:02:34
I have made a fully recursive version of this in C.
http://pastebin.java-gaming.org/652ff3f5941

It shouldn't be to hard to translate to Java. (Thats why I did it for you Cheesy)
Java:
http://pastebin.java-gaming.org/52fff495143

EDIT:
Actully doing some tests i found out that Java version is faster on longer passwords(strings).
While C is faster at smaller strings like 1-3 chars...

for example in one test:
In C version, "breakm", took ~320seconds,
while in Java version it took ~69seconds.
18  Java Game APIs & Engines / OpenGL Development / Re: OpenGL learning W/O internet access on: 2013-02-10 21:47:09
Download documentation and/or ebooks
19  Discussions / General Discussions / Re: New feature: appreciation results in post medals on: 2013-02-04 14:36:07
http://www.java-gaming.org/domain_seized.jpg Tongue
20  Game Development / Newbie & Debugging Questions / Re: Noob Projects? on: 2013-02-04 11:27:34
Screw around with Console(as in text-based) Games, just to get the feel of making a game(not concerning yourself about graphics or sound),
then move on to Java2D(or similar, libGDX, slick, etc.),
then you can move on to learning OpenGL and make a OpenGL Accelerated 2D games with basic sound(OpenAL),
and finally move onto 3D(OpenGL).

But don't get to excited, this is not a small learning curve.
It will take time and dedication to get from start to finish...

Good Luck  Grin
21  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-02-01 13:22:51
A little Demo "Game"(not finished), showing off some Cel Shading Tongue
Download
22  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-02-01 10:07:15
Uploaded a Jar Library, which you can include in your project.
You will also need to include the LWJGL libs too.

I'm now going to make a small/medium game with this library,
and I will only use the functions included in this library.
By doing this I can implement missing features into the library.
23  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-31 13:45:37
Added Camera Controls,
WASD - Move Camera
Mouse - Rotate Camera Pitch & Yaw
24  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-31 09:35:59
Fixed buggy Cel-Shading and Added demo application download.
25  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-30 15:30:46
Small tweaks and updated Example.java

EDIT:
Rendered outline behind the cube, (buggy) Cel Shading FTW
26  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-30 10:27:09
New Features:
Made Renderer class static.
Added 2D and 3D support, Renderer.make2D() & Renderer.make3D()
Started working on a ModelBuilder.
27  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-28 15:24:35
The author of the Google Code files say Lasse Skogland, are you Scandinavian (perhaps even Swedish) by any chance?

I'm norwegian Smiley
28  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-28 12:23:45
reAdded GLRenderer class.
You can now create your own renderer.

Example:
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 MyGLRenderer implements GLRenderer {

   public void render(Model m) {
      glEnableClientState(GL_VERTEX_ARRAY);
      glVertexPointer(3, 0, m.getModel());

      if (m.isColored()) {
         glEnableClientState(GL_COLOR_ARRAY);
         if (m.isRGBA()) glColorPointer(4, 0, m.getColor());
         else glColorPointer(3, 0, m.getColor());
      }

      if (m.isTextured()) {
         glEnableClientState(GL_TEXTURE_COORD_ARRAY);
         glBindTexture(GL_TEXTURE_2D, m.getTexture());
         glTexCoordPointer(2, 0, m.getTextureCoords());
      }

      glDrawArrays(GL_TRIANGLES, 0, m.getVertexNum() / 3);
      glDisableClientState(GL_VERTEX_ARRAY);

      if (m.isColored()) glDisableClientState(GL_COLOR_ARRAY);
      if (m.isTextured()) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
   }

}
29  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-25 16:20:43
Project currently on hold... Stare
Will start developing a SDL port of this project


EDIT:
Kicking life back in this project, will probably port to SDL later (maybe) Undecided
30  Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering on: 2013-01-24 10:00:43
I'm planning on adding the following features(in the near feature):

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
Renderer r;

r.renderCube(float x, float y, float z, float size);
r.renderTexturedCube(float x, float y, float z, float size, int textures[]); // texture[] should consist of 6 textures (0 = top, 1 = bottom, 2 = northface, 3 = westface, etc.)

// renderTexturedCube() explanation:
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{0, 0, 0, 0, 0, 0} /*or pass null*/); // This would be the same as r.renderCube()
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, 0, 0, 0, 0}); // This would apply textures to top and bottom, and ignore the others.
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, textureSides, -1, -1, -1}); // This would apply textures to top and bottom, and will use the northFaceTexture on all sides.
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, textureSides}); // Same as above


I will probably also add other primitive shapes.
Pages: [1] 2 3
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
BrassApparatus (6 views)
2013-06-19 08:52:37

NegativeZero (10 views)
2013-06-19 03:31:52

NegativeZero (12 views)
2013-06-19 03:24:09

Jesse_Attard (17 views)
2013-06-18 22:03:02

HeroesGraveDev (59 views)
2013-06-15 23:35:23

Vermeer (59 views)
2013-06-14 20:08:06

davedes (58 views)
2013-06-14 16:03:55

alaslipknot (52 views)
2013-06-13 07:56:31

Roquen (73 views)
2013-06-12 04:12:32

alaslipknot (58 views)
2013-06-10 19:30:18
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
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!