I'm trying to make a widget game, is it possible to use SpriteKit within a Today Extension?. I've been searching for similar posts but I've only found a question related to using SpriteKit in a AppleWatch extension.
I also working on some game in the today screen. So far I have found 3 solutions which working solid:
Like mentioned working with UIKIT
Use SpriteKit in a minimal way
Using offscreen images for rendering
The problem on solution 2 is, that it's very unreliable. Even calling regularly completionHandler!(NCUpdateResult.newData) has not worked.
So it's just the limited usage of SKAction at the end which has bring a lot.
Solution 3 is also good and works quite solid. Of course you must reinvent the wheel and can not use the nice features of SpriteKit. But because I've used this approach already in watchOS games, it was not much effort to use in Extensions.
I recommend solution 3 because you have full control and it works solid.
It is definitely possible. I think you are aiming to build something like the popular "Steve" Widget Game, and I believe that is a SpriteKit Game built into a Today Extension.
To begin, I would suggest to fully understand Today Extensions and it's limits and then fully understanding SpriteKit and the limits that it has.
Something you really want to focus on is making an extremely efficient piece of app. All around, from the actual code and how your code runs. This is due to the fact that Today Extensions are not really apps but "extensions" to your device so if you have a game that is graphics intensive or memory intensive, your app will crash.
I tried develop game in spriteKit for ios today extension, added SKViews to UIView, but it did not work. It seems like scene not loading in today extensions. I think it is not possible - use spriteKit in today extension. But i found good solution - using UIKit instead spriteKit. It is very powerfull framework for game developing, and i think Steve game developing via UIKit. You can check adding dynamics via UIKit in this sample: https://www.raywenderlich.com/50197/uikit-dynamics-tutorial
Also i can upload sample of using UIKit in today extension game developing on github if needed.
I made a framework with the intention to solve this problem some months ago, link here. I haven't had time to test it properly in iOS 11, so there might be some new bugs.
The only working solution I found to use SpriteKit with Today Extensions was to create the SKView and present the scene in viewWillTransition(to size:with coordinator:). This is necessary because Today Extensions have a different life cycle than a normal application, look at these iOS Widget Gotchas to get more detailed information on how this works.
EDIT: The correct method to setup these things might now be viewWillAppear in iOS 11, but it might be necessary to do some testing.
Another really important thing to consider when creating widget games is that you have very little memory(16mb if I recall correctly) to build your game with. You have to reduce your memory usage at all costs, otherwise the widget will crash and display a message telling you that it was unable to load.
Related
This is a pretty basic question and doesn't really need much depth for an answer. I was just currently interested in developing an app for iPhones and after learning the swift2 language from the Mac site, i was just wondering which API I should use.
I did some moderate research, and so far spriteKit seems like the way to go (bit of a hassle if I want to port it over to android, but not impossible). But I was just wanting to make sure it's the right way to go.
The app idea revolves around keeping track of some form of progress and being able to use this data to generate graphs for the user? I'd also like to add some image functionality to the application as well. (similar to the health app and how it measures distance walked?)
I know this sounds vague, but would spriteKit be able to do these things? Or is there another API worth having a look into? (I've checked out metal and sceneKit as well, but leaning towards the more 2D type apps)
From my point of view using spritekit for this is overkill.
There are some greats frameworks to do graphs like charts :
https://github.com/danielgindi/ios-charts
Spritekit is more gaming oriented, if you want a "simple" app you don't need it.
I don't think SpriteKit is the right API to accomplish your problems.
SpriteKit is all about moving and manipulating images on the screen. I am quite familiar with the SpriteKit API.
I do not see any help for generating graphs or something like that.
Also it is not the right API to display a proper interface for "serious" apps.
Just a few questions which I can't find answers to anywhere:
To code games for IOS using Sprite Kit, do you also need to know Objective-C or Swift?
Can you code high quality games without knowing Objective-C or Swift?
Thanks!
SpriteKit is an Apple framework developed for Objective-C / Swift application. So, yes you'll need at least some code basics notions.
"Yes". You might be able to develop game with Unity2D for example, but that would include using another language to write your scripts.
I'll try to expand a little bit previous answer.
SpriteKit is an Apple framework developed for 2D/3D games. It uses Swift or Objective-C. Advantage of using this is that you can be 100% sure that this game will work flawlessly on iOS devices. Disadvantage is that you are locked only to iOS devices. If you have 0 knowledge of Swift or Objective-C, and you wish only to develop for iOS, I would choose Objective-C. It seems a little harder to learn and understand, but compared to Swift to it seems that Objective-C is still (and will be for long time) superior to Swift. Although, it just be my personal preference, because I truly hate Swift. (You can achieve same things in both languages) :)
I started this way, I do not regret.
You can develop games and apps for iOS without knowledge of Objective-C or Swift. You can use programs like Unity, Unreal engine, Corona, Cocos2D/3D. However these programs require learning another language to write your game (c++ or something else). You can also use GameSalad for 2D games. It requires 0 coding, many things are drag and drop, but you do need to understand logic behind it. For example, it wouldn't be programming but it would be coding :)
GameSalad is easy to learn, fun as well, but forget that you will be able to create any serious game logic or more advanced game than 2D platform one. I tried it, but very soon changed to Objective C and XCode.
If you decide to go with learning actual language (which I would strongly suggest), I would recommend either Objective-C or to learn Ionic software. Ionic uses javascript, but when you learn how to make games/apps you can easily distribute it to ANY platform: iOS, Windows mobile, Android...XCode is better software, but learning Ionic has huge advantage, and that is single click to deploy app on any platform.
Good luck.
I am building an app for iPad composed of two parts:
a user interface built with cocoa
a Unity scene
And I needed to find a way of integrating both parts and have them communicate with each other.
After a lot of research the best approach that I have found was one based on this tutorial
Basically, I have two UIWindows on my app delegate, one where I keep the hierarchy of all cocoa viewcontrollers and the other is the Unity window. When I want to switch which window is visible I just call [someWindow makeKeyAndVisible]; on the target window. When I need to communicate from the cocoa side to Unity I call UnitySendMessage.
This approach seems to work fairly well in the beginning but as I play with my app and after switching between UIWindows a couple of times, the calls to UnitySendMessage randomly stop producing any effects, the Unity scene stops updating frames and it even reaches a point where the windows don't change anymore and until the app explodes...
Basically, what I would like to know is:
Is this the best approach to integrate Unity and cocoa views? Is
there an 'official' way of doing this? Can anyone point me out an
exhaustive tutorial or sample code?
Being this the best approach, any idea on why does it starts failing
after a while? Do I need to take any precautions when changing
windows? (memory management? Pausing Unity thread?)
Note: I am using Unity Pro, and I have tried both xcode4/ios6 and xcode5/ios7 and the behavior is the same.
Any help would be much appreciated.
The solution we've come to with AteBit is to have the ObjC portion of the application store its data in our SQLite database. The Unity app is constantly polling that database for changes naturally so it is a great fit for a transparent (no pun intended) UI solution.
Separate your UI completely from your data and get yourself some sushi.
Update
Similarly you could use the NSUserDefaults system, which is accessible inside unity using PlayerPrefs.Get# // Set#
I am not very familiar with Game engines for iOS app. Can anyone suggest an open source game engine for my game development?
My game scenario is as follows: The user selects a map, and a character inside of the game I moves through a path predefined in the map.
I was thinking about writing this game in OpenGL but it seems like I have to write a huge amount of code. Do any game engines exist in which I can successfully write this game?
Lua is easier to learn than Objective-C. There are several Lua development environments:
Gideros Studio: http://www.giderosmobile.com/
Corona SDK: http://www.coronalabs.com/
Moai: http://getmoai.com/
My favourite is Gideros Studio, because it seemed to me the easiest to get started, and is free until you want to remove the splash screen, and has a very friendly forum with access to the developers. You can also include native plugins (Objective C and C++ for Android).
Moai is the only actual open source one, if you really need to change the source, but it is probably the hardest one to learn.
cocos2d is popular and easy to use and learn. you could also use kobald2d as that includes cocos2d and other frameworks as well. you can download them through a search on google
As state by the other user cocos2d would be a good solution for what you want. Although you asked for "open source", you can always check, for free, Unity for iOS. You could also check a question I made some time ago, which can give you some hints of some options you have, here. From the Unity site:
Oh, and don't forget that Unity is free and we have fully-functional
30-day trials available for Unity Pro and Unity iOS Pro!
I know it's not perfect, but still, if you see it's worth, it can make a huge difference in your project.
Try Stencyl, it's not free, but it is a good engine that doesnt require a lot of code
I am developing an application that presents different stories for kids.
These stories are already made in flash.
My problem is how to add to the storys That app.
Initially one of the approaches was to create an app in Coco2D and make the animations in this language (converting the animations in pictures). However due to possess many animations and sounds, this process is very complicated
Thus, I asked opinions on what approach should I do to solve this problem.
Any opinion will help.
Thanks...
If you want to change the way you will solve the problem, you can try Adore Air which let you use Flash on iOS Apps : An example on how to do this
If you want to continue with Cocos2D, you can find good tutorials there for your project :
Good Tutorials to make a project with Cocos2D
If your stories doesn't have any interactive elements, you can try to convert your stories in Flash to Video Files with some softwares (try to enter it in Google).