[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Slick Forums • View topic - TiledMapPlus - Help improve Slick's TiledMap support!!!

Slick Forums

Discuss the Slick 2D Library
It is currently Fri Aug 07, 2020 3:32 am

All times are UTC




Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: Thu Sep 22, 2011 10:31 am 
TiledMapPlus
A better way, to interact with Tiled maps

EDIT: TiledMapPlus is now officially part of Slick2D!

Recently I started using Tiled Map Editor. Its a very useful tool but Slick's API makes it very hard to get basic variables (This is due to Tiled being so flexible, with allowing you to have multiple object layers etc.). I'm proposing some changes to the API (which I have already started working on)
1. An export map function. Currently Slick is able to read maps, but no editing or writing functions? Its kinda wierd. I am proposing a function to write to a file or string buffer.
2. Editing functions for Tiled maps. For example, you can't add objects to a map
3. Easier function calls to get data. For example, you can't simply get an object , you have to loop through all the object layers, and through all the objects on that layer, and then check if the objects name is "foo".

I believe it would be a great improvement to the library if these were implemented. I have already started working on this, and will post updates of the code in this thread. Then I will release my TiledMapPlus class, for all to use.
Please feel free to add some features we need, or improvements to my suggestions, by replying to this thread.

[/b]


Last edited by liamzebedee on Thu Sep 22, 2011 11:46 am, edited 1 time in total.

Top
  
 
 Post subject: 0.1.01
PostPosted: Thu Sep 22, 2011 10:50 am 
*Fixed a bug in getting the object name
*Working on a new system of linking object names to their appropriate object offsets. Currently if there are 2 object layers, and there are 2 objects with the same name, 1 object will be overriden with the other objects data. The current system can only hold objects with unique names, and does not deal with object groups. I am working on this...


Top
  
 
 Post subject: 0.2
PostPosted: Thu Sep 22, 2011 11:43 am 
0.2

*Added a objectGroupNameToOffset HashMap. Now when you want the offset of a group, you can get it by its name
*Added a objectGroupToGroupObjectOffsetMap (Yes its a very long variable name) HashMap. Its pretty hard to get your head around (it was for me) WTF this does. Well to put it simply, it lets you get objects (the entire object class, not just snippets of data like the x or y) by their names, not their offsets. No more of those annoying for loops. Basically this is how the HashMap works.
You first get the group, in which the object is stored. Say the group is called entities and the object is called player.
objectGroupToGroupObjectOffsetMap.get("entities")
This will return another HashMap of the object name mapping for this object group. So if I wanted the offset of the object called player in the entities group, Id'e get it like this
objectGroupToGroupObjectOffsetMap.get("entities").get("player")
This would return a containing all the info (name,x,y,width,height etc.) about an object which you can freely access.
The good thing about 0.2, is that you can have another object called player in another object group, and they won't overwrite eachothers data (see above post). Isn't that sweet?


Of course you won't need to use all of this
objectGroupToGroupObjectOffsetMap.get("entities").get("player") in your code, Iv'e created (and am still) functions that wrap this data for you. Here we go...
*Added getObject(String groupName,String objectName)
*Added removeObject(String groupName,String objectName)
*Added addObject(int x,int y,String type,int width,int height,Properties props,String group,String name)
The addObject function was really annoying. Since I couldn't create my own constructor for the GroupObject class, I had to serialize all the data (name,x,y etc.) into an XML format and then construct the object.
*Added putProperty(String groupName, String objectName,String propertyKey, String propertyValue)
*Added removeProperty(String groupName, String objectName,String propertyKey, String propertyValue)

Well that's all Iv'e done in this update. Probably time for me to go to bed soon (I'm in Australia mate). I need some people to test this code, as I have been writing it for 3 hours straight ( -_- ) and haven't had any time to test it. Probably the next function I'm going to implement is the writeMap function. For those who don't know, the writeMap function will write all data in memory about all the TiledMap objects, back to an XML file or string buffer. This will take me a while...[/i][/b]


Top
  
 
 Post subject: 0.2.*
PostPosted: Thu Sep 22, 2011 12:38 pm 
0.2.1 (Not ready)
I just realized that the method getObject returns a GroupObject HOWEVER this class is not visible. I have NOT (see edit 1) fixed this by adding an exact copy of the GroupObject class into the TiledMapPlus class, but making its visibility public.
Now I am testing the code...Then to bed
EDIT 1:
This has not been fixed. I can either create my own class, that will require setting all the variables in the methods that use it, and it will lose the feature of editing the object directly, instead only editing a copy of the data OR I can mod the Slick library to make this class (GroupObject) public (it is currently of protected visibility).
I will probably have to mod the Slick library, otherwise[/b]

EDIT 2:
Well I am going to bed for the night - , doesn't work tho :(


Top
  
 
 Post subject:
PostPosted: Fri Sep 23, 2011 12:47 am 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
wow! you programmed that in three hours? I must admit, I think there's a market for tiled maps that can be edited in code.


Top
 Profile  
 
 Post subject: :D
PostPosted: Fri Sep 23, 2011 1:02 am 
Cool thanks, If this actually catches on, Kev (the creator of Slick2d) will put it into the vanilla build.

0.2.1
*Modded the Slick2d library - the class GroupObject was changed from protected to public. See above posts for reasons for this.
*Added getObjectID(String objectName,String groupName) method
*Added getGroupID(String groupName) method

NOTE: You now need the modded version of the Slick library, otherwise TiledMapPlus won't work!




Top
  
 
 Post subject: TODO
PostPosted: Fri Sep 23, 2011 1:18 am 


Top
  
 
 Post subject: 0.3
PostPosted: Fri Sep 23, 2011 3:20 am 


Top
  
 
 Post subject: 0.3.1
PostPosted: Fri Sep 23, 2011 5:20 am 


Top
  
 
 Post subject:
PostPosted: Fri Sep 23, 2011 7:37 am 
Offline

Joined: Wed Aug 17, 2011 2:25 pm
Posts: 30

_________________
I have a page where I'll put my stuff


Top
 Profile  
 
 Post subject: 0.4
PostPosted: Sun Oct 30, 2011 6:49 am 
0.4
Ok so I have completed the write function of the TiledMap. This was extremely hard and annoying. I'm currently pressured with loads of assignments, and might not have much time to reply to any inquiries. So I will release it when I get some spare time. Just keeping you updated.
Oo and I have also added some tile/object editing functions and fixed a major bug.


Top
  
 
 Post subject: 0.4 RELEASE 1
PostPosted: Wed Nov 02, 2011 11:23 am 
0.4 r1



Well I have finally completed 0.4. After a bug that went all the way back to 0.2, which kinda stuffed up every piece of my code, I think it works now.
I also kinda think that this version is suitable for actual use. Unlike the previous versions, I don't think there are any bugs.
I called this version r1 because although there are a huge amount of complete features, they aren't exactly refactored to be object orientated. I'm in the process of doing this now. I really am just releasing this so people can get a feel around the main features of the library.
* Added removeTile() and setTile() for setting tile's tilesets
* Added write(). This will write the current TiledMap in memory to a stream
* Classes and functions are being refactored so it is object orientated
* New render(Graphics g) method is being developed
* Added new, public domain, Base64 and GZIP class to Slick library, so TiledMaps could write compressed data, and because its useful


Top
  
 
 Post subject:
PostPosted: Wed Nov 02, 2011 1:00 pm 
0.4


I actually didn't think I would have any spare time to release r2 already, but here it is. I found out that if I want to render to a different Graphics context, then I would have to edit the SpriteSheet classes, which would stuff up alot of things, so I didn't do that.
* Changed some things to Object Orientated Architecture -
to get an object - getObjectGroup("entities").getObject("player")
set an object's properties - getObjectGroup("entities").getObject("player").putProperty("foo","bar")
* Split more stuff into classes, so everyone can access them!
* Each ObjectGroup class has its own HashMap of object name to object offset


I actually think this version is completely and utterly ready. The only other possible new feature I could think of adding, is setting tiles based on shapes, but other than that...IZ READY!


Top
  
 
 Post subject:
PostPosted: Wed Nov 02, 2011 10:32 pm 
Offline
Game Developer
User avatar

Joined: Wed Feb 17, 2010 12:24 am
Posts: 598


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 06, 2011 6:22 am 
Offline

Joined: Wed Jul 06, 2011 5:14 pm
Posts: 35


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group