43
votes

- TK: Port TilemapKit to C++, support Cocos2D-X v3.x

UPDATE: Early access version available at 33% off until October 30th:
https://tilemapkit.com/downloads/tilemapkit-cocos2d-x-source/

Port TilemapKit to C++ and make it compatible with Cocos2D-X and Android development. For other platforms besides Android we would need a volunteer to test TilemapKit with.

The C++ port will replace the Objective-C TMX model classes (TKMap, TKLayer, TKTileset etc - not the nodes) while providing API compatibility through Objective-C wrapper classes. Basically existing Objective-C code is refactored into a C++ class while the original interface just forwards calls to the corresponding C++ class. Overall this should increase performance slightly even for ObjC users.

If this idea is implemented, TilemapKit will require Cocos2D-X v3.x and will be ported to the latest stable v3.x available at the time. Then it can be tested and fixed to be backwards compatibility with earlier v3.x versions as far back as ... is both reasonable and relatively effortless (no promises, except for being reasonable that is).

Note: Unless it happens "automagically", the porting effort described here would not extend to supporting the Lua, Javascript and C# versions / scripting interfaces provided by Cocos2D-X, nor will it include testing other frameworks Cocos2D-X is embedded in (Marmalade), nor will it work with web platforms. Desktop platform support depends on demand and ease of adaptation, so that's a conservative "maybe".

Lastly, and most likely, the Cocos2D-X port will only be available as source code license (no binary framework).

Author: sitterheim, 24.07.2015, 15:54
Idea status: in process

Response from the site administrator

sitterheim, 11.10.2015
Porting to C++11 (with STL, Cocos2d-x) will take several weeks, please be patient.

Get the early access version here at a 33% discount until October 30th:
The early access version of TilemapKit++ for Cocos2d-x is now available for 33% off! (until October 30th)

https://tilemapkit.com/downloads/tilemapkit-cocos2d-x-source/

== Update Oct. 10th ==

v0.75 is released. This includes about 75% of the features and the most important ones are there. It has also been tested on Windows with Visual Studio.

I will begin adapting the ObjC model classes to use the C++ classes as the actual implementation. In that process I will port all the remaining little tidbits and once that's done this will be TK v1.0.

== Update Sep. 25th ==

Most "important" aspects are ported. So far, rendering of all map types and coord conversions seems okay. Still need to add object and image layers.

Getting rid of the "black line" artifacts needs more testing/research as the concepts used for SpriteKit/Cocos2d-objc don't seem to have an effect (could be a bug though).

== Update Sep. 19th ==

Rendering maps works. Ortho and Hex are implemented, Iso is to follow next.

== Update Sep. 16th ==

The reader and model classes are mostly complete, I decided to push back the optional data (terrain, tile anims, ...) in favor of getting something on the screen asap. This is the result: https://twitter.com/gaminghorror/status/644186463417069568

Aiming to launch an "early access" build for cocos2d-x in 2-3 weeks from now.

== Update Sep. 4th ==

Using pugixml to load TMX. Pugi makes the loader code a lot more straightforward to read and write, compared to NSXMLParser.

Map, tileset, tile layer loading and related C++ classes are done. I guess that's about half of it.

Comments

sitterheim, 24.08.2015, 12:18
The plan for the Cocos2D-X part:

1. Release TilemapKit for SK/CC first (by September 8th).
2. Work on the most pressing bugfixes & requests after release (may be a period of 1-4 weeks).
3. Port the model code to C++11 keeping the existing Objective-C API as the wrapper for SK/CC.
3a. In the process, replace NSXMLParser and XMLWriter with a cross-platform XML library. It needs to be fast and support important features (ie write XML with specific formatting).
4. Port renderer to latest Cocos2D-X v3.x at the time, testing on iOS and Android.
5. As far as reasonable ensure compatibility with older Cocos2D-X 3.x versions but not 2.x (AFAIK v2 does not support C++11 and still uses the odd ObjC-style retain/release mechanisms).
6. Ensure compatibility with other platforms / devices, primarily Windows phone but also desktop OS.
7. Support for (and interest in) other languages (Lua, Javascript, C#) needs to be evaluated separately. As is supporting other frameworks Cocos2D-X is embedded in, ie Marmalade.

Note: the higher the number in above list the more likely the related task and anything below that are going to deviate from the plan. Eg no plan survives contact with the enemy. But 1-4 are pretty much what's going to happen. ;)
Reply
sitterheim, 25.09.2015, 21:49
The early access version of TilemapKit++ for Cocos2d-x is now available for 33% off! (until October 30th)

Link:
https://tilemapkit.com/downloads/tilemapkit-cocos2d-x-source/
Reply
Dan True, 06.10.2015, 09:07
"For other platforms besides Android we would need a volunteer to test TilemapKit with."

I just bought the early-access with the.cpp files. I'll try tonight to get it to compile on windows, where I'm developing my multi-platform game.
Reply
Dan True, 06.10.2015, 07:16
Hi.

I just bought the early access for developing a cocos2d-x game on windows (for multiple platforms). At the moment it seems there are no installation insturctions that doesn't assume working on iOS?

I will try to get tilemapkit working on windows, and then share my experiences here.
Reply
sitterheim, 06.10.2015, 09:50
Hi Dan, thanks for testing this! As a heads up, there's one thing I'm pretty sure will be a problem and that's the current implementation of file I/O. Currently, the path separator is defined as / (forward slash) which may or may not work on Windows, depending on whether Windows allows forward slashes internally/programmatically these days.

If you need to change that, there's a define TKPathSeparator in Types.hpp (if I remember correctly) where you can change / to \ if needed.

I'll eventually implement this in a proper cross-platform manner.
Reply
Dan True, 06.10.2015, 21:19
Hi again.

I've messed around with it for some hours now, and it will probably require some hours yet of tinkering before that can succeed. I will probably try again, but I'm getting numb from fixing references at the moment ;)

Until you implement proper cross-platform support, will it be possible to get the framework in a compiled .dll I can include in cocos2d-x to get started with the game proper?

- Dan
Reply
Dan True, 07.10.2015, 08:04
I've fixed most references now.

However, I've identified a hurdle. Visual C++ isn't exactly a standard C++ compiler, and it appears to rely mostly on the old C89 standard. The result is that fmin/fmax is not included in math.h or cmath - and there are other syntax errors springing up all over the place.

What compiler are you using for tilemapkit? I might have to compile this through cygwin or something and then include the dll in VS instead.

Feel free to send me an email if we should take this in another forum than comment threads ;)

- Dan
Reply
sitterheim, 07.10.2015, 10:53
Hi Dan,

feel free to send me your current project to contact@tilemapkit.com - I can have a look at it tomorrow if only to see what I'm up against regarding the port to Windows as well as setting up my Windows dev environment.

Which version of VS are you using? I'm currently using Xcode.

PS: the actual forum is at http://forum.tilemapkit.com where we can discuss these issues, or by email, depending on whether it would be of general interest to users. Actually I'd prefer forum because it could use some activity so it doesn't seem as "quiet".
Reply
sitterheim, 07.10.2015, 10:54
Forgot to mention: I intend to send out an update of the TK++ version by the end of the week, perhaps I can integrate some of your changes before that.
Reply
Dan True, 07.10.2015, 12:19
I've started a forum thread for the continuation of this discussion:

http://forum.tilemapkit.com/t/experiences-running-tilemapkit-early-access-on-windows/75

I doubt that I will have a stable enough solution by this weekend, for you do securely included it in a release ;) At the moment I still cannot compile the code, due to the Visual C++ compiler's old standards.
Reply
Cory, 10.10.2015, 15:45
I'd pay extra for a port that included v2 of Cocos2d-x.

Maybe I'm alone in that camp, but a lot of games are already built using v2.

Thanks a lot for this produce, I'm glad I purchased it even though I cannot use it yet.
Reply
sitterheim, 10.10.2015, 18:26
Though "built" means they probably don't need any new frameworks. Question is, how many devs start new projects with v2 these days? Due to the significant changes in v3 it's possible that this number isn't so low after all, especially if there's a lot of reusable code for v2 in that developer's repository.
Reply
Cory, 10.10.2015, 18:54
I'm building new games with v2 because v2 works, is stable, doesn't change the API every few months.

If I hade TK++ for v2 I'd port at least 4 games to use it instead of CCTilemapLayer.

It is possible that the thing that will inspire me to eventually move to v3 is TK++ but I'm just not sure that v3 will ever be able to deliver the same level of quality for desktop that v2 does. For mobile-only developers, v3 is less of a technical issue than people who are really doing cross-platform games.
Reply
sitterheim, 11.10.2015, 11:51
That's an interesting pointer. I had a feeling that there must be some reservation and/or other reasons against v3 due to v2 still being so popular.

Could you mention or link to a few issues related to v3 and desktop apps?

As for v2, I've heard that one can indeed use C++11 with it. Theoretically speaking the entire model classes should work with v2 and only the node classes need to be updated. If you have some spare time I'd be interested to heard what kind of compile errors (if any?) occur if you try adding the TK Model classes to a v2 project (preferably a new one).

The Windows issues looked daunting at first too but ended up being relatively straightforward (albeit tedious) to fix. Perhaps it'll be similar with v2.
Reply
Cory, 11.10.2015, 16:48
Our version of v2 supports mouse-hover, mouse-wheel, fullscreen on Linux, Mac OS X, Windows ... has license free, high-quality multi-channel support for sound on all 3 desktop platforms ... full support for keyboards on all OS (bluetooth on mobile even.) We also patched the file manager to use OS-correct storage paths for all the desktops instead of storing stuff in debug-style locations.

Some of these features are patches I created / shared and others are patches I received from other developers on the discussion boards.

Since v3 renamed (uhg) all the classes and re-organized things (because, why not) a lot of those patches don't work anymore.

While v3 became easier to maintain by merging all the desktop support into a single set of classes, it also became much harder to really support the desktop OS.

If you are developing games for Steam, I doubt you are using v3 because the Steam community will rip you apart for releasing a "mobile port."

---------------------------------------

We use C++11 with v2, and support x64 fully. Based on your feedback, I'm going to try a back-port to v2 and see how far I get. Thank you for the suggestion. I'll keep you posted. If I can get it mostly working, I will send you the patches or files or whatever. I don't know if it would get your more sales (I already purchased) but more supported platforms == winning =)
Reply

Leave a comment

Copyright - 2017 Informer Technologies, Inc. All Rights Reserved. Feedback system is used Idea.Informer.com