Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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 ... 58
1  Discussions / General Discussions / Re: dalvik, you suck on: 2014-07-23 02:07:42
List.remove(Object) and List.remove(index) are easily confused in the case of List<Integer>
That's why in my pretty Array class it's removeValue(T value, boolean identity) and removeIndex (int index). Cheesy
2  Java Game APIs & Engines / OpenGL Development / Re: [LibGDX] How on earth do I limit drawing to a certain area of the screen? on: 2014-07-15 09:57:29
ScissorStack (uses glScissor) for arbitrary drawing. For stage use Table#setClip(true).

You can draw your game in the right place then the UI on top without needing any clipping.
3  Game Development / Newbie & Debugging Questions / Re: Kryonet Optimization With #sendTCP() on: 2014-07-14 19:02:56
1  
2  
sendTCP(new ByteTest()); // #1
sendTCP(new IntTest());  // #2

This sends:

1  
2  
3  
4  
varint (ByteTest class ID)
byte (ByteTest#b)
varint (IntTest class ID)
varint (IntTest#i)

Probably the class IDs are 1 byte, unless you register > 64 classes. IntTest#i is 1 byte for -64 to 64, etc. Larger ints use more bytes. You can also adjust the varint to be 1 byte from 0 to 128, eg if you knew it should never be negative.

Your two sends use 4+ bytes. There is no point optimizing this. Any send < the MTU size (~1400) is likely sent in a single packet anyway.
4  Game Development / Performance Tuning / Re: Libgdx - Speed up render of many polygon regions on: 2014-07-14 13:42:10
Your fps is capped at 60 on Android so maybe you just can't see improvements. No idea what they might be though. OpenGL will do culling and you aren't sending the geometry every frame, so you make OpenGL's culling faster by caching less. There may be a bigger difference if you draw from many textures.
5  Games Center / WIP games, tools & toy projects / Re: TUER: Truly Unusual Experience of Revolution, FPS using JOGL on: 2014-07-13 16:59:46
Oh it's Mario's tool, not mine. Smiley Limitations, yeah most likely. An .app is a directory structure. Not sure which OSX versions, likely all that matter (OSX users almost have to stay up to date). I like zip files for all OSes, but users don't.
6  Games Center / WIP games, tools & toy projects / Re: TUER: Truly Unusual Experience of Revolution, FPS using JOGL on: 2014-07-13 06:58:13
Try this: https://github.com/libgdx/packr
Then you just need NSIS to make a Windows installer. NSIS can be run on POSIX systems to compile a Windows installer.
7  Game Development / Performance Tuning / Re: Libgdx - Speed up render of many polygon regions on: 2014-07-13 06:46:39
SpriteCache uses a VBO and could serve as an example. SpriteCache caches geometry in a VBO (via Mesh) for any number of textures, keeps track of the offsets and allows you to reference that geometry by an ID. When you draw, you give the ID and the geometry is drawn from the VBO, without needing to be sent to the GPU again. Similar to SpriteBatch, SpriteCache caches quads. There is no PolygonSpriteCache, but you could write one. Getting the array indexes, etc exactly right was a bit tricky. Smiley PolygonSpriteCache would make a nice contribution to libgdx, but it may be easier for your scenario to use Mesh directly.

Beyond using the VBO, you'll need to determine what geometry to cache. Usually you'd choose the geometry on screen, plus some buffer around that. Only when the camera moves far enough would you need to re-cache your geometry. You want to cache enough that re-caches don't happen too often, but not so much that a re-cache takes too long. OrthoCachedTiledMapRenderer could serve as an example, it does this for a tile map using SpriteCache.
8  Game Development / Shared Code / Re: Scene2D replacement for Window on: 2014-06-11 00:49:34
Window was one of the first widgets in scene2d.ui and was built in a simple way. scene2d.ui has evolved a lot since then and Window is probably overdue for a rewrite. It shouldn't be too hard to write your own, as you found. When building an app with scene2d.ui, don't hesitate to build widgets specifically for your application.
9  Discussions / Miscellaneous Topics / Re: Infatuated on: 2014-06-02 23:30:08
She has another crush and i told her all my feelings. She said i deserve someone better but that's just a way of saying " i don't like you like that"
This actually means you deserve someone better. Sometimes you need to listen instead of hearing what you want to hear.
10  Discussions / Miscellaneous Topics / Re: Random syntax tweaks! on: 2014-05-31 22:32:43
"if(!(somevar > 0))" works just fine in Java.
11  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-29 17:45:01
Agreed, CSS is possibly the worst way to do layout.
12  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-24 09:46:29
I must learn JavaFX.... making GUIs in OpenGL and strangely designed XML is getting less and less appealing...

Sigh...  Lips Sealed
13  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Libgdx GL20 methods on: 2014-05-24 09:43:08
It isn't documented because it is OpenGL.
https://www.google.com/search?q=glVertexAttribPointer
14  Game Development / Newbie & Debugging Questions / Re: Libgdx Texture Array because of bleeding on: 2014-05-24 01:07:30
You can still have a standard tile size for placement and the collision layer. The way it works is the image for a tile can simply be any size. Makes it much easier to build maps. FWIW, Super Spineboy does this (using Tiled but the idea is the same).
15  Game Development / Newbie & Debugging Questions / Re: Libgdx Texture Array because of bleeding on: 2014-05-23 17:26:27
separate images for tiles... thats a nightmare for the artists. Every time there is something bigger than the tilesize they would have to cut it up, and then you would have to somehow pack it perfectly onto the tileset which happens automatically.
Tiles in libgdx are not limited to a specific size. You don't need to break a large image up into many small images, you can just use the large image.
16  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [libgdx] Drag and drop with scene2d tree on: 2014-05-23 17:22:35
1  
2  
3  
4  
// Select node under mouse if not over the selection.
Node overNode = tree.getNodeAt(y);
if (overNode == null && tree.getSelection().isEmpty()) return null;
if (overNode != null && !tree.getSelection().contains(overNode)) tree.getSelection().set(overNode);
17  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [libgdx] Drag and drop with scene2d tree on: 2014-05-23 09:31:42
Use DragAndDrop, add the tree as both a source and target. In the source, use the selected nodes for what to drag (can select the node under the mouse if nothing is selected). In the target, use Tree#getNodeAt(float y) to determine where the drop would happen. If getNodeAt is null and the mouse is over the tree, you know you are after the last visible node. Position an actor that is a sibling to the tree if you want to show where the drop will insert.
18  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-23 09:22:19
Where do you think I got the information I used? I didn't pull it out of my ass. I figured it out anyway.
You asked for help before making reasonable effort yourself.

Quote
I never instruct those who aren't full of passion, and I never enlighten those who aren't struggling to explain themselves. If I show you one corner and you can't show me the other three, I'll say nothing more. -Confucius
This forum has a nice ignore feature. Best of luck!
19  Game Development / Newbie & Debugging Questions / Re: Libgdx Texture Array because of bleeding on: 2014-05-23 09:09:54
I suggest using individual images in Tiled and then pack your images into an atlas for use at runtime (see AtlasTmxMapLoader). This allows you to change how the images are packed (padding, which images are on what atlas page, etc) without breaking your Tiled map.

Otherwise you could maybe fork libgdx, see the Mesh constructor which takes a VertexDataType. You'd need to add a new VertexData implementation.

trollwarrior1's approach is even simpler, just move UVs one texel toward the region center. This will stretch your images but filtering won't pick up neighboring regions (it will pick the texel you excluded).
20  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-22 11:18:55
RTFM
21  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 15:53:08
Haha Cheesy Nah, everyone knows scene2d is hard to use. And table? WTH is a table?!
22  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 15:07:52
Classic! Going overboard to help somebody, getting a 'nah' as response Smiley
When will I learn?  Huh
23  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 11:32:57
You didn't specify you wanted the UI created with Java2D. If you are making a game, using Java2D is not the way to do it.
24  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 10:46:30
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  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.badlogic.gdx.utils.viewport.Viewport;

public class Mockup extends ApplicationAdapter {
   static final boolean debug = true;

   Viewport viewport;
   Stage stage;
   Skin skin;

   Actor currentScreen;

   public void create () {
      viewport = new ScreenViewport();
      stage = new Stage(viewport);
      Gdx.input.setInputProcessor(stage);
      createSkin();
      setScreen(new MainMenu());
   }

   void createSkin () {
      skin = new Skin();

      // Generate a 1x1 white texture and store it in the skin named "white".
     Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
      pixmap.setColor(Color.WHITE);
      pixmap.fill();
      skin.add("white", new Texture(pixmap));

      // Store the default libgdx font under the name "default".
     skin.add("default", new BitmapFont());

      // Configure a TextButtonStyle and name it "default".
     TextButtonStyle textButtonStyle = new TextButtonStyle();
      textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
      textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
      textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
      textButtonStyle.font = skin.getFont("default");
      skin.add("default", textButtonStyle);

      // Configure a LabelStyle and name it "default".
     LabelStyle labelStyle = new LabelStyle();
      labelStyle.font = skin.getFont("default");
      skin.add("default", labelStyle);
   }

   public void render () {
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      stage.act();
      stage.draw();
      Table.drawDebug(stage);
   }

   public void resize (int width, int height) {
      viewport.update(width, height, true);
   }

   void setScreen (Actor newScreen) {
      int screenWidth = Gdx.graphics.getWidth();
      if (currentScreen != null)
         currentScreen.addAction(sequence(parallel(moveBy(-screenWidth, 0, 0.750f), fadeOut(0.750f)), removeActor()));
      currentScreen = newScreen;
      stage.addActor(newScreen);
      newScreen.setX(screenWidth);
      newScreen.getColor().a = 0;
      newScreen.addAction(parallel(moveBy(-screenWidth, 0, 0.750f), fadeIn(0.750f)));
   }

   class MainMenu extends Table {
      TextButton challenge30sButton, challenge1mButton, challenge5mButton, achievementsButton, highScoresButton;

      public MainMenu () {
         super(skin);
         if (debug) debug();
         createWidgets();
         createLayout();
         createEvents();
      }

      void createWidgets () {
         challenge30sButton = new TextButton("30 Second Challenge", skin);
         challenge1mButton = new TextButton("1 Minute Challenge", skin);
         challenge5mButton = new TextButton("5 Minute Challenge", skin);
         achievementsButton = new TextButton("Achievements", skin);
         highScoresButton = new TextButton("High Scores", skin);
      }

      void createLayout () {
         setFillParent(true);
         add("Game Name").row();
         pad(10).defaults().space(10).fillX();
         add(challenge30sButton).row();
         add(challenge1mButton).row();
         add(challenge5mButton).row();
         add(achievementsButton).row();
         add(highScoresButton).row();
      }

      void createEvents () {
         ClickListener gameOverListener = new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new GameOver());
            }
         };
         challenge30sButton.addListener(gameOverListener);
         challenge1mButton.addListener(gameOverListener);
         challenge5mButton.addListener(gameOverListener);
         highScoresButton.addListener(gameOverListener);

         achievementsButton.addListener(new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new Achievements());
            }
         });
      }
   }

   class Achievements extends Table {
      ScrollPane scroll;
      Table itemsTable;

      public Achievements () {
         super(skin);
         if (debug) debug();
         createWidgets();
         createLayout();
         populate();
      }

      void createWidgets () {
         itemsTable = new Table();
         scroll = new ScrollPane(itemsTable);
      }

      void createLayout () {
         setFillParent(true);
         add(scroll).expand().fill();

         itemsTable.pad(10).defaults().fillX().space(10);
      }

      public void populate () {
         ClickListener mainMenuListener = new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new MainMenu());
            }
         };
         for (int i = 0; i < 50; i++) {
            TextButton button = new TextButton("Achievement " + (i + 1), skin);
            itemsTable.add(button).row();
            button.addListener(mainMenuListener);
         }
      }
   }

   class GameOver extends Table {
      TextButton submitButton, shareButton, againButton;

      public GameOver () {
         super(skin);
         createWidgets();
         createLayout();
         createEvents();
      }

      void createWidgets () {
         submitButton = new TextButton("Submit High Score", skin);
         shareButton = new TextButton("Share Score", skin);
         againButton = new TextButton("Play Again!", skin);
      }

      void createLayout () {
         setFillParent(true);
         add("Game Name").row();
         pad(10).defaults().space(10).fillX();
         add("Your score: " + MathUtils.random(10, 100)).row();
         add(submitButton).row();
         add(shareButton).row();
         add(againButton).row();
      }

      void createEvents () {
         ClickListener mainMenuListener = new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new MainMenu());
            }
         };
         submitButton.addListener(mainMenuListener);
         shareButton.addListener(mainMenuListener);
         againButton.addListener(mainMenuListener);
      }
   }

   public static void main (String[] args) throws Exception {
      LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
      config.width = 320;
      config.height = 480;
      new LwjglApplication(new Mockup(), config);
   }
}

