Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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 ... 6
1  Game Development / Newbie & Debugging Questions / [LibGDX] 3D Terrain tutorials? on: 2014-12-23 18:50:47
From the research that I've found while doing my googling over the last hour, LibGDX used to have an example called TerrainTest that was available; However after GL10 it wasn't updated anymore, and was removed. I'm having a hard time finding any information on terrains; considering my game is just going to have a flat terrain I've decided I'll just use a really thin cube as the ground, but I'm curious as to where I can find information on terrains for learning purposes.
2  Game Development / Newbie & Debugging Questions / Re: Starting with 3D in Java, Where should I begin? on: 2014-12-23 16:06:53
Thanks guys, I've got a decent grasp on what's going on so far; The only problem I'm having [LibGDX related] is finding models that will work, most of the .obj models I convert to g3db don't have texutres, and all of the FBX models I convert throw errors about missing Spec.png.
3  Game Development / Newbie & Debugging Questions / Re: NullPointer with basic LibGDX. Following examples. on: 2014-12-23 15:28:41
AH! I figured out what it was; The example was rendering an ArrayList<> of ModelInstances, and not just a single model instance; So when the array was empty, there wasn't any effect; However in my case since I am just rendering a single instance, I need to make sure that the model is completely loaded before rendering.
4  Game Development / Newbie & Debugging Questions / Re: NullPointer with basic LibGDX. Following examples. on: 2014-12-23 15:21:50
Well, when is the onAssetsLoaded() function called? Try adding print statements to find that out as well.

It seems like the problem is that

1  
assets.update()


is never being set to true, so the following code:

1  
2  
3  
if(preloading && assets.update()) {
         onAssetsLoaded();
      }


is never executed.
5  Game Development / Newbie & Debugging Questions / Re: NullPointer with basic LibGDX. Following examples. on: 2014-12-23 15:17:22
What are the values of playerModelInstance and environment when that line of code runs? Add print statements just before that line to find out.


Sorry, I should have posted that information I already had it.

1  
2  
Player Model Instance = null
Game Environment = com.badlogic.gdx.graphics.g3d.Environment@46212667


My confusion is why the instance is null when it's obviously set:

1  
2  
3  
4  
5  
6  
private void onAssetsLoaded() {
     
      playerModel = assets.get("models/characters/goku/ss2.g3db", Model.class);
      playerModelInstance = new ModelInstance(playerModel);
      preloading = false;
   }
6  Game Development / Newbie & Debugging Questions / [solved]NullPointer with basic LibGDX. Following examples. on: 2014-12-23 15:10:24
I'm following this tutorial for loading models using LibGDX: http://blog.xoppa.com/loading-models-using-libgdx/

I'm getting a nullpointer on this line:

1  
modelBatch.render( playerModelInstance, environment );


After some code reformatting, I saw that the

1  
modelBatch.render( 


was the cause of the error.

Here's my error

1  
2  
3  
4  
5  
Exception in thread "LWJGL Application" java.lang.NullPointerException
   at com.badlogic.gdx.graphics.g3d.ModelBatch.render(ModelBatch.java:265)
   at com.chris.rpg.Client.render(Client.java:74)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)


Here's my code:

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  
package com.chris.rpg;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL30;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;


public class Client implements ApplicationListener  {
   
   private PerspectiveCamera playerCamera;
   
   private AssetManager assets;
   
   private Model playerModel;
   private ModelBatch modelBatch;
   private ModelInstance playerModelInstance;
   
   private Environment environment;
   
   private int placeholder_cameraDegrees = 67;
   
   private boolean preloading = false;
   
