Assets | ||
Actor.cpp | ||
Actor.h | ||
ActorManager.cpp | ||
ActorManager.h | ||
ActorManifest.cpp | ||
ActorManifest.h | ||
ActorProperty.cpp | ||
ActorProperty.h | ||
ActorPropertyAnimation.cpp | ||
ActorPropertyAnimation.h | ||
ActorPropertyPhysics.cpp | ||
ActorPropertyPhysics.h | ||
ActorPropertyScript.cpp | ||
ActorPropertyScript.h | ||
ActorPropertySprite.cpp | ||
ActorPropertySprite.h | ||
ActorScript.cpp | ||
ActorScript.h | ||
Animation.cpp | ||
Animation.h | ||
AnimationManifest.cpp | ||
AnimationManifest.h | ||
AppMoonfall.cpp | ||
AppMoonfall.h | ||
AppMoonfallDev.cpp | ||
Assert.cpp | ||
Assert.h | ||
Assets.pak | ||
Buffer.cpp | ||
Buffer.h | ||
Camera.cpp | ||
Camera.h | ||
CameraTarget.cpp | ||
CameraTarget.h | ||
Color.h | ||
Compression.cpp | ||
Compression.h | ||
Define.h | ||
DialogAssetPackager.cpp | ||
DialogAssetPackager.h | ||
DialogueManifest.cpp | ||
DialogueManifest.h | ||
Driver.cpp | ||
Driver.h | ||
EngineCommon.h | ||
Environment.h | ||
EventManager.cpp | ||
EventManager.h | ||
FileManifest.cpp | ||
FileManifest.h | ||
Font.cpp | ||
Font.h | ||
FontManifest.cpp | ||
FontManifest.h | ||
FrameConsole.cpp | ||
FrameConsole.h | ||
FrameMapEditor.cpp | ||
FrameMapEditor.h | ||
FrameSpriteEditor.cpp | ||
FrameSpriteEditor.h | ||
GameCommon.h | ||
Grid.h | ||
Grid.inl | ||
HeapTracker.cpp | ||
HeapTracker.h | ||
ICameraTarget.h | ||
IEventHandler.h | ||
InputManager.cpp | ||
InputManager.h | ||
IWorldContext.h | ||
LuaBinding.cpp | ||
LuaBinding.h | ||
LuaBinding.inl | ||
LuaBindingActor.cpp | ||
LuaBindingActorAnimation.cpp | ||
LuaBindingActorPhysics.cpp | ||
LuaBindingActorScript.cpp | ||
LuaBindingActorSprite.cpp | ||
LuaBindingCamera.cpp | ||
LuaBindingExport.cpp | ||
LuaBindingInput.cpp | ||
LuaBindingUtil.cpp | ||
LuaBindingWorld.cpp | ||
Map.cpp | ||
Map.h | ||
Monostate.h | ||
Monostate.inl | ||
Moonfall.cbp | ||
Moonfall.fbp | ||
Moonfall.sln | ||
Moonfall.vcproj | ||
Moonfall.xrc | ||
Pch.h | ||
README.md | ||
Rect.h | ||
Rect.inl | ||
RefCount.h | ||
RefCount.inl | ||
Script.cpp | ||
Script.h | ||
ScriptManifest.cpp | ||
ScriptManifest.h | ||
ScriptManifest.inl | ||
Serialization.cpp | ||
Serialization.h | ||
Serialization.inl | ||
Sprite.cpp | ||
Sprite.h | ||
SpriteManifest.cpp | ||
SpriteManifest.h | ||
Surface.cpp | ||
Surface.h | ||
SurfaceManager.cpp | ||
SurfaceManager.h | ||
System.cpp | ||
System.h | ||
tinystr.cpp | ||
tinystr.h | ||
tinyxml.cpp | ||
tinyxml.h | ||
tinyxmlerror.cpp | ||
tinyxmlparser.cpp | ||
Token.cpp | ||
Token.h | ||
Trace.cpp | ||
Trace.h | ||
Vector.h | ||
Vector.inl | ||
Window.cpp | ||
Window.h | ||
WindowDialogue.cpp | ||
WindowDialogue.h | ||
WindowDialoguePanel.cpp | ||
WindowDialoguePanel.h | ||
WindowMain.cpp | ||
WindowMain.h | ||
WindowManager.cpp | ||
WindowManager.h | ||
WindowText.cpp | ||
WindowText.h | ||
WindowWorld.cpp | ||
WindowWorld.h | ||
World.cpp | ||
World.h | ||
WorldManifest.cpp | ||
WorldManifest.h | ||
WorldScript.cpp | ||
WorldScript.h | ||
XrcResource.cpp |
Moonfall
Moonfall is the name of a game engine that I spent several months developing back in 2008. It leveraged SDL for graphics, Lua for in-game scripting, and wxWidgets for the built-in developer tools. The cross-platform engine was written using Code::Blocks IDE, but Visual Studio project files are also available.
The inspiration for the game came partially from the Harvest Moon video game for the Super Nintendo and from the When They Cry by 07th Expansion. The protagonist is a city dweller, who upon inheriting a small farm from a distant relative decides to try his hand in agriculture. He finds the residents of the nearby small town a friendly bunch, but something about them does not seem right. Everyone is appears to be hiding something from the player, who must uncover the truth to survive. In short, this is (as I have described it to my friends), "Harvest Moon with murder."
Technology
From a technical point of view, the game engine was an exercise in creating a completely data driven game. In
retrospect, it was probably over-engineered, but in general it was flexible and I liked what I could do with it. At the
core of the engine was the Actor
class, the functionality of which could be expanded through add-on properties. The
property definitions were specified in XML; for example, below is the definition for the playable character:
<Actor alias = "Player.01" dynamic = "1" layer = "4" thumbnail = "Player.01.Idle.S.01">
<Properties>
<Animation />
<Script resource = "Player.01.Default" />
<Physics />
</Properties>
</Actor>
In addition to the self-explainable Animation
and Physics
properties, you can see a Script
node which associates a
Lua script with the actor. Scripts would get notifications about events such as OnActorUpdate
, during which custom
processing could take place:
function OnActorUpdate(elapsed)
if InputIsKeyTriggered(META_KEY_USE) then
DoActorUse()
return
elseif InputIsKeyPressed(META_KEY_UP) then
DoActorWalk(DIRECTION_NORTH)
return
elseif InputIsKeyPressed(META_KEY_DOWN) then
DoActorWalk(DIRECTION_SOUTH)
return
elseif InputIsKeyPressed(META_KEY_LEFT) then
DoActorWalk(DIRECTION_WEST)
return
elseif InputIsKeyPressed(META_KEY_RIGHT) then
DoActorWalk(DIRECTION_EAST)
return
end
DoActorIdle(playerDirection)
end
Scripts can directly interact with properties on the parent Actor
and can communicate with surrounding world via a
messaging system. This made it possible to build any game object imaginable by editing a couple of XML files and some
simple scripting.
function DoActorWalk(direction)
if playerAction == ACTION_WALK and playerDirection == direction then
return
end
ActorPhysicsSetVelocity(playerId, playerWalkVelocities[direction])
ActorAnimationSet(playerId, playerWalkAnimations[direction])
ActorAnimationPlay(playerId, true)
playerDirection = direction
playerAction = ACTION_WALK
end
function DoActorUse()
actorsIds = ActorPhysicsQueryShapeCollisions(
playerId,
ACTOR_SHAPE_TYPE_COLLISION_INTERACT
)
for i, v in ipairs(actorsIds) do
ActorScriptSendMessage(v, "interact", { user = playerId })
end
end
I eventually stopped work on Moonfall due to a lack of time, combined with the fact that I am not an artist and could not author the assets required to develop this into a complete game.
Screenshots
License
GPL