Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 / Newbie & Debugging Questions / Re: Libgdx Death animation on: 2014-08-04 12:48:03
make a check and see if it is on last frame?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public void doingAnimation(){

   if(frames == 5){
       stopAnimation();
       animation = false;
   }

   //make an int to plus or something
   frames++;

   or
   while(animation){
       frames++;
   }

}


btw just trying to help Smiley hope you get it

There must be more effective way to achieve this..
2  Game Development / Newbie & Debugging Questions / Libgdx Death animation on: 2014-08-04 12:23:29
Hello, I want to make death animation for my character.

Here is a basic example -
1  
2  
3  
4  
5  
stateTime += Gdx.graphics.getDeltaTime();          
currentFrame = deathAnimation.getKeyFrame(stateTime, true);  
spriteBatch.begin();
spriteBatch.draw(currentFrame, 50, 50);            
spriteBatch.end();


So the problem is that the character is looping the animation over and over again.
and I want it to do the animation and stay on the last frame(which is when the character lays on the ground) instead of looping it.

Any ideas?
3  Game Development / Newbie & Debugging Questions / Re: Runnable jar doesn't play WAV formats on: 2014-07-25 16:24:08
well we would assume that files are found since 2 are playing, and there are no errors, however fileNotFound would be the goto problem.
next problem could be the format: make sure they all have the same format or at least a format that works. however why that wouldnt work in a jar but from the project itself, I'm not sure

Sorry didn't see your reply, well all the files are the exact same format (wav), and they almost all identical. but for some reason only 2 worked, but see my previous comment for the fix.
4  Game Development / Newbie & Debugging Questions / Re: Runnable jar doesn't play WAV formats on: 2014-07-25 16:21:29
I found the problem, I needed to extract the sound folder from the jar and place it near the jar. now it plays all the sounds.
I really don't get it, gonna check it in advance.
5  Game Development / Newbie & Debugging Questions / Runnable jar doesn't play WAV formats on: 2014-07-25 16:07:01
I exported runnable jar from my libgdx desktop project.
To my surprise, the jar file doesn't play most of the WAV formats, it plays only 2 out of 5.

I executed the jar file from the command line to check for errors, but it was perfectly fine, i checked the files, and it looks like bit rate is not the problem.