   @Override
   public void create() {
     
      // Set up the environment
      environment = new Environment();
      environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
      environment.add(new DirectionalLight().set(0.8f, 0.8f,0.8f, -1f, -0.8f, -0.2f));
     
      // Set up the model batch
      modelBatch = new ModelBatch();

      // Set up the player camera
      playerCamera = new PerspectiveCamera(placeholder_cameraDegrees, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      playerCamera.position.set(10f, 10f, 10f);
      playerCamera.lookAt(0, 0, 0);
      playerCamera.near = 1f;
      playerCamera.far = 300f;
      playerCamera.update();
     
      // Set up the assets manager
      assets = new AssetManager();
      assets.load("models/characters/goku/ss2.g3db", Model.class);
      preloading = true;
   }
   
   private void onAssetsLoaded() {
     
      playerModel = assets.get("models/characters/goku/ss2.g3db", Model.class);
      playerModelInstance = new ModelInstance(playerModel);
      preloading = false;
   }
   
   @Override
   public void render() {
      if(preloading && assets.update()) {
         onAssetsLoaded();
      }
     
      Gdx.gl.glViewport(0,  0,  Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT | GL30.GL_DEPTH_BUFFER_BIT);
      modelBatch.begin(playerCamera);
         modelBatch.render( playerModelInstance, environment );
      modelBatch.end();
     
   }
   
   @Override
   public void dispose() {
      modelBatch.dispose();
      playerModel.dispose();
      assets.dispose();
   }
   
   @Override
   public void resume() {
     
   }
   
   @Override
   public void resize(int width, int height) {
     
   }
   
   @Override
   public void pause() {
     
   }
   
   public PerspectiveCamera getPlayerCamera() {
      return playerCamera;
   }
}


7  Game Development / Newbie & Debugging Questions / Starting with 3D in Java, Where should I begin? on: 2014-12-23 13:21:21
I should start off by saying that I'm definately not new to the Java programming language; However I'm mainly a server developer and have done the multiplayer for a few different games. I've never gotten around to actually learning about the rendering and such and I'm at that point where I believe it would do me justice to have the experience. Working with game engines such as Unity3D is getting really boring, and I hate the fact that I don't understand what's going on behind the scenes at all. So, I've decided to start to take a step into the 'DIY' direction.

I don't personally care if it's low-level or high-level code that I'm working with, just the idea of writing in Java pleases me. It's by far my favorite language. I have a friend that writes 3D applications using LWJGL and jPCT, which uses MD2 models. MD2 models are pretty much a thing of the past now, aren't they? Haven't we moved on?

My goal is to create a basic 3D dungeon crawler type game; However game-mechanics aren't the problem, it's just getting it on the screen.

I have always liked LibGDX; So I wanted to use it for this, but I can't find ANY TUTORIALS on 3D development. I may just be blind. The main thing that I'm looking for is a tutorial explaining the following:

  • Creating a camera
  • Drawing a terrain
  • Drawing a static model
  • An example of model animations would be nice, but is definitely not required for a long while

With those basics I can start to create my player, movement systems, combat, and the likes fairly easily
8  Game Development / Networking & Multiplayer / Re: Moving from a String based approach? on: 2014-07-28 20:47:05
KyroNet is better than Netty?

Could you please provide more information? I can't find any benchmark comparisons, etc.

The reason I chose Netty was due to the fact I use a C# based client.
I was reading the KyroNet didn't support C# Clients, as it used a special network layer? Not sure, never got into it.
9  Game Development / Networking & Multiplayer / Moving from a String based approach? on: 2014-07-28 16:20:06
I want to make my networking better. I'm working with the Netty API and I've written a Client/Server application that breaks apart a String that's been sent over the network and figures things out. An example of my Login packet would look like this.

1  
[1]Username@Password


Where [1] is the packet Id, and then the user/pass (all data, really) is split by the character '@'

1  
2  
3  
4  
5  
6  
7  
out.build(176, player.getSession())
                .writeByte(recoveryChange, ValueType.C)
                .writeShort(messages, ValueType.A)
                .writeByte(memberWarning ? 1 : 0)
                .writeInt(lastLoginIP, ByteOrder.INVERSE_MIDDLE)
                .writeShort(lastLogin);
        out.sendPacket();


Here is an example of what I'm looking for. Something that creates a packet like such. I've been looking and looking, and I have a github for a server project that uses this type of networking, but I don't understand it.  I'm looking more so on tutorials/documentation for this.
10  Game Development / Networking & Multiplayer / Re: 10 Player(instanced) 3D Game, would TCP Suffice? on: 2014-07-17 03:34:58
10 players? Battlefield 1942 could support 64 players, and I recall games with something between 16 to 32 players not being that rare.

I'm not sure why the average playercount has gone down as sharply as it has in later years, but my guess is that the main bottleneck is in the amount of data.

Well, the thing is the (10 players) is instanced. So there could be 72 people connected, and only 40 of them are "In a game" the other 32 would just be idle connections, possibly using chat if nothing else. I'm fairly familiar with TCP becuase I've done custom frameworks for Runescape emulators in the past that could hold the 2,000 player cap that Runescape has with ease. The thing with the RSEmulator is though, the movement was so basic. All you had to do was send to the server the tile you wanted to go to, and the server would say yes/no or "well, not there, but here" and then tell the client where to walk. It was nearly impossible to desynch from the client because you walked a steady speed going through tiles per tick, meaning it could all be calculated.

I mean yeah, if you altered your client to move around different than the server did, then obviously you wont be updating correctly.


--- All in all, I'm not expecting this project to much over 7-800 players (And that's being ridiculously generous). However; I want it to feel like it's done right.

