Our Mascots Mascots
Tenshi-Oni Game Tenshi-Oni Game
Anime Shop Anime Store

Monday, August 19, 2013

The "Soul" of Fumi



Programming in Objective-C/C++ has been the name of the game the past two weeks.  Every spare second of free time I can muster during the week; time (mostly and sadly) stolen by the day job or driving to the day job, has been on my video game, Tenshi-Oni.  Almost a month ago I past a major hurdle in the development  by eradicating game crashing memory allocations and by plugging every memory leak up to this point in the development.  There's still more ways I can optimize memory allocation but my goodness am I glad that was done and as a bonus...doing so helped improve the game's framerate.

That was earlier in the month...what about now?  If anyone looks at the game compared to months ago one might say... "yeah, sure, you have done 'so much more' to the game" </sarcasm>.   Externally, the game is almost the same sans a few new slashing and particle effects, but internally.. the game is now vastly different and it's starting to look like it was done by an actual programmer instead of somebody who was piggybacking on premade code.

When I first started developing the game in late 2011, I was new to Objective-C/Objective-C++.  Sadly, my Computer Science knowledge from my HS & college years in the early 2000s was waning.  My current job as a "web designer" for a pro camera store is anything but web design and leagues away from computer programming.  Never again did I think I would see class declarations, subclassing, instance variables, etc again with the way my work pattern has become in the past few years.  Since 2006 my days at work have been nothing but mindless intern-level computer errand dribble.  Work that mainly involves updating prices on a crappy MiVa powered web cart where the owner doesn't like or want the internet to play a role.  I'm lucky if I can even put any basic HTML code in anything.  Every moment I'm not checking the prices of B&H Camera compared to us... I then become just the "company's computer guy"; the person everyone cries to when critical thinking and using Google is too hard of a task.  Since last month though, I've put my nose to the grindstone, regained my lost CS knowledge and got to work with the next large task for the game, and the purpose of this post/update... modularizing the code.

To recap, Tenshi-Oni uses the Space Game Starter Kit 2D shooter engine by iOS dev and teacher, Ray Wenderlich.  For a long while now, I've greatly expanded the code started by Ray adding dynamically loading levels, the various "soul types" of player, a slew of moves, a combo system, voice acting, sprites that split in half & pieces, and more.  The problem that I knew I had to address was how all of this code, like Ray's original engine had, was being run in the main "actionLayer" class.  I did make and imported some separate classes to work with actionLayer...but for the sake of getting the code to work right...almost everything pertaining to the player (the character Fumi), Lily and even other options were all being done in actionLayer.  Before a few days ago, the actionLayer implementation file ( an obj-c++ .mm file), had a massive 12k+ lines of code!  Any other programmers reading this would of course know that that had to be changed, especially if I was to expand the game.   It HAD to be modularized.

It was a bit scary.  Here's my code, albeit bloated in one file, running smoothly and ready for more features and polishing and now I had to tear it apart and reassemble it into separate classes.  Backups ready...I dove in and it was rough.  I hardly got any sleep since my last blog post and been using Sublime Text to "cheat" or more accurately, blind code outside the XCode IDE during the work day when I'm stuck in front of the XP powered PC at work; sneaking in some code during downtime.

 Amazingly, I was able to do it.  Last night all but one error  was fixed and now, in a sense, Fumi has a "soul";  a separate class dedicated to her in the code.  It wasn't just Fumi though...Lily's AI is all done separate from actionLayer as well as Fumi's voice acting (added into a category of Fumi), enemies, the new Options menu I created, the credits and even a parent class to be used for all boss characters.  The only bug I can't fix at the moment is Fumi's HP/SP bar not showing up; something I can probably fix with a little more investigation.  Everything else, even when it comes to memory allocation and leaks, are perfect.  What was once a 12k+ line file is now dropped to about 7K.  I can safely say now that the game's code is now more mine than anyone else's.  With Fumi and other aspects of the game having their own file, their own "soul", now it's just expanding the game further.

As people might know about me...I'm not the religious type; odd for me to mention Fumi's "soul" outside of her soul type functionality in the game.  In the end, we are all not far off from a computer program as logic runs our world too.. not just a video game world.  Making Fumi's own class in a way has given her a solid personality, you can call it a "soul", "brain", etc.  To me, as the programmer, I made her more "real".  Thus why above I posted an image Fumi in front of her code.

You all can view some of the code if you'd like.  I posted it here.  I'm still trying to show this world and the job market that I am indeed a game programmer.  Not saying my code is perfect; I'd imagine you guys can find lots of ways to make it better; I know I will.  What it's there for as well, is to show that I'm far better than this petty "company computer guy" job I currently have, more than qualified for the jobs since Hurricane Sandy that erroneously stated I wasn't good enough, and to for something else.... If Tenshi-Oni does become big, or at least big enough to end my need to have a boss/day job.  I want every place that has told me I'm not good enough to regret their decision not to add me to their team.  I want it to fester in their minds that a game that became a hit is nowhere in their grasp nor the developer in charge of it...all because they didn't give somebody a chance and asked fro too much up front.  If anything these past few weeks have taught me, it's that any programmer can improve themself; even when they thought they were washed up, rusty or "not good enough".  There's a pool of talented people with and without all the right degrees just sitting and waiting to bloom as experts in their field.  I've seen it with myself and everyone who's helped me with this game.  The current job market's expectations for those to be experts without experience and/or having experience without work is a grave mistake.  Eventually, we are all going to make our creative dreams come true...even if we do it ourselves.

Post a Comment

 
Copyright © 2002- Chucks Anime Shrine
Re-Design by Chuck Gaffney | BTT