Any ideas folks?
6  Game Development / Newbie & Debugging Questions / LibGDX Tiled map rendering issue on: 2014-06-18 11:58:20
Rendering the tiled map in LibGDX isn't a problem but when the camera moves there are some lines between the tiles, now those lines aren't the background, just random green lines (my background isn't green).

similar to this video - https://www.youtube.com/watch?v=hSvGadQit7Q

I read that padding should fix it.. but i couldn't understand how should i pad the tileset.

Any ideas?

EDIT : the game running on resolution of 1680*1050 as my screen, but if i change the game resolution to 1280*720, the problem is gone. ANY IDEAS?! But it's a good hint

EDIT : I FIXED IT LONG TIME AGO (3 days ago) just wanted to update it was a problem in the camera resolution.
7  Game Development / Networking & Multiplayer / Re: Collision detection - server side on: 2014-06-12 13:07:51
I believe for that it would be something like:
1  
((TileLayer)Map.getLayer(int i)).getTileAt(int tx, int ty);

It looks like the methods you've written are pretty close to the original. I will say I'm surprised by the lack of documentation for the library (libtiled-java, not yours), but the source is straightforward and compact enough that a quick "find" command is usually enough to get pointed in the right direction.

Either way, it may be something to keep in mind in case you hit a hiccup with implementing a feature in your library, and need to see how it was done before.

Cheers. Grin
Hey thanks, i tried this command in lots of ways, and i did exactly what you wrote here.. but it still didn't work and returned null.. does it work for you? if it does i will try again

Anyways, I really like my library, it has a lot more features then libtiled and imo its more flexible, effective and useful, so i don't really see why should i switch to libtiled.
8  Game Development / Networking & Multiplayer / Re: Collision detection - server side on: 2014-06-11 18:26:04
Hello,
So as nobody could really help me, and i couldn't find any documentation or libraries to use tiled maps, i don't mean libraries like libgdx, i mean libraries for easy checking, customizing the maps and tiles, collision detection, and everything you want. but a library without any textures to load or using OpenGL and your graphics card in order to work. just a library to work with the map without rendering it (like server sided collision detection).

So basically you want libtiled-java.
Yeah.. i couldn't understand how to get cells in the map.
As you can see in what i did, you have this function
1  
map.getTile(i,x,y)

I couldn't find something like this in libtiled so i decided to create a `library` myself.
9  Game Development / Networking & Multiplayer / Re: Collision detection - server side on: 2014-06-11 13:49:07
Hello,
So as nobody could really help me, and i couldn't find any documentation or libraries to use tiled maps, i don't mean libraries like libgdx, i mean libraries for easy checking, customizing the maps and tiles, collision detection, and everything you want. but a library without any textures to load or using OpenGL and your graphics card in order to work. just a library to work with the map without rendering it (like server sided collision detection).

So extremely long story short, i created a basic library, which i can give to you all if you want.
It works like this, exactly how i want it -
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  
TMXMapLoader.Load(); // Loading the TMXMapLoader
TiledMap map = TMXMapLoader.readMap("assets/maps/foo.tmx"); // We reading the map

// Get Tiled Layer, which is basically the layers you create inside Tiled
map.getTiledLayer(i); // Get Tiled Layer with an index, returns TiledLayer.

// Get a tile/cell
map.getTile(i, x, y); // First parameter = layer index, Second parameter = X axis of the tile, Third parameter = Y axis of the tile. returns Tile.
map.getTiledLayer(i).getTile(x,y); // Same as above.

// Check if the tile has the `blocked` property, if yes we can't move through it or collide it (wood, stone), if not we can move through it (like air, water).
map.isBlocked(i, x, y);  // First parameter = layer index, Second parameter = X axis of the tile, Third parameter = Y axis of the tile. returns Boolean
map.getTile(i,x,y).isBlocked(); // Same as above
map.getTiledLayer(i).getTile(x,y).isBlocked();  // Same as above

// Get whatever you want
map.containsKey(i,x,y, key); // Get any property of the tile
map.getTile(i,x,y).containsKey(key); // Same as above
map.getTiledLayer(i).getTile(x,y).containsKey(key); // Same as above

// Get Tileset
map.getTileset(i); // Just get a Tileset with an index

// Get properties of the Tileset
map.containsKey(i, key) // Get any property of the tileset
map.getTileset(i).containsKey(key) // Same as above


That's what i remembered, you can do basically everything, very easy to use. i added bunch of useful functions and more advanced than those, but no time to show.
tell me what you think. its not pro or something just created something fast that is exactly what i needed, and couldn't find something like this nowhere.

If you want i can give it to you all.
10  Game Development / Networking & Multiplayer / Re: Collision detection - server side on: 2014-06-11 13:16:52
What do you do when two or more entities try to move to the same location at the same time, or nearly the same time. Your collision detection logic is not instantaneous, so both calculations will start (not knowing about the rival move) and calculate that the new location is clear... the end result is two entities now intersect. (I'm assuming your server is multithreaded here.)
Basically, in my game the players can collide each other, in my game it looks completely fine, just every player will see his player on top. additionally it even looks illogical if the players can't move through other players. i tested it by the way.
11  Game Development / Networking & Multiplayer / Re: Collision detection - server side on: 2014-06-09 23:35:23
How are you going to handle races to occupy locations?
I don't understand can you explain more? thanks
12  Game Development / Networking & Multiplayer / Re: Collision detection - server side on: 2014-06-09 23:34:45
Dont use collission detection server side, install libgdx or implement your own system.
What do you mean? you think i should make client-side collision detection? if that's what you meant, you are right, but i will make the client side collision detection for prediction / interpolation, but the actual collision detection will be server side, other wise hackers will hack the collision detection without problem, and will cheat the game and ruin the multiplayer experience.
13  Game Development / Networking & Multiplayer / Collision detection - server side on: 2014-06-09 13:42:55
Hello, I am making a multiplayer game with LibGDX, but the libgdx only installed in the client. which means the server is a complete pure java project.
I use Tiled maps for the game, with libgdx its really easy to do collision detection with all the tiled classes, but with pure java project its nightmare (the server).

So how can i do server-side collision detection? or to simplify the question, how can i read tiled maps without any libraries but with pure java?

I have some ideas in mind, i will test them and share them is they are helpful, but please post yours either. thanks Smiley
14  Game Development / Newbie & Debugging Questions / Re: get cell in tiled map on: 2014-06-08 15:53:26
I'm not quite familiar with libtiled since I use Libgdx but this getTileAt(int tx, int ty) seems to do the trick
Wow..Looks great, thanks!
but how should i use it? getTileAt() returns null everytime i use it. any ideas?
15  Game Development / Newbie & Debugging Questions / Re: get cell in tiled map on: 2014-06-08 11:11:49
Here how you can get a tileset tile (doesn't related to the actual map) -
1  
2  
3  
TMXMapReader reader = new TMXMapReader();
Map map = reader.readMap("assets/map.tmx");
map.getTileSets().get(index).getTile(index);    // That's how you get a tile / cell


Didn't you answer your question yourself right there?
To be honest it is really difficult to understand what you are asking...
It's hard to understand probably because you dont really know what tileset is.. tilesets are the tiles that are going to be used in the map, like this  -http://nethackwiki.com/mediawiki/images/7/7c/Vanilla_tiles.png
I showed you an example how you can take tile in a tileset.. not in a map, in a tileset.

Now what i am asking is how can i get a tile / cell inside my map.
for example, if i want to get the tile / cell in my map at the position (x=5,y=6), how can i do that? without libgdx?

Hope you understand, Thanks
16  Game Development / Newbie & Debugging Questions / Re: get cell in tiled map on: 2014-06-07 21:06:01
No idea with the library you are using but with libgdx is something like this:
1  
((TiledMapTileLayer)map.getLayers().get(0)).getCell(x,y);

The thing is i want to do collision detection in the server, and installing libgdx in the server its not a good idea.. so how can i make collision detection of tiled map in the server?
17  Game Development / Newbie & Debugging Questions / Re: get cell in tiled map on: 2014-06-07 08:23:44
Ohh come on.. how did u make multiplayer with tiled maps? how the server handled collision detection?
18  Game Development / Newbie & Debugging Questions / Re: get cell in tiled map on: 2014-06-07 08:22:29
Still can't solve it.. please help? Sad
maybe it has something with the map xml file?
19  Game Development / Newbie & Debugging Questions / Re: get cell in tiled map on: 2014-06-04 12:58:56
Hey, well i couldnt find a solution but here is some information

Here how you can get a tileset tile (doesn't related to the actual map) -
1  
2  
3  
TMXMapReader reader = new TMXMapReader();
Map map = reader.readMap("assets/map.tmx");
map.getTileSets().get(index).getTile(index);    // That's how you get a tile / cell


If you want to get tile properties -
1  
map.getTileSets().get(index).getTile(index).getProperties();


You can get any information about the tile, lets say we want to check if the tile contains key `grass`
1  
map.getTileSets().get(0).getTile(1).getProperties().containsKey("grass");


Correct me if i am wrong Wink
But i still can't find a way to get a cell inside the map.

ANY HELP?
20  Game Development / Newbie & Debugging Questions / get cell in tiled map on: 2014-06-04 12:45:52
Hello, i wish to know how can i get cell in tiled map, ... i know what you are thinking? LibGDX? no actually i wish to do it without libGDX, i wish to do it with libtiled - https://github.com/bjorn/tiled/tree/master/util/java/libtiled-java

here is an example how to use libtiled - https://github.com/bjorn/tiled/blob/master/util/java/tmxviewer-java/src/TMXViewer.java

But i played with it and couldn't find how to get cell..

I wish to use libtiled and not libgdx, because i want to do collision detection with multiplayer server, and i dont want to install libgdx in the server, just as simple as possible.

Thanks in advance, if i will find a solution, be sure i will update you all (and maybe i will make a guide because there is 0 documentation for tiled maps)
21  Game Development / Networking & Multiplayer / Re: Multiplayer game with libgdx on: 2014-05-23 09:45:21
Depends what route you wanna go down, many involve a world of hurt Wink.

Most professional games will have a server that loads the entire map (never renders it obviously), and calculated collisions exactly as you probably are in your single player version. The people 'playing on the server' will also calculate collisions themselves, then just send what they have done (e.g. im moving forward and ended up here or something). This is when the server checks its collisions results with the clients, and send the client a correct version if it went wrong. This is essentially how you stop someone editing their client to cheat and go through walls or always claim they've shot someone, or w/e.

If you're making a small game, or even better if its co-op (no pvp) then this is unnecesary, I don't recommend it anyway as its extremely difficult when compensating for the lag time it takes to send and receive messages.

So really it all depends what your game does.. It may be best just to use the server to tell all the players what each one has done, and forget doing server side collision for now. Once you have that running smooth you can look at what problems exist, and start working on a solution.

But tl'dr your question about how to do it on server side, you keep track of the players state, receive his actions, and check his movement or w/e exactly the same as in singleplayer, so yes you need to load the collision data, be it a tiled array or bunch of squares or w/e

Edit: I just read your other thread about its being a 2d fighting game. That isnt easy, you'll need to do a fair bit of reading up on the subject. GL

Yeah.. i actually did already the single player and it works pretty awesome and smooth. so i decided why not adding the multiplayer? i know its hard, but what can you do? when there will be a pill that will make everything a lot easier i'll be glad to use it, but till then..  Wink
22  Game Development / Networking & Multiplayer / Re: Multiplayer game with libgdx on: 2014-05-22 21:24:56
No you won't need to. Check collisions client side for now, focus on actually learning networking before you move to advanced networking, trust me.
ok thanks, i will work on some other things, like the client's input and such.. and will make the collision detection client side for now..
But i will be really glad if you will tell me how should i do the collision detection server side, with tiled map please  Smiley
23  Game Development / Networking & Multiplayer / Re: Multiplayer game with libgdx on: 2014-05-22 21:05:05
You should make a single player local game first Smiley
I did, i made a single player libgdx game, now i want to implement the multiplayer feature.
So as i asked, i have a tiled map which is the game map, and in order to check collision, i will need to load it into the server, right? how can i do that? because with plain java project you don't have any tiled map loaders or something.
24  Game Development / Networking & Multiplayer / Re: Multiplayer game with libgdx on: 2014-05-22 21:00:14
The server doesn't have to be a LibGDX project, in fact there is almost no point in making it one. Create it separately. 
Thanks that's what i thought, here i have another problem, i have a tiled map, which is the game map, so in order to check collision i will need to load it right? how can i do that?
25  Game Development / Networking & Multiplayer / Multiplayer game with libgdx on: 2014-05-22 20:53:48
Hello i am trying to make a multiplayer game with libgdx + kryonet.
and i get kinda confused...

Some questions -
1. The server should be in a libgdx project, or in a plain java project?
2. If i should make the server in libgdx project, how can i load the gdx without creating a screen, i mean the server doesn't need a screen right?

Thanks a lot Smiley
26  Game Development / Networking & Multiplayer / Re: How the structure of a multiplayer game should look like? on: 2014-05-16 13:51:52
My eyes!

Are you ok man? you have sensitivity to red text or something? cause if you do, u should definitely tell us.. you know.. it affects us.

And by the way, if you really want to be nice, get over your sensitivity and perhaps comment on my multiplayer structure and tell me if its good and where can i improve it?

Thanks Wink

EDIT - i can change the text color, if it really bothers you.

Just don't see the point in putting a bright red font on a bright white background. Some peoples eyes are not perfect, trying to read shit like that ain't helping them.

Changed the text color for you  Wink
lol don't call this shit shit.
27  Game Development / Networking & Multiplayer / Re: How the structure of a multiplayer game should look like? on: 2014-05-16 11:12:56
No amount of networking magic will eliminate latency. For a signal traveling at the speed of light to get to where i am to NZ and back (say playing against my brother) takes 133ms. Actual pings are about 320-350ms.

The trick is have game play that is not sensitive to that sort of latency (see for example Eve online) or make sure people are much more local to each other. But even with the same ISP it is hard to do better than about 40-50ms because of network setup most ISPs use.

For most games that is not a problem and our primitive monkey brains adapt pretty well. But that sort of latency would make games like Marvel Super Heroes almost unplayable. At 60FPS  you have 16.6ms between frames. Basically i can't see such a game working outside a lan.

Of course you could change the networking to be higher level. ie packets say what combo you just did. Not individual movements or key presses. You could change the game play to be a little slower placed.

I would tend to use a peer to peer lock step networking model for a game like this. But with only loose lockstep. ie let slower clients fall behind the faster ones.

The client predicts every player's actions, until it gets the next game data packet from the server. so the game will look smooth even with 120ms ping, honestly i even think the game will be nice at 160ms ping either.. but above that the game will start lagging.
But lets say the game will have separate server for Europe for European players, so european players will have ping mostly between 60 - 200ms ping, which means the game will be smooth for them, right?

The game won't just pause until the client will get the next game data packet, the game will predict what the players are doing ( please read what i said in the comments ).

Thanks Wink

28  Game Development / Networking & Multiplayer / Re: How the structure of a multiplayer game should look like? on: 2014-05-15 20:10:08
Its simple, if the server will send every player's input, the client will easily interpolate every player's action.
In an ideal world with zero latency it might be simple, but if your game is supposed to run on the internet and is 2D as Cero remarked and you need to take multiple latency values into account and need to prevent ugly position snapping, then it is very ambigous.
I think you didn't get my idea..

Here are the steps -
1. The server is sending the game data packet.
2. The client renders the world with the game data packet that the server sent, additionally, the client uses that data to predict / interpolate the game.
For example, the client knows that Player A pressed (or still pressing) the D key, the client will render Player A walking right until the client will get another game data packet to update the current game.

Of course if the client has serious latency issues, the players will be teleporting a bit. But what can you do?

I hope you understand it now, if not. please let me know.
29  Game Development / Networking & Multiplayer / Re: How the structure of a multiplayer game should look like? on: 2014-05-15 18:04:02
My eyes!

Are you ok man? you have sensitivity to red text or something? cause if you do, u should definitely tell us.. you know.. it affects us.

And by the way, if you really want to be nice, get over your sensitivity and perhaps comment on the multiplayer structure and tell me if its good and where can i improve it?

Thanks Wink

EDIT - i can change the text color, if it really bothers you.
30  Game Development / Networking & Multiplayer / Re: How the structure of a multiplayer game should look like? on: 2014-05-15 18:01:19
wow 2D fighting games online huh

those need to have the fastest connection of any games by definition, since people wanna do frame perfect combos and everything

might be hard if youre not excellent in network programming and have a reliable server

That's why i do it, i want to be excellent in network programming Wink
If you want to help, you can tell how the structure of a multiplayer game like this should look like, or perhaps look at the structure that i wrote and tell if its good.
Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (46 views)
2014-10-17 03:59:02

Norakomi (37 views)
2014-10-16 15:22:06

Norakomi (29 views)
2014-10-16 15:20:20

lcass (32 views)
2014-10-15 16:18:58

TehJavaDev (62 views)
2014-10-14 00:39:48

TehJavaDev (62 views)
2014-10-14 00:35:47

TehJavaDev (52 views)
2014-10-14 00:32:37

BurntPizza (70 views)
2014-10-11 23:24:42

BurntPizza (40 views)
2014-10-11 23:10:45

BurntPizza (82 views)
2014-10-11 22:30:10
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

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!