Is there an easy way to make a UDP Socket belong to a TCP Socket? Or perhaps I'm underthinking it. I could create a session class that would hold the players connection to the game. Then from there I can connect UDP. The only thing is knowing which TCP client the UDP packet came from.. Could't you just spoof packets and make other people do whatever you wanted with this?

""From there I can connect UDP"" --- Sorry, I just woke up. LOL
11  Game Development / Articles & tutorials / Re: [LibGDX] Integrating RevMob on: 2014-07-16 10:31:33
I'm honestly not sure what the problem is with your application, I haven't had any problems with my implementation. (And no, I don't use anything for the EULA, everything you see here is what I used)
12  Discussions / Miscellaneous Topics / [YouTube] Setting up a Netty Asynchronous Server on: 2014-07-16 10:29:20
Part One: https://www.youtube.com/watch?v=5CHc0hEhKbM
Part Two: https://www.youtube.com/watch?v=Xwa_JYtI5-M
13  Game Development / Networking & Multiplayer / 10 Player(instanced) 3D Game, would TCP Suffice? on: 2014-07-15 22:31:03
I've been doing a lot of research on TCP/UDP/RUDP lately and most of it is because my friend who is a Unity freak is near-completion of this MoBA(Multiplayer online Battle Arena) single-player prototype and has asked me to work on the server-side of the networking while he writes the Client-API. I told him that I was up to the challenge, mostly for a learning experience, but helping him out was definitely on my mind. I'm fairly familiar with standard IO TCP Networking, however the problem with that is the Standard IO is blocking, so I would have to study on some NIO Libraries, (Looking at you, Netty). However, some-people have stated that I would be better off using UDP/RUDP.

The problem I've found during my studies with UDP/RUDP is the way that messages will occur. Considering we're going to be working on an authoritative server approach, it's fairly important that things like movement/item activation arrive. In the order that you activate them. For instance, if a player uses an healing item, then an ability that takes 1.5 seconds to cast. If the ability is casted before the item is consumed for some reason (Typically because of UDP Packets not being ordered) it could cause death, and players screaming "Glitches, Fix them." -- This would lead me to stare at the TCP Connections; However then I would be dealing with Latency problems from my studies. However anything under 200 Latency should be fine for this type of game, and we're not really expecting people from across the world to play without the expectation of a little lag.

So this brings me down to the question... For this particular application:
  • Handles all users connected - Users not in game don't transfer any data besides for chat, if being used.
  • Players in a game (Instanced, each game will have its own game-thread) will be moving around constantly in a 2D Environment (3D world using 2 axis')
  • Ordered arrival of packets is required
  • Losing Data is a Critical problem.

The only reason I'm really asking this question is because of the use of Reliable UDP which crosses out the "Losing data" issue, from my understanding, which makes this a question worth asking.


Sorry, no pictures of the game yet Wink
14  Game Development / Networking & Multiplayer / Re: Slick2d TileMap on Server on: 2014-07-15 22:05:19
Import slick on the server.
Huh
Profit.


That's how I did it back during my Tiled-Map days.
15  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-09 13:57:20
I will be doing so once I finish a game and it works properly.
16  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 13:36:51
Also, I'd like to add, because of the resources you gave me (and a good nights rest of programming in my sleep), I woke up and I currently have a working tile-system that uses a fog-of-war type setting. (I implemented it just to make sure I understood, but I removed it already). I'm currently working on implementing A* Pathfinding for my player as I plan to make this a basic tile-based RPG.

(Similar to how fire emblem used to be with the movements.)
17  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 13:28:53
Just did it in libGDX:

Click to Play


Render code: (tile is the instanced Sprite)

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  
float mx = Gdx.input.getX();
float my = Gdx.input.getY();

my = Gdx.graphics.getHeight() - 1 - my; // invert y-axis

mx -= Gdx.graphics.getWidth() / 2;  // center it
my -= Gdx.graphics.getHeight() / 2;

// these are the world coords of the mouse
int worldX = (int) ((mx / (TILE_WIDTH / 2) + my / (TILE_HEIGHT / 2)) / 2 - .5f);
int worldY = (int) ((my / (TILE_HEIGHT / 2) - mx / (TILE_WIDTH / 2)) / 2 + .5f);

for (int y = 0; y < tiles.length; y++) {
   for (int x = 0; x < tiles[y].length; x++) {
     
      if (x == worldX && y == worldY)
         tile.setColor(1, 0, 0, 1);
      else
         tile.setColor(.5f, .5f, .5f, 1);
     
      float screenX = (x - y) * (TILE_WIDTH / 2);
      float screenY = (x + y) * (TILE_HEIGHT / 2);
     
      tile.setPosition(screenX, screenY);
      tile.draw(batch);
   }
}


NOW I SEE WHAT THE PROBLEM WAS.
I'm still using standard orthographic to get the hang of everything before doing all of the changes.
I was trying to use your Isometric code to get the position on a orthographic map and it was confusing me


Quote
Sorry, you can't repeat a karma action without waiting 1 hours.
18  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 04:01:38
Got a Java2D version working using

1  
2  
3  
4  
5  
   public GameTile getTile(int screenX, int screenY) {
      int worldX = (screenX / GameTile.TILE_WIDTH)-1;
      int worldY = (screenY / GameTile.TILE_HEIGHT)-1;
      return tiles[worldX][worldY];
   }



LibGDX

1  
2  
3  
4  
5  
   public GameTile getTile(int screenX, int screenY) {
      int worldX = (screenX / GameTile.TILE_WIDTH);
      int worldY = (screenY / GameTile.TILE_HEIGHT);
      return tiles[worldX][worldY];
   }
19  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 03:54:55
as for the y-0-bottom thing, if you dont like that, just do your mouse: y = screenHeight - y. thatll flip it.

I've been doing Gdx.graphics.getHeight() - Gdx.input.getY() to determine the flipped Y value, that's good enough.
But I still can't get these calculations right.

I even wrote it in Java2D (Took less than ten minutes) and still can't do it that way using the example I was given.
20  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 03:41:39
what i mean is dont divide by tile size to get tile based co-ords. each tile is a certain size of pixels, so if you get the function to return the number of world-pixels that your mouse is pointing at, rather than an exact tile index, you can see how the values change more accurately as you move from one tile to another.. printing tile-co-ords on the screen doesnt have enough resolution for you to get a good idea of where your function is going wrong.
Isn't that what I'm doing with the Gdx.graphics.getHeight/getWidth?
21  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 03:27:13
You could try to get your function to turn screen co-ordinates into world-pixel co-ordinates, instead of world-tile co-ordinates, then you will be able to see what the numbers are doing more easily as you move your mouse around, then change it back to giving tile co-ords once it looks like its giving proper results.

I dont quite understand what you're saying, but I'm debugging the mouses position and the tile that it's in to check to see if the maths adding up, but I honestly just can't even math. It's not making the slightest bit of sense and feels like the numbers are all randomly generated.

This 0,0 y on the bottom thing is literally blood boiling. I might just go back to Java2D
22  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 03:16:42
This is still frustrating the hell out of me, and I can't figure it out. I decided to just go ahead and do the math for the Y Axis, but even then I can't get it to calculate the tile position correctly.

Attempts:

1  
2  
3  
4  
5  
   public String getTile(int screenX, int screenY) {
      int worldX = (screenX / (GameTile.TILE_WIDTH / 2) + screenY / (GameTile.TILE_HEIGHT / 2) / 2);
      int worldY = (screenY / (GameTile.TILE_HEIGHT / 2) - (screenX / (GameTile.TILE_WIDTH / 2)) / 2);
      return "Tile X: " + worldX + " -- Tile Y: " + worldY;
   }



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   public String getTile(int screenX, int screenY) {
       int worldX = mapData[0].length - (int)(Gdx.graphics.getWidth() / screenX);
       int worldY = mapData.length - (int)(Gdx.graphics.getHeight() / screenY);
       
       
       if(worldX < 0) worldX = 0;
       if(worldX > tiles[0].length)worldX = tiles[0].length-1;
       if(worldY < 0) worldY = 0;
       if(worldY > tiles.length)worldY = tiles.length-1;
       return "X: " + worldX + " Y: " + worldY;
//       return tiles[worldX][worldY];
   }



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   public GameTile getTile(int screenX, int screenY) {
       int twh = GameTile.TILE_WIDTH / 2;
       int thh = GameTile.TILE_HEIGHT / 2;
       int worldX = (screenX / twh + screenY / thh) / 2;
       int worldY = (screenY / thh - (screenX / twh)) / 2;
       if(worldX >= (tiles[0].length - 1)) worldX = (tiles[0].length - 1);
       if(worldX < 0) worldX = 0;
       if(worldY >= (tiles.length - 1)) worldY = (tiles.length - 1);
       if(worldY < 0) worldY = 0;
       return tiles[worldY][worldX];
   }

and numerous more I can't even remember.
23  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-07 00:29:04
Thank you, I've been playing with this; However the LibGDX Y axis flip is driving me absolutely insane. I've done my own math to try to calculate for it, but every step I take seems like it's in the wrong direction.

I read that using the Orthographic Camera I can easily make the Y position 0 at the top left like it is in Java2D, however that doesn't seem to be the case, either that or I'm missing something very simple.

Here's my code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
SpriteBatch batch;
   GameWorld world;
   OrthographicCamera camera;
   
   @Override
   public void show() {
      batch = new SpriteBatch();
      world = new GameWorld();
      camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   }
   
   
   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
     
      batch.setProjectionMatrix(camera.combined);
     
      batch.begin();
         world.render(batch, delta);
      batch.end();
   }


If you need anything other than this let me know, the tiles are still drawing from the bottom left.


No, I'm not using tiledmap.  If you're curious as to how I'm drawing my tiles

Generating the tile world:

1  
2  
3  
4  
5  
6  
7  
8  
9  
   private void placeTiles() {
      for(int xAxis = 0; xAxis < worldColumns; xAxis++) {
         for(int yAxis = 0; yAxis < worldRows; yAxis++) {
            tiles[xAxis][yAxis] = new GameTile(
                  GameTile.getTypeForID(mapData[yAxis][xAxis]),
                  new Position(xAxis * GameTile.TILE_WIDTH, yAxis * GameTile.TILE_HEIGHT));
         }
      }
   }


Render method for tile:
1  
2  
3  
4  
5  
6  
   public void render(SpriteBatch batch, float delta) {
      myShape.begin(ShapeType.Filled);
      myShape.setColor(tileColor);
      myShape.rect(pos.getX(), pos.getY(), TILE_WIDTH, TILE_HEIGHT);
      myShape.end();
   }
24  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-06 23:31:29
Like I said, Amit has you covered, there's at least 2 or 3 links on how to do that; here's one:
http://clintbellanger.net/articles/isometric_math/


I've read through numerous of his post(s), and while I still have my world drawing, I can't figure out how to do much more with it. (Such as clicking on the tiles, etc). I understand the math behind it (Which is seems is all this guy talks about), but I don't understand what I need to apply this math to.

I understand that I can do basic math to determine which tile my mouse is on based on the tile-size (which he talks about)...

but how do I go about getting that tile to modify it, or build ontop of it, or anything like that.

I'm trying to create a standard TD game before I move it to Isometric, as he seems to preach that a lot.
25  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-06 20:24:55
Thank you for the links burnt! I'll spend my next few hours reading up here.
26  Game Development / Newbie & Debugging Questions / Re: Isometric Game Design. on: 2014-06-06 20:20:21
It's the logic behind it I guess, everything that I read talks about just rotating an orthographical map 45 degres, but that doesn't look right.

I understand how to draw a basic tile map, as it's just

1  
2  
3  
4  
5  
for(i = 0, i < colums; i++) { 
    for(y = 0, y < rows; y++) {
        drawhere
    }
}


But how do I go about understanding which tile the mouse is on at all times, how do I go about working on pathfinding with these tiles.

My main problem is understanding how to know which tile is what.
27  Game Development / Newbie & Debugging Questions / Isometric Game Design. on: 2014-06-06 20:06:09
I've been trying... and trying... and trying to find online information that will help me with creating an  isometric game, but I'm the kind of person that needs to read over something that works to understand it... and it seems that that the devil himself is making sure that the amount of literature for isometric games is ridiculously scarce.

I'm willing to pay anywhere between $100->$200 for a good book on Java Isometric game development, at this point I really want to understand it and don't care about the costs. I'm not even trying to make anything big, just an isometric tower defence, just so I can say that I did it.

This is still frustrating the hell out of me, and I can't figure it out. I decided to just go ahead and do the math for the Y Axis, but even then I can't get it to calculate the tile position correctly.

Attempts:

1  
2  
3  
4  
5  
   public String getTile(int screenX, int screenY) {
      int worldX = (screenX / (GameTile.TILE_WIDTH / 2) + screenY / (GameTile.TILE_HEIGHT / 2) / 2);
      int worldY = (screenY / (GameTile.TILE_HEIGHT / 2) - (screenX / (GameTile.TILE_WIDTH / 2)) / 2);
      return "Tile X: " + worldX + " -- Tile Y: " + worldY;
   }



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   public String getTile(int screenX, int screenY) {
       int worldX = mapData[0].length - (int)(Gdx.graphics.getWidth() / screenX);
       int worldY = mapData.length - (int)(Gdx.graphics.getHeight() / screenY);
       
       
       if(worldX < 0) worldX = 0;
       if(worldX > tiles[0].length)worldX = tiles[0].length-1;
       if(worldY < 0) worldY = 0;
       if(worldY > tiles.length)worldY = tiles.length-1;
       return "X: " + worldX + " Y: " + worldY;
//       return tiles[worldX][worldY];
   }



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   public GameTile getTile(int screenX, int screenY) {
       int twh = GameTile.TILE_WIDTH / 2;
       int thh = GameTile.TILE_HEIGHT / 2;
       int worldX = (screenX / twh + screenY / thh) / 2;
       int worldY = (screenY / thh - (screenX / twh)) / 2;
       if(worldX >= (tiles[0].length - 1)) worldX = (tiles[0].length - 1);
       if(worldX < 0) worldX = 0;
       if(worldY >= (tiles.length - 1)) worldY = (tiles.length - 1);
       if(worldY < 0) worldY = 0;
       return tiles[worldY][worldX];
   }

and numerous more I can't even remember.
28  Game Development / Newbie & Debugging Questions / Re: Google-Play "Your application is incorrectly configured" on: 2014-05-25 12:45:04
Editing the main post, finally got am implementation working... (for the most part).
29  Game Development / Newbie & Debugging Questions / Re: [LibGDX] [$15]Google-Play-Services Setup is not working. on: 2014-05-24 07:10:29
Even if they don't explain to me what the problem with my code was, I can cross-reference and figure it out. That's my method of learning anyway. I study other peoples code and then create my own variations of it. Look up new ways to do it. I'm more or less paying someone to help me.  "Asking how to do it, giving you money if you tell me."

A reward type thing, if you get what I'm saying.

The other reason I'm offering the reward is because it creates an atmosphere where you want to click on the thread. The sheer amount of immediate views since the title update proves that.

The sheer amount of clicks had nothing to do with them wanting your money, it had to do with them wondering why you're willing to pay for a free service. Tongue



Either way, the more impressions it gets, the larger the chance someone might see an issue scrolling through it. Wink
30  Game Development / Newbie & Debugging Questions / Re: [LibGDX] [$15]Google-Play-Services Setup is not working. on: 2014-05-24 06:59:02
It would be more worth your time and money to learn how to do it yourself (or ask help how to) than just have someone else do it. Tongue

Even if they don't explain to me what the problem with my code was, I can cross-reference and figure it out. That's my method of learning anyway. I study other peoples code and then create my own variations of it. Look up new ways to do it. I'm more or less paying someone to help me.  "Asking how to do it, giving you money if you tell me."

A reward type thing, if you get what I'm saying.

The other reason I'm offering the reward is because it creates an atmosphere where you want to click on the thread. The sheer amount of immediate views since the title update proves that.
Pages: [1] 2 3 ... 6
 

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

The first screenshot will be displayed as a thumbnail.

Elsealabs (10 views)
2014-12-28 10:39:27

CopyableCougar4 (17 views)
2014-12-28 02:10:29

BurntPizza (21 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (57 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (94 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
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!