It is completely self contained, you just need to paste it into a libgdx project. Use it as a start to learn this stuff yourself!
25  Game Development / Performance Tuning / Re: Cache locality and LibStruct - fixing Java's horrible memory layout on: 2014-05-20 17:43:48
How about showing some code so I can see the difference with and without LibStruct without putting in much effort? Cheesy
26  Discussions / General Discussions / Re: Is it just me, or does everyone's GUI code look like spaghetti? on: 2014-05-16 16:40:03
Just add support for panels, in which components have an offset relative to their parent. Then pump events through the root, and let the panel deliver the events to the descendants, making the coordinates relative to each component you pass them through - just like AWT, Swing, HTML, etc.
Aka a scene graph! Cheesy I don't think they are listening though.
27  Games Center / Showcase / Re: Super Spineboy on: 2014-05-15 09:41:55
Thanks. Smiley Spineboy looks aliased in the screenshots and when the window is sized smaller because the source graphics are pretty high resolution. It should look nice maximized or full screen (alt+enter or use the menu):



You can see how the skeleton size is computed here:
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/Assets.java#L93
This sets the scale of the skeleton data loaded from JSON to "Player.height / Player.heightSource". Player.height is the height you want the player in game units. Player.heightSource is the height the player was in Spine in pixels. So if you want the player 10 game units tall and it was 200 pixels tall in Spine, you'd use a scale of 10/200=0.05.

