Skip to content

Instantly share code, notes, and snippets.

@veeneck
Created January 16, 2016 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veeneck/4d0795f8139bef223052 to your computer and use it in GitHub Desktop.
Save veeneck/4d0795f8139bef223052 to your computer and use it in GitHub Desktop.

Important Notes and Tests

  • You must start a new game. The old save files will break.
  • Cutscenes reliably appear on my iPad, but mixed results on iPhone. Need more data on this.
  • Quite a lot to change in 2 weeks, so I fear regression. Let me know if you see anything super sketch

The Short Changelog

  • Brand new scene manager. Lots fixed and memory leaks should be gone.
  • Ranged units stop attacking when their target has moved out of range.
  • Proof of concept for casting spells. See Haste in Lemon Knights abilities.
  • Convert all assets to xcassets which paves the way for incremental loading
  • Improve defense against ranged to Ice Guard
  • Setup NSUserDefaults to learn. Start with saving preferred volume
  • When resuming game from main menu, now goes to the cutscene if you were interrupted while watching it
  • A proof of concept for in game currency shows on world map, and saves to the database.
  • A proof of concept for an army leader with abilities saves to the database, but has no visual elements yet.
  • Troop count now shows in world map.
  • During in battle cutscenes, troops can begin moving before letterbox appears which feels more natural.
  • Ice Guard now shows in the camp scene.
  • During in game cutscenes, the entire screen is disabled which fixes a lot of the bugs Brian encountered.
  • After an in game cutscene, the camera used to unlock which allowed scrolling past edges. This is fixed.
  • Pressing Sprint multiple times should no longer crash the app.
  • Failing level 1 no longer lets you proceed to the next cutscene. Instead, you have to replay the level.
  • Horn plays each wave instead of just the beginning of battle.
  • Test SKLightNode on main menu for Brian / performance.

The Big Things

SCENE MANAGEMENT

How you transition between scenes, load assets, etc has been completely rewritten. Additionally, it is now an open source project (https://github.com/veeneck/SwitchBoard) that would work for any future games as well. There is a huge amount of work in this, but the big ones are memory leak fix and detection along with new asset loading. The new asset loading will allow for on demand resources when I get to implementing that.

https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/

Also, the caching mechanism for assets no uses Apple’s NSCache which is more graceful under failure / low memory than my previous home grown solution. While in there, I also added smart caching which keeps assets that are shared between levels. All of this allows for much faster scene transitions, and we can discuss a plan for final visuals on scene transitions.

CASTING SPELLS

The simple Haste icon in the yellow soldiers may seem simple, but it is a new type of ability. It is a combination of instant (Sprint) and Ranged. It also targets friendly units instead of enemies. And, it has a particle and sound effect associated. Ultimately, the plan is to get 1 ability on Stou’s action bar (the left side of the combat screen). This refactor took longer than expected, so for now Haste will stay under Lemon Knights. Next build will move it under Stou. Stouts abilities are upgrades in the Training screen access via World Map.

RESISTANCE MODIFIERS

Ice Guard can now defeat the archers in level 1 without any assistance from the other units. This is because they have a modifier that decrease all piercing damage to 75% of original value. To do this, I added support for attack types (Piercing, Blunt, Elemental, etc) and then I added a Resistance array for those types. The value of .75 is stored, and as Ice Guard levels up it can go to .6, .5, etc which will make them tanks against ranged units. Most importantly, this sort of modifier now works within the ability system and can be applied to everything.

NSUSERDEFAULTS

Small note here to explain this. When you change the volume of sound or music in settings, it will now persist between games. So, if you quit the game, relaunch it, and check the sound it should be what you left it at. This first proof of concept sets the plumbing for all user settings that may be stored.

Next Release

Rough list of items to focus on for the next release.

  • Tool to visually see modifiers for debugging / strategy
  • Sound effects like arrows lag when too many.
  • Attempt to fix lag when new units spawn.
  • Reward money for beating level also
  • Make death permanent, or heal some units after battle?
  • Charge
  • Flee
  • Show exp that units have in Camp scene also
  • Enable logging in TestFlight so that I can see hard crashes
  • Fix width of cutscene border when viewing on iPhone
  • Improve EXP screen
  • Get Stou's action bar working with Haste ability
  • If any units dies during cutscenes, we get a hard error. All cutscene codes need conditionals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment