How to edit and load tile maps in Swift? [duplicate] - ios

Is there a (preferably easy) way to load a .tmx file in iOS 7's Sprite Kit? If not, are there any alternatives?

you should use JSTileMap that is designed to work with Sprite Kit
add JSTileMap files to your project
add libz.dylib to the linked frameworks and libraries section of your project
import JSTileMap.h
and load a map with:
JSTileMap *tiledMap = [JSTileMap mapNamed:#"mapFileName.tmx"];
if (tiledMap) [mySKNode addChild:tiledMap];
Here is the source: https://github.com/slycrel/JSTileMap
Good Luck!!

Check out TilemapKit for Sprite Kit. Unlike other solutions it loads and renders all (!) map types and variations supported by Tiled, including staggered iso and hex maps!
TilemapKit is properly engineered like a OOP framework should be, and exposes all data that is stored in the TMX file. In other words it's definitely not just a single class that got everything crammed into it.
Tile picking (point to coord, coord to point conversion) for all map types/variations is built-in. More awesome features on the way, review the roadmap and check out the Class Reference.
TilemapKit is also tested to be fully compatible with Swift and Mac apps, too.
Visit the TilemapKit forum if you have any questions or requests. I'm also posting frequent development reports so you can check what's coming up next.
Disclaimer: If it isn't obvious by now, I'm one of the TilemapKit developers. :)

This is the best I have found. I am not sure if the do-it-yourself method would work this instance as I haven't tried implementing it yet.
http://gamedev.tutsplus.com/tutorials/implementation/parsing-tiled-tmx-format-maps-in-your-own-game-engine/

Related

Dynamic 3DObject use in ARKit-SceneKit

I want to download the 3D Object-dae(collada) file from server and want to display on surface dynamically so can please share how can I achieve this in ARKit via SceneKit or else?
You can check this link: https://the-nerd.be/2014/11/07/dynamically-load-collada-files-in-scenekit-at-runtime/ it is old post but I don't think something is changed since that
According to this (see the Discussion section): https://developer.apple.com/documentation/modelio/mdlasset/1391813-canimportfileextension?language=objc
dae is not supported at runtime (ModelIO).
Additionally I'm working on a library called AssetKit (In Progress) and it will full support COLLADA and glTF, it is too early to say that but after initial release, you will be able to load dae files dynamically. It is written with C99 but I'll optimize it for Swift (by writing wrappers or integration with SceneKit...). Since it is still in progress I suggest that follow the first link

UML class diagrams for Xcode (Swift programming)