That is how you would scale the skeleton data to whatever you use for units in your game. Eg, with Box2D you may be using meters instead of pixels. However, the same technique can be used to scale the skeleton data to match a texture atlas of a different size. When you pack your texture atlas, you might scale it up or down. Spine can pack an atlas using a scale, so can Texture Packer Pro, etc. You probably want to pack 2-3 atlases at different sizes to target a few resolutions. At runtime you choose the best atlas for the resolution and set the scale accordingly. Eg, if you pick an atlas that is 33% the size of the art used in Spine, you would use "json.setScale(0.33f)". Of course you can combine this with a scale for your game units, "json.setScale(Player.height / Player.heightSource * 0.33f);".
28  Discussions / General Discussions / Re: New Personal Virtual Reality Headset System – ANTVR KIT on: 2014-05-14 22:31:48
It looks neat. The gun is cool, especially as standard equipment. Converting to a joystick is neat, but the controller looks like it would be flimsy. The English in the video was a bit painful, but I understand you guys wanted the actual team to be in the video. I would have liked to see more about what sets it apart from the Occulus, which is the elephant in the room. Also, I tried an Occulus and instantly wanted to take it off. I couldn't stand a screen so close to my eyes. I don't know if this would happen to me on yours, so I have a hard time backing.
29  Java Game APIs & Engines / OpenGL Development / Re: Design or pattern for handling background consumer/producer tasks on: 2014-05-14 22:19:49
libgdx's AssetManager is a system for running tasks that can have a part on the GL thread and a part on a separate thread. It was quite tricky to get right. This enables rendering a progress bar (or other anything else) while things are loading. It also has ref counting, so assets can auto unload when no longer needed.

Another experience I have similar to what you are asking about I solved with Riven and MatthiasM's green thread library:
https://github.com/riven8192/LibContinuations
This allowed me to run code on the render thread, but yield so I can still render things. Without being able to yield in my tasks, I would have had to store an enormous amount of state so I could resume the work later.
30  Discussions / General Discussions / Re: Is it just me, or does everyone's GUI code look like spaghetti? on: 2014-05-14 09:52:21
Look at how a 2D scene graph works.
Pages: [1] 2 3 ... 58
 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (11 views)
2014-07-30 21:08:39

Riven (21 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

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

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

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

Riven (30 views)
2014-07-23 20:56:16
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!