Developing AI (Steering Behaviors) Using iOS8 Swift SpriteKit – Part 3 Vector2D SpriteKit

In this tutorial, we begin our study of iOS8 Swift programming with an elaborate overview on Apple’s new framework, SpriteKit. We’ll focus on the iOS8 applications that a programming language named Swift can expect to encounter every programming-day, and the XCode parts that you can touch.

> Games
The SpriteKit framework adds new features to make it easier to create high-performance and battery-efficient 2D games. With the support for custom OpenGL ES shaders and lighting, integration with SceneKit, and advanced new physics effects and animations, you can add force fields, detect collisions, and generate new lighting effects in your games.

In this lesson, we are going to leverage your existing Swift programming skills.

Thereafter, you should be able to: Know a SpriteKit framework and acquire basic Adobe Flash animation knowledge.

Estimated lesson time: 2.5 hours

So, let’s do it!

Sprite(Flash)

As Adobe Flash said, “The Sprite class is a basic display list building block: a display list node that can display graphics and can contain children.

A Sprite object is similar to a movie clip but does not have a timeline. Sprite is an appropriate base class for objects that do not require timelines. For example, Sprite would be a logical base class for user interface (UI) components that typically do not use the timeline.

The Sprite class is new in ActionScript 3.0. It provides an alternative to the functionality of the MovieClip class, which retains all the functionality of the previous ActionScript releases to provide backward compatibility.”

In brief: the Sprite is a cornerstone of real-world Flash game development.

SpriteKit

As Apple said, “SpriteKit is Apple’s framework for making 2D games. It has sprite support, support for cool special effects — like videos, filters, and masking. It includes an integrated physics library, plus a lot more. If you’re new to game development, this is a great place to start.”

SpriteKit vs. Sprite(Flash)

Advantages of SpriteKit.

SpriteKit provides a graphics rendering and an animation infrastructure , that you can use to animate arbitrary textured images or sprites.

SpriteKit uses a traditional rendering loop , where the contents of each frame are processed before the frame is rendered. Your game determines the contents of the scene and how those contents change in each frame. SpriteKit does the work to render frames of animation efficiently using the graphics hardware. SpriteKit is optimized to allow the positions of sprites to be changed arbitrarily in each frame of animation.

SpriteKit also provides other functionalities that are useful for games, including basic sound playback support and physics simulation. Besides, Xcode provides built-in support for SpriteKit so that you can create complex special effects and texture atlases directly in Xcode. This combination of framework and tools makes SpriteKit a good choice not only for games but also other apps that require similar kinds of animation. For other kinds of user-interface animation, use Core Animation instead.

Advantages of Sprite(Flash)

Web-browser within player support. Web browsers cannot render Flash media themselves. Instead, it is rendered primarily via the proprietary but freely available in Adobe Flash Player. Until 2008, there was no official specification which was allowed to be used to create an alternative player. Alternative players have been developed before 2008, but they support Flash media to a lesser degree than the official one.

AS3 program language is simpler. ActionScript is an object-oriented programming language originally developed by Macromedia Inc. (since merged into Adobe Systems). It is a derivation of HyperTalk, the scripting language for HyperCard.[2] It is now a dialect of ECMAScript (meaning it is a superset of the syntax and semantics of the language widely known as JavaScript), though it originally arose as a sibling, both being influenced by HyperTalk.
ActionScript is used primarily for the development of websites and software targeting the Adobe Flash Player platform, used on Web pages in the form of embedded SWF files.


Upgrade to Premium Account to read all articles and publish your own content …

In the next part, we will bring in SpritKit with basic AI functionalities (Steering Behaviors relevant) by Swift.

Zhou Yangbo

Zhou Yangbo

Zhou Yangbo is an Application Software R&D Developer and a Certified Project Management Professional in a wide variety of business and game applications. He is particularly interested in flash and mobile game design, coding and AI implementation using a cross platform solution. Also as a passionate technologist, he is experienced in solutions architecture and service delivery of Big Data for analytics, science, business and enterprise infrastructure solutions. He constantly uses CI/CD to provide continuous integration services and delivery for software development. Specialties: Full Stack engineering, architecture design and implementation. Expertise ranges from business development to production deployment in technologies including Hadoop, Spark, SQL, NoSQL databases, virtualization, dockerlization and data warehouse storage.