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   
Pages: [1]
  ignore  |  Print  
  Slick2d TileMap on Server  (Read 811 times)
0 Members and 1 Guest are viewing this topic.
Offline pw

Senior Newbie


Projects: 1



« Posted 2014-06-28 08:37:30 »

Hello guys,

at the moment i am programming a 2d online racing game with a client/server architecture. I use Kryonet for the network stuff and slick2d on the client for rendering and use the geometry part of slick2d on the server for collision detection etc.
For my Tracks i use the free tilemap-Editor "Tiled".
Now to my problem:
my Server is a plain java Application, but i have to load my tilemap on the server so i can perform collisions with my cars and "blocking" objects like walls or so.
But i cant load the Tilemap because i dont have a slick2d Application and therefore not a openglcontext which i need to load my tileMap.

How can i solve this?
Offline Rayvolution

JGO Kernel


Medals: 216
Projects: 2
Exp: 1 year


Resident Crazyman


« Reply #1 - Posted 2014-06-28 09:10:13 »

TiledMaps are just huge XML files, so read up on XML file parsing. Wink

You'll probably have to write your own XML parser to read TMX files and convert the data to what you need that matches what the client's use it for.

NOTE: Keep in mind that by default TiledMaps compress the data, so you'll have to read up on how to uncompressed it as well, or save it uncompressed(not recommended).

- Raymond "Rayvolution" Doerr.
Retro-Pixel Castles - Survival Sim/Builder/Roguelike!
LIVE-STREAMING DEVELOPMENT: http://www.twitch.tv/SG_Rayvolution
Offline temu

Senior Newbie


Medals: 1
Exp: 2 years



« Reply #2 - Posted 2014-06-28 09:37:12 »

TiledMaps are just huge XML files, so read up on XML file parsing. Wink

You'll probably have to write your own XML parser to read TMX files and convert the data to what you need that matches what the client's use it for.

NOTE: Keep in mind that by default TiledMaps compress the data, so you'll have to read up on how to uncompressed it as well, or save it uncompressed(not recommended).

I'm sorry, I can't help but I'm interested too. Is this the only way?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pw

Senior Newbie


Projects: 1



« Reply #3 - Posted 2014-06-28 10:18:07 »

TiledMaps are just huge XML files, so read up on XML file parsing. Wink

You'll probably have to write your own XML parser to read TMX files and convert the data to what you need that matches what the client's use it for.

NOTE: Keep in mind that by default TiledMaps compress the data, so you'll have to read up on how to uncompressed it as well, or save it uncompressed(not recommended).

I'm sorry, I can't help but I'm interested too. Is this the only way?

This is my question too. If there is no other way i will try to program it in the next days and post my results here.
Offline Cero
« Reply #4 - Posted 2014-06-28 13:22:13 »

you can just rip the XML parsing part from the slick source and use it on the server.
The reason it doesnt work out of the box is because slick of course wants an opengl context, but your server has no graphic output like this normally
so you wanna do data structure stuff but no graphics

Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #5 - Posted 2014-06-28 17:15:00 »

Try libtiled-java. If you've already got Tiled installed, you can find it in a subfolder of the main installation directory. You'll have to spend some time with the source to figure it all out, but it's fairly simple to get a handle on. It also has no sort of OpenGL, Slick2D, or other framework dependencies, so it integrates easily on the server side. No real need to roll your own or to copy/paste snippets out of Slick.

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Offline Rayvolution

JGO Kernel


Medals: 216
Projects: 2
Exp: 1 year


Resident Crazyman


« Reply #6 - Posted 2014-06-28 18:37:17 »

you can just rip the XML parsing part from the slick source and use it on the server.
The reason it doesnt work out of the box is because slick of course wants an opengl context, but your server has no graphic output like this normally
so you wanna do data structure stuff but no graphics

^ Try this. Because Slick2d's TiledMap class even handles the data decompression as well, and will offer you the ability to make sure you keep all the data collected in the same kind of data format. It will just make things easier all around for you. Wink

It'll also give you some insight on how XML parsing works, and if you're like me, you'll find that XML parsing is annoyingly confusing at first.

- Raymond "Rayvolution" Doerr.
Retro-Pixel Castles - Survival Sim/Builder/Roguelike!
LIVE-STREAMING DEVELOPMENT: http://www.twitch.tv/SG_Rayvolution
Offline CTucker1327
« Reply #7 - Posted 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.
Pages: [1]
  ignore  |  Print  
 
 

 

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!