Friday, January 29, 2010

Shining Force PC

     Shining Force PC is a work in progress to recreate Sega’s classic Strategy RPG for the PC using C++ and OpenGL.  My goal with SFPC is to develop a robust RPG game engine that eventually expands on the original game’s features while not making it overly complex or losing sight of what makes the originals so much fun.

The Original
     What is Shining Force?  Shining Force is a strategy RPG by Sega from the early 90s.  When talking to others about Shining Force, I always find myself using the phrase “elegance in simplicity” to describe it.  The game features a simple, straightforward user interface, character statistics and game mechanics that are easy to understand, and an overall enjoyable combat system that is quick to pick up but also has a surprising amount of depth to it.  You can see some YouTube videos of gameplay montages from the original Sega Genesis versions of Shining Force 1 and 2 here:

Shining Force 2:

Shining Force 1

    Why Remake It?  First and foremost, because it is fun!  I have many fond memories of the summer back in high school when I loaned my Super Nintendo and all my Final Fantasy games to a friend in exchange for his Genesis and these Shining Force games he had been so enthusiastic about.  I could quickly see why he enjoyed them so much!  To this day, Shining Force tends to stay at the top of the charts of Genesis games at GameFAQs:  While it enjoys its own cult following, it has nowhere near the popularity of bigger RPG franchises such as Final Fantasy and Dragon Quest.  Both of those series’ have had plenty of fans attempt remakes over the years, and I’ve worked in a supporting role on such projects myself in my time with Firebell.  Indeed, it was working on those remakes that originally inspired me to attempt remaking Shining Force, but this time as my own solo project, coded from scratch.  Much of what I learned working on those projects continues to guide how I design and build SFPC.

The Code
    Progress, Features, and Goals:  The SFPC engine currently implements many of the core elements required to make a console style RPG: animated, player controllable characters that can move around on a square grid, a camera that can smoothly transition from character to character, windows and menus scalable to any size that render text from either variable or fixed width bitmapped fonts, and a multi layered map that can be edited with the in-game editor.  My next major goal is to implement a scripted Event system to get all of these individual parts to work together to create an actual game experience rather than the features demo that exists today.  Once events are running, work can continue on the actual combat system, the ground work of which is already in progress with the Land Effect based movement and character stats that can be seen in the current build.  After that, sound and gamepad based input are a little further out on the horizon.  In the long term, I’ll be looking to get an artist or two to help me create original assets to create a full original game.  I would also like to eventually try implementing both co-op as well as competitive multiplayer modes, both locally and online.  This last feature has some interesting implications, as I can think of another far more recent multiplayer strategy RPG based on a square grid that I also enjoy that is just begging for a good online implementation: 4th Edition Dungeons and Dragons.
    Overview Presentation: Look over the PowerPoint presentation I put together outlining some of the features of my code here.  It features details about my classes their and functions, graphs of inheritance relationships, and some diagrams of the flow of certain parts of the program.

The Learning Experience
     OpenGL:  The SFPC you see today is actually my second revision of the project.  The first was built using DirectDraw.  Today’s SFPC benefits greatly from the rewrite on many levels.  First, just in general doing the rewrite let me keep the strongest parts of the old code and shed the weaker ones and the project is far more flexible and easier to work with now than it was before.  Next, while working with OpenGL meant making some small concessions, the rewards are plentiful.  Shining Force operates on a grid of 24x24 tiles, but OpenGL requires textures be sized to powers of 2.  This was easy to get around by writing code that scales a square buffer to the smallest power of two that can hold the incoming image, fills it with pure magenta and an alpha value of 0, then copies the actual data into the buffer.  Any magenta in the incoming 24bit color image gets its alpha value set to 0 as well.  The buffer is then converted into a texture by OpenGL and stored in an instance of my Texture class, which holds the texture, the source data dimensions, and the actual data dimensions.  For basic tiles, this is 24x24 for the data dimensions and 32x32 for the actual ones.  With that one major workaround out of the way, I am able to have alpha blending, texture flipping, mirroring, and stretching, full screen fade ins and fade outs, and tinting of any or all textures to any color, all very quickly and easily.  My DirectDraw based code did not have anywhere near that many features!  While on the topic of OpenGL, I feel I should mention that I learned basic OpenGL using the first ten NeHe OpenGL tutorials from I wrapped up the NeHe OpenGL initialization code into my own bluGL class, set the screen to use orthographic projection to treat the screen as a 2D space, and things have been running smoothly ever since!

    Static and Dynamic Data:  At the beginning of writing this new revision of SFPC, I was using a lot of statically created data in the GameEngine Initialize function and storing pointers to it inside of my GameObjectMgr.  Commonly used textures, such as window borders and frames as well as GameFonts, are stored in their own singleton based manager classes.  One of the more recent features I implemented was the Shining Force style ActionMenus, which are handled by MenuMgr and are dynamically constructed and destructed.  Now that I am more comfortable with this and am more confident removing objects from GameObjectMgr, I intend to transition away from so much static data in the near future.  This will hopefully give me a lot more flexibility as I move forward with the project!

The Demo
     YouTube: I've embedded a video walkthrough of the demo in its current state below:

     Download: A download of this playable demo is available here.  Requires a Windows based PC with an OpenGL capable video card.

No comments:

Post a Comment