Git Product home page Git Product logo

swift-engine's People

Contributors

thelukester92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

swift-engine's Issues

Implement a cleaner interface for LGScene

LGScene doesn't have to subclass SKScene. It can do what the LGSprite does, which is keep a reference to an SKNode and reference it as needed. This will make it easier to strip out SpriteKit completely if that were ever necessary, as well as keep things clean. LGScene could provide a cleaner entry point than "didMoveToView."

Implement entity naming

Let entities optionally be assigned a string name by which it can be accessed later (useful in game logic, also could be used in scripting). Probably should assign entities an id within the scene and have a dictionary map names to those ids instead of to entities themselves.

Physics system should have static entities

Have not yet implemented static entities in the physics system. Should be easy, since the functionality exists for detecting entity-to-entity collisions (as dynamic collisions are detected) and resolving static collisions (as tile collisions are resolved). In fact, static entity collisions are already used by the dynamic collision resolution to prevent true collision chaining.

Create a few simple games with the engine

Instead of jumping into a big project right away, duplicate existing games like Snake, 2048, Flappy Bird, etc. as examples of what the engine can do and how it works.

Physics system should have full collision chaining

Physics system currently only has collision chaining for static collisions. Dynamic collisions that should be chained are treated as static instead for performance. Dynamic chaining should be allowed (enabled/disabled by a Boolean switch).

Dead camera

If the camera starts in an invalid position, it appears that nothing is rendered at all.

Implement collision masks

Implement collision masks, so something like this can be done:

physicsBody.collisionCategory = PLAYER
physicsBody.collisionMask = WORLD | ENEMIES | BULLETS
bulletBody.category = BULLETS

Not only does this eliminate a lot of unnecessary checks for the physics system, but it also eliminates checks in the trigger handler (#60) for something like this:

bulletBody.collisionMask = PLAYER
bulletBody.trigger = true
bulletBody.triggerHandler = { player in player.die() }

As opposed to having to make sure that the other entity in the handler is the player.

Remove func type() from LGComponent

Remove func type() from LGComponent, only need class func type() now. The following code was broken in betas 1โ€“3 so type() could not be removed.

let component = LGPosition()
println(component.dynamicType.type()) // should print "LGPosition"

Not sure if it's working in beta 4 yet.

Implement parallax background system

Create a system that horizontally tiles an image and scrolls it at different speeds than the main level for a parallax effect. May also want vertical tiling and/or parallax/scrolling.

Create a debug mode and debugging overlay

It would be convenient to have a debug mode with a debugging overlay that shows physics bodies and sprite boundaries. Debug mode could also (optionally) have a slow-motion setting.

Implement Lua system

Lua library source code is not needed. Should replace with a pre-compiled binary so that:

  1. GitHub doesn't show that most of this project is in C, since it isn't.
  2. XCode stops complaining about system calls in the Lua library.

Double negatives for nil-checking

Swift won't currently allow implicitly unwrapped optionals to be checked against nil. This works:

var optional: String!
if optional { println("here") }

But this does not:

var optional2: String!
if optional && optional2 { println("here") }

This does not work either:

if optional != nil && optional2 != nil { println("here") }

The current workaround is a double negative. When Swift supports it in a more elegant way, the code should be changed. Here's the working sample:

if !(!optional) && !(!optional2) { println("here") }

(!optional converts the value to the logic value's complement, then adding ! in front of that converts it back to the actual logic value)

Implement some way to connect entities

Case in point: moving platforms. Need a way for something on the platform to be connected to the platform as it moves. Implement a mechanism generic enough that it can also be used to connect entities, so that, for example, a boss could be composed of several connected entities.

Implement directional collisions

Previously "cloud" collisions; implement a kind of collider that only blocks in certain directions, like a moving platform only collides when the player is on top of it.

Implement an extensible deserialization scheme that can work with tmx objects

So that entities can be stored and loaded from files, implement a deserialization scheme that component classes can implement. One possible way is to register component deserialization methods in the scene based on a unique string. For example, this JSON could represent an entity:

{ "position" : { x: 12, y: 24 } }

The LGPosition component could register for it like this in the scene:

registerDeserializer("position") { LGPosition.deserialize($0) }

And the result of deserialization would be this:

LGPosition(x: 12, y: 24)

Perhaps a Deserializable protocol could work, then registering is simply associating a string with a class. It would be nice if Swift let us use Types as Dictionary keys and values.

Create global ids for entities

Assign entities global ids at the scene level. May be able to access entities by id this way, in addition to accessing them via pointer in the systems.

Enhance followers to work for more than just moving platforms

Followers work and are automatically added/removed to entities for moving platforms. Need to add the functionality required to make it work with other things, too, like a multi-entity boss. Physics system currently removes all followers from an entity if it is not colliding on the bottom with anything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.