I have created an iOS mobile application. Is there a way to generate a UML class diagram for the Swift programming language?
I have tried Omni Graffle, but it keeps saying that the project doesn't contain Objective-C interfaces. And Omni Graffle only does this for Objective-C.
I remember looking at this question a while ago and was disappointed that there wasn't any tool like this so I created one myself with the help of a colleague. It's free, it's open source, it's looking for contributors...
https://github.com/yoshimkd/swift-auto-diagram
And here's a tutorial on how to use it (don't worry it's very simple):
https://martinmitrevski.com/2016/10/12/swift-class-diagrams-and-more/
Happy diagraming :)
The answer unfortunately is: you can't do it. At least not automatically. Swift as compiler itself has enough flaws left. Leave alone some tool will be able to swallow any Swift code. Your only alternative is the good old manual way.
I know that Enterprise Architect has a possibility to define a language syntax based on BNF. But Swift is (again unfortunately) not context free. (In fact it's so context sensitive that it often swallows its own rear.) So that won't work either.
P.S.: Now that Swift is open source someone might take the opportunity to tap the compiler's output for the class interfaces. I guess that should not be too difficult, but it's a lot of work still.
Inspired by swift-auto-diagram and similar open-source tools I started to work on such utility with the goal to write it in Swift (to make contribution easier by Swift developers) and to integrate it in Xcode and the Swift ecosystem.
Xcode extension: https://github.com/MarcoEidinger/SwiftPlantUML-Xcode-Extension
You are able to generate a class diagram from selected lines of code or from a whole file displayed in Xcode. The class diagram will then be opened in your browser. There you can modify the diagram with PlantUML notation
To generate a class diagram from multiple source files you can use the underlying CLI tool and Swift Package: https://github.com/MarcoEidinger/SwiftPlantUML
There is a size limitation to the visible diagram content (but you can delete content in the browser with PlantUML notation)

Load a .tmx (Tiled Map) in Sprite Kit?

Is there a (preferably easy) way to load a .tmx file in iOS 7's Sprite Kit? If not, are there any alternatives?
you should use JSTileMap that is designed to work with Sprite Kit
add JSTileMap files to your project
add libz.dylib to the linked frameworks and libraries section of your project
import JSTileMap.h
and load a map with:
JSTileMap *tiledMap = [JSTileMap mapNamed:#"mapFileName.tmx"];
if (tiledMap) [mySKNode addChild:tiledMap];
Here is the source: https://github.com/slycrel/JSTileMap
Good Luck!!
Check out TilemapKit for Sprite Kit. Unlike other solutions it loads and renders all (!) map types and variations supported by Tiled, including staggered iso and hex maps!
TilemapKit is properly engineered like a OOP framework should be, and exposes all data that is stored in the TMX file. In other words it's definitely not just a single class that got everything crammed into it.
Tile picking (point to coord, coord to point conversion) for all map types/variations is built-in. More awesome features on the way, review the roadmap and check out the Class Reference.
TilemapKit is also tested to be fully compatible with Swift and Mac apps, too.
Visit the TilemapKit forum if you have any questions or requests. I'm also posting frequent development reports so you can check what's coming up next.
Disclaimer: If it isn't obvious by now, I'm one of the TilemapKit developers. :)
This is the best I have found. I am not sure if the do-it-yourself method would work this instance as I haven't tried implementing it yet.
http://gamedev.tutsplus.com/tutorials/implementation/parsing-tiled-tmx-format-maps-in-your-own-game-engine/

ios : Displaying a simple 3D model with GLEssentials sample code

My goal is to display a simple 3D model and apply a texture on it.
I've downloaded the GLEssentials ios sample project to learn how to develop this (i'm new in ios OpenGL-ES API)
But the example model is a .model file, which I never heard about and which never appear in model bank websites.
What is this kind of file?
is the sample code compatible with other common model types (.obj, .c2d, .3ds)?
is it a good idea to start from this project?
Have a look at this question:
How to convert Blender blend (or obj) file to Qualcom Vuforia .h file
In my answer, I describe a script and accompanying Xcode project that converts .obj/.mtl files to header files suitable for OpenGL ES on iOS [link].
In response to your questions:
I believe the .model file is only appropriate for the sample project and is a proprietary Apple extension. It most likely contains simple data such as vertex positions.
I think you'd struggle to fit other model types into the sample code, which is very complex for OpenGL ES beginners. You might want to have a look at .pod files on Cocos2D here. I've seen and heard great things about it.
I wouldn't recommend it :)

Loading 3D model in iOS

I'm creating a game application from scratch with xcode for iOS, and I've use the OpenGL Game projet template to create mine.
I've searched a lot in the past few days, but I can't find any tutorials or example as to how I would load 3D model (via .obj files) in my application. I've found some documentation on loading them onto an app with a console script, but I need to do it programmatically.
Any help would be very appreciated
Also, my 3D models are created using blender
The future will be here momentarily — SceneKit, available in OS X since v10.8, will be in iOS 8. It can build and render a scene with COLLADA (.DAE) models directly. No need for third-party tools or code, nothing complicated to learn.
Apple's documentation is pretty good but if you prefer then other tutorials are available.
OpensceneGraph has support for iOS and a lot of prebuilt code which can help you develop the game. It supports loading OBJ models.
I recommend to use an Engine (like isgl3d, nineveh, Cocos3D, ...) for creating a 3D game, it will be hard if you use Opengl for a start.
Note: you can search for a list of game engine to choose the suitable one for you game, cause there is a lot of game engine, open-source or paid engine.
You can download the zip file from here and then run ./obj2opengl.pl 3DModel.obj in terminal .It will give you 3DModel.h file as output.
You need to use glDrawArrays instead of glDrawElements as the .h file contains array.
Obj files are simple to parse and are well described on wikipedia. You should be able to load them in one or 2 hours. But if you want to load the materials you need to invest some more time in your engine and into loading the obj file.

Resources