Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

877601 Posts in 32868 Topics- by 24310 Members - Latest Member: Muzuh

May 20, 2013, 12:45:09 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)AsciiEngine: C Game Engine
Pages: [1]
Print
Author Topic: AsciiEngine: C Game Engine  (Read 757 times)
CecilSunkure
Level 0
**


View Profile WWW Email
« on: July 10, 2012, 10:53:01 PM »

Hello TIGForums! I've admired a lot of projects and posts around here for a while now, though haven't joined till now as I can finally contribute (I finally know some things about programming!). I've been working on a simple 2D game engine I'd like to share:

AsciiEngine
is an open-source game engine written in C for Windows XP, Vista, and Win7 that allows the user to easily create and display images within a Windows console. The engine also automates the tedious task of customizing aspects of the console, such as a font or palette color.


Screenshot from demo program~~

List of current AsciiEngine features:
  • Complete game loop (never need to modify due to function pointers)
  • Game State Manager (integrated with main loop)
  • Framerate controller
  • Various console related functions for easy customization of the console window
  • Complete graphics functions set for drawing 2D images
  • Input template complete for simple keystroke detection and mouse event handling
  • Included AsciiEngine Image Editor -- screenshot
  • Automatic art asset loading (of the AsciiEngine Image Editor filetype .AEArt) from specified directory
  • Integrated hash table for storing images
  • Implementation of my simple 2D collision library
  • Implementation of my simple 2D vector library
  • Highly organised OO game object manager using the factory pattern
  • Implemented my Tile mapping -- Binary Collision library


List of To Do features:
  • Incorporate my fmod wrapper
  • Pathfinding functionality integrated with tilemap system -- ? Not sure about using this one, the game I'm actually making with this engine likely won't need pathfinding due to design. I may however include some state machine functionality for platformer AI.
  • Messaging system Object to object and/or global messaging system

Here's some screenshots from a game I constructed during my first semester at DigiPen IT. This game was created in C without AsciiEngine (made long before I made AsciiEngine), but during construction of the game I learned almost everything I know about console handling. I've since used this AsciiEngine project as a culmination of what I've learned since then. Also, what's a thread on Ascii Art without some interesting Ascii Art:


How to use AsciiEngine:
Almost all code creation you'll do with AsciiEngine will be in creating/modifying game state files. Since AsciiEngine uses a GameStateManager (GSM) you'll have to create your own states. More information about what a GSM can be found here. Creating a state is as easy as copy/paste from the example state within the download archive of AsciiEngine. Integrating a new state into the GSM should be straightforward if you examine the currently existing code.

Once a state is created all that is left to do for the user is to simply write code within the state! Almost all code written will be within the Update function. During the Update function all game logic will occur. Drawing specific functions should occur only with the stat's Draw function - this allows for easy implementation of the Painter's Algorithm.

To switch states there are three global variables within the GameStateManager.c file. These are nextState, currentState and previousState. In order to switch states simply change nextState to the desired state to switch to. The main loop will then call the Unload and Free function automatically of the current state you are in, and then load and initialize the next state automatically as well.

Creation of Game Objects can be handled any way by the user, I've written documentation on a very simple way of creating and handling Game Objects here, and it works extremely well with the GSM organization throughout AsciiEngine. I've implemented my own method of handling objects with the Factory pattern! Using the ObjectFactory within AsciiEngine it's very easy to handle game objects, as well as create new ones. See code for documentation -- it should mostly be copy/paste to create a new object. AsciiEngine's MainMenu example state shows how to create and handle objects (it's just a few function calls).

I will likely write a more in-depth how-to-use AsciiEngine article/tutorial later on after I finish it. I'm currently making my own project (which is the whole point of making AsciiEngine) with AsciiEngine, and only until the game is finished will AsciiEngine be complete in my eyes.

Documentation:
There's a lot of documentation in the code itself, and there's also a lot of links within the code that point back to my personal programming blog. I like to write articles about the various topics I've learned about in my studies (it helps me retain information, and learn what I know better), and often times I link back to various topics on my blog, as I construct almost all of this engine based off of the documented posts I wrote in the past.

Additional Notes:
  • Some code won't function on Windows that require unicode strings. I decided to use (at least for now) various ANSI functions from MSDN instead of their unicode counter-parts for ease of production. This may change later on.
  • This engine runs in the Windows console, so no cross-platform support. I don't know anything about writing code for platforms other than Windows currently. Maybe in the future...
  • Not multi-threading safe. I've never written a multi-thread application, perhaps in the future this can be dealt with, though I don't understand what need an engine like this would have for multi-threading.
  • I'm actually creating my own indie game project with this engine! It will be open source as well, and I'm sure I'll be sharing it sometime on these forums Smiley
« Last Edit: July 10, 2012, 11:01:54 PM by CecilSunkure » Logged
Nix
Level 10
*****



View Profile
« Reply #1 on: July 10, 2012, 11:32:18 PM »

looks like libtcod
Logged
eigenbom
Level 10
*****



View Profile WWW
« Reply #2 on: July 11, 2012, 12:30:24 AM »

Hey dude, awesome stuff, and I bet it was a lot of fun to build. Smiley Libtcods  really the dominant ascii engine, but that doesn't mean there's no room for contenders!
Logged

_Madk
Level 10
*****


Love, love is a verb Love is a doing word ~♪


View Profile
« Reply #3 on: July 11, 2012, 03:36:05 AM »

WHY DID YOU MAKE CALCIFER A BADGUY  Waaagh!
Logged

JobLeonard
Level 5
*****



View Profile
« Reply #4 on: July 11, 2012, 03:48:17 AM »

WHY DID YOU MAKE CALCIFER A BADGUY  Waaagh!
What are you talking about? He's a hero!
Logged
CecilSunkure
Level 0
**


View Profile WWW Email
« Reply #5 on: July 11, 2012, 08:09:15 AM »

looks like libtcod
Ah yes it does sort of look like that, that one isn't in the Window's console though.

Hey dude, awesome stuff, and I bet it was a lot of fun to build. Smiley Libtcods  really the dominant ascii engine, but that doesn't mean there's no room for contenders!
Thanks for the nice words Smiley

WHY DID YOU MAKE CALCIFER A BADGUY  Waaagh!
Didn't really want him to be the Calcifer from the movie, just sort of stuck his name in there last minute because couldn't think of anything else, haha.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic