CobbleStones Game Engine
CobbleStones Game Engine
CobbleStones Game Engine is the culmination of many years worth of self study.
I will continue updating the projects, but it is in good enough shape that I can give something back to the community.
unfortunately, I am not very familiar with setting up a git project, but it seems to have uploaded successfully
https://github.com/SevenGameMaker/CobbleStones
basic structure :
CSApplication class provides the primary hook into a game/
CSEngine creates, maintains and destroys all irrlicht structures
CSLevel creates and maintains game logic
CSObjectFactory maintains a list of available objects, creates, maintains and destroys all game objects
CSClassManager searches for and maintains a list of available object classes
CSMessageManager allows passing of messages between systems and game objects
CSPhysX uses the PhysX3.## physics system and is easily combined with CSObjects
includes generic shapes, terrain, tree chunks and character support
CSLevelManager manages CSLevels and provides menu support
CSObject is the base object class
objects are stored in DLL files and loaded by name
objects communicate with each other through messages
objects expose editable variables for the CSO_Editor object to use
CSObject* obj = getObjectFactory()->createObjectByType("CSO_Monster");
if (obj)
{
obj->setScale(vector3df(2,2,2));
setVariable("ActorFileName","dwarf.x"); // this will load the filename and rebuild the scenenode
setVariable("LookAt",vector3dfToStringc(vector3df(100,0,0)); // this will call the lookAt(vector3df pos) function
}
CSObjects are fully serialized and are saved / loaded through the level interface
CSO_Editor is a game object
it allows for real time editing of all game objects and is an example of the flexibility of the object system
-------------------------------------------------------------------------------------------------------------------------------------------------
future involvement :
continue creation of examples
example 1 - basic creation of an application
example 2 - load external file
example 3 - use of light and fog
.....
example 10 - full blown adventure game
I will continue updating the projects, but it is in good enough shape that I can give something back to the community.
unfortunately, I am not very familiar with setting up a git project, but it seems to have uploaded successfully
https://github.com/SevenGameMaker/CobbleStones
basic structure :
CSApplication class provides the primary hook into a game/
CSEngine creates, maintains and destroys all irrlicht structures
CSLevel creates and maintains game logic
CSObjectFactory maintains a list of available objects, creates, maintains and destroys all game objects
CSClassManager searches for and maintains a list of available object classes
CSMessageManager allows passing of messages between systems and game objects
CSPhysX uses the PhysX3.## physics system and is easily combined with CSObjects
includes generic shapes, terrain, tree chunks and character support
CSLevelManager manages CSLevels and provides menu support
CSObject is the base object class
objects are stored in DLL files and loaded by name
objects communicate with each other through messages
objects expose editable variables for the CSO_Editor object to use
CSObject* obj = getObjectFactory()->createObjectByType("CSO_Monster");
if (obj)
{
obj->setScale(vector3df(2,2,2));
setVariable("ActorFileName","dwarf.x"); // this will load the filename and rebuild the scenenode
setVariable("LookAt",vector3dfToStringc(vector3df(100,0,0)); // this will call the lookAt(vector3df pos) function
}
CSObjects are fully serialized and are saved / loaded through the level interface
CSO_Editor is a game object
it allows for real time editing of all game objects and is an example of the flexibility of the object system
-------------------------------------------------------------------------------------------------------------------------------------------------
future involvement :
continue creation of examples
example 1 - basic creation of an application
example 2 - load external file
example 3 - use of light and fog
.....
example 10 - full blown adventure game
Last edited by Seven on Sat May 10, 2014 9:14 pm, edited 1 time in total.
Re: CobbleStones Game Engine
updates :
cleaning up editor object
added prefab ability - objects are saved to disk as individual files and loaded via editor
added cloning ability - objects can be easily cloned inside editor
cleaning up editor object
added prefab ability - objects are saved to disk as individual files and loaded via editor
added cloning ability - objects can be easily cloned inside editor
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Re: CobbleStones Game Engine
Hi, Cool project! What will you use for the sound?
Re: CobbleStones Game Engine
irrklang most likely. Right now I am adding children to the CSObjects class.
It is a little more complicated than I thought but following the ISCeneNode methodology for absolute vs relative.
It is a little more complicated than I thought but following the ISCeneNode methodology for absolute vs relative.
Re: CobbleStones Game Engine
As for sound I can totally recommend cAudio.
beer->setMotivationCallback(this);
Re: CobbleStones Game Engine
I will take a look at cAudio thanks.
I think that I have the children aspect of this down. It gets complicated because the physX object auto updates the CSObject position and rotation, but I also need the editor to have the ability to set these. Nothing is ever easy right
next step, creation of the CSDnD class.
Fully realized Dungeons and Dragons style database with spells, items and characters.
The structure is created, now to put the object class through it's paces..........
I think that I have the children aspect of this down. It gets complicated because the physX object auto updates the CSObject position and rotation, but I also need the editor to have the ability to set these. Nothing is ever easy right
next step, creation of the CSDnD class.
Fully realized Dungeons and Dragons style database with spells, items and characters.
The structure is created, now to put the object class through it's paces..........
Re: CobbleStones Game Engine
example 5 adds character control and children objects.
In this example, the main character has a light object attached to him.
The character uses a PhysX character controller and uses the CSActionTable to manipulate it's animations,
boxes 'shot' into the scene are physX controlled cubes.
The editor is available in this demo.
In this example, the main character has a light object attached to him.
Code: Select all
// Example5
// simple example that creates a level and loads a saved file
// use arrow keys and mouse to move around level
// adds character manipulation and child object (light->character)
#include "stdafx.h"
#include "CSApplication.h"
#include "CSEngine.h"
#include "CSLevel.h"
#include "CSLevelManager.h"
#include "CSObjectFactory.h"
#ifdef _DEBUG
#pragma comment(lib,"cobblestones_d.lib")
#else
#pragma comment(lib,"cobblestones.lib")
#endif
using namespace CS;
// simple define to identify our editor object
#define ID_LEVEL 7
#define ID_EDITOR 77
#define ID_CHARACTER 777
class myApp : public CSApplication
{
public:
// dual creation allows for better error handling
// constructors do not have a return value
virtual bool create(HWND hwnd = 0)
{
// call the base class to create the app
CS_CHECK_BOOL(CSApplication::create(hwnd), "ERROR! myApp::create() base class creation failed");
// set the caption on the irrlicht window to something nice
getEngine()->setWindowCaption("CobbleStones Game Engine - Example 5");
// instantiate a new level, initialize and create it
CSLevel* l = new CSLevel();
l->initialize();
CS_CHECK_BOOL(l->create(this, ID_LEVEL), "ERROR! level creation failed");
// add an FPS camera to the level
l->setCamera(getSmgr()->addCameraSceneNodeFPS());
// set this level to use lighting
l->setUseLight(false);
// set the camera position and target
l->getCamera()->setPosition(vector3df(0, 200, 0));
l->getCamera()->setTarget(vector3df(100, 10, 100));
// load up a nice demo file
CS_CHECK_BOOL(l->loadFromDisk(getDirectory("GameSaveDirectory") + "example5.cs"), "ERROR! unable to load level file");
// if the character was not saved in the level file
CSObject* obj = l->getObjectFactory()->getObjectPointer(ID_CHARACTER);
if (!obj)
{
// create the character and setup the character variables
CSObject* character = l->createObjectByType("CSO_Character", true, ID_CHARACTER, true);
character->setVariable("ActorFileName", "_assets/models/royalknight/RoyalKnight.b3d");
character->setVariable("ActionTableFileName", "RoyalKnight.actiontable");
character->setScale(vector3df(0.75, 0.75, 0.75));
character->setPosition(vector3df(0, 500, 0));
character->setPositionOffset(vector3df(0, -70, 0));
character->setVariable("MoveSpeed", floatToStringc(12));
}
// add a child light to the character, it will stay 30 units above the character as he walks
CSObject* light = l->createObjectByType("CSO_Light",true,0,true);
light->setVariable("Radius", stringc(500));
light->setPosition(vector3df(0,30,0));
light->setDebugObject(true);
light->setParent(obj);
// add the new level to the level manager and set it as the active level
getLevelManager()->addLevel(l);
getLevelManager()->setNextLevel(ID_LEVEL);
}
virtual void frame(const float& elapsedtime)
{
// call the base class
CSApplication::frame(elapsedtime);
// let the level render
CS_SAFE(getCurrentLevel(), render());
}
virtual bool OnKeyInputEvent(const SEvent& e)
{
switch (e.KeyInput.Key)
{
// if the user hits the escape key
case KEY_ESCAPE:
{
// exit the program
setMode(MODE_QUIT);
// we used this message
return true;
}
case KEY_F1:
{
// make sure that we have a valid level
if (!getCurrentLevel()) return true;
// see if the editor object already exists
CSObject* obj = getCurrentLevel()->getObjectFactory()->getObjectPointer(ID_EDITOR);
// if it does, toggle whether it is active or not
if (obj) obj->setVariable("Active", stringc(!stringcToInt(obj->getVariable("Active"))));
// otherwise
else
// create a new editor object
CSObject* obj = getCurrentLevel()->createObjectByType("CSO_Editor", true, ID_EDITOR);
// we used this message
return true;
}
// add an event handler for the spacebar being pressed
case VK_SPACE:
{
// make sure that we have a valid level and physx world
if (getCurrentLevel() && getCurrentLevel()->getPhysXWorld())
// toggle rendering the physx world
getCurrentLevel()->getPhysXWorld()->setRenderDebugInfo(!getCurrentLevel()->getPhysXWorld()->getRenderDebugInfo());
// we used this message
return true;
}
// add an event handler for togglling the lights
case KEY_KEY_L:
{
// make sure that we have a valid level and physx world
if (getCurrentLevel())
// toggle using lighting for rendering
getCurrentLevel()->setUseLight(!getCurrentLevel()->getUseLight());
// we used this message
return true;
}
// add an event handler for togglling the lights
case KEY_KEY_F:
{
// make sure that we have a valid level and physx world
if (getCurrentLevel())
// toggle using lighting for rendering
getCurrentLevel()->setUseFog(!getCurrentLevel()->getUseFog());
// we used this message
return true;
}
}
// let the base class handle the event
return CSApplication::OnKeyInputEvent(e);
};
// add an event handler for the right mouse button being pressed
// this will toggle whether the FPS camera has control or not
virtual bool OnRMousePressedDown(const SEvent& e)
{
// make sure that we have a valid level to work with
if (!getCurrentLevel()) return false;
// if we have a valid camera
if (getCurrentLevel()->getCamera())
// toggle the mouse capture
getCurrentLevel()->getCamera()->setInputReceiverEnabled(!getCurrentLevel()->getCamera()->isInputReceiverEnabled());
// let the base class handle the event
return CSApplication::OnRMousePressedDown(e);
}
// add an event handler for the middle mouse button being pressed
// this will 'shoot' a box from the camera into the scene
virtual bool OnMMousePressedDown(const SEvent& e)
{
// make sure that we have a valid level to work with
if (!getCurrentLevel()) return false;
// if we have a valid camera
if (getCurrentLevel()->getCamera())
{
CSObject* obj = getCurrentLevel()->createObjectByType("CSO_Cube", true);
if (obj)
{
obj->setPosition(getCurrentLevel()->getCamera()->getPosition());
obj->addForce(getCurrentLevel()->getCamera()->getTarget() - getCurrentLevel()->getCamera()->getPosition(), 50000);
}
}
// let the base class handle the event
return CSApplication::OnMMousePressedDown(e);
}
virtual void preFrame(const float &elapsedtime)
{
CSApplication::preFrame(elapsedtime);
CSObject* obj = getCurrentLevel()->getObjectFactory()->getObjectPointer(ID_CHARACTER);
if (obj)
{
if (GetAsyncKeyState(VK_SHIFT)) obj->setVariable("Run", "1"); else obj->setVariable("Run", "0");
if (IsKeyDown(KEY_KEY_W)) obj->setVariable("Forward", "1"); else obj->setVariable("Forward", "0");
if (IsKeyDown(KEY_KEY_S)) obj->setVariable("Backward", "1"); else obj->setVariable("Backward", "0");
if (IsKeyDown(KEY_KEY_D)) obj->setVariable("TurnLeft", "1"); else obj->setVariable("TurnLeft", "0");
if (IsKeyDown(KEY_KEY_A)) obj->setVariable("TurnRight", "1"); else obj->setVariable("TurnRight", "0");
if (IsKeyDown(KEY_KEY_Q)) obj->setVariable("StrafeLeft", "1"); else obj->setVariable("StrafeLeft", "0");
if (IsKeyDown(KEY_KEY_E)) obj->setVariable("StrafeRight", "1"); else obj->setVariable("StrafeRight", "0");
}
}
};
int _tmain(int argc, _TCHAR* argv[])
{
// declare an app instance
myApp app;
// initialize the app structure
app.initialize();
// if the app creates successfully, run it
if (app.create(0)) app.run();
else CS_LOG("ERROR! application did not create successfully. Exiting program gracefully....");
// cleanup whatever memory mess the app made
app.cleanup();
// tell the user we are done
CS_LOG("press any key to continue...");
// let the user see the log before exiting the program
// _getch();
}
The character uses a PhysX character controller and uses the CSActionTable to manipulate it's animations,
boxes 'shot' into the scene are physX controlled cubes.
The editor is available in this demo.
Re: CobbleStones Game Engine
example 6 moves all level managed items to our own level class
adds spring camera to follow character around
adds spring camera to follow character around
Code: Select all
// Example6
// add user defined level
// add spring camera control
#include "stdafx.h"
#include "CSApplication.h"
#include "CSEngine.h"
#include "CSLevel.h"
#include "CSLevelManager.h"
#include "CSObjectFactory.h"
#include "CSSpringCam.h"
#ifdef _DEBUG
#pragma comment(lib,"cobblestones_d.lib")
#else
#pragma comment(lib,"cobblestones.lib")
#endif
using namespace CS;
// simple define to identify our editor object
#define ID_LEVEL 7
#define ID_EDITOR 77
#define ID_CHARACTER 777
class myLevel : public CSLevel
{
ADD_VARIABLE_GET(CSSpringCam, SpringCam);
virtual void initialize()
{
// call the base class
CSLevel::initialize();
}
virtual bool create(CSApplication* app, int id)
{
// attempt to create the base class
CS_CHECK_BOOL(CSLevel::create(app, id), "ERROR! myLevel::base class creation failed");
// everything went fine
return true;
}
virtual bool cleanup()
{
// call the base class
return CSLevel::cleanup();
}
virtual bool loadFromDisk(stringc filename, bool destroyold)
{
CS_CHECK_BOOL(CSLevel::loadFromDisk(filename, destroyold),"ERROR! unable to load level from disk");
// add an FPS camera to the level
setCamera(getSmgr()->addCameraSceneNodeFPS());
// set this level to use lighting
setUseLight(false);
// set the camera position and target
getCamera()->setPosition(vector3df(0, 200, 0));
getCamera()->setTarget(vector3df(100, 10, 100));
CSObject* character = getObjectFactory()->getObjectPointer(ID_CHARACTER);
if (!character)
{
// setup the character variables
character = createObjectByType("CSO_Character", true, ID_CHARACTER, true);
character->setVariable("ActorFileName", "_assets/models/royalknight/RoyalKnight.b3d");
character->setVariable("ActionTableFileName", "RoyalKnight.actiontable");
character->setScale(vector3df(0.75, 0.75, 0.75));
character->setPosition(vector3df(0, 500, 0));
character->setPositionOffset(vector3df(0, -70, 0));
character->setVariable("MoveSpeed", floatToStringc(12));
}
CSObject* light = createObjectByType("CSO_Light", true, 0, false);
light->setVariable("Radius", stringc(500));
light->setPosition(vector3df(0, 30, 0));
light->setDebugObject(true);
light->setParent(character);
m_SpringCam.initCameraSpring(getCamera(), character);
return true;
}
virtual void postFrame(const float &elapsedtime)
{
CSObject* character = getObjectFactory()->getObjectPointer(ID_CHARACTER);
if (character) getCamera()->setPosition(m_SpringCam.updateCameraSpring(getCamera(), character));
CSLevel::postFrame(elapsedtime);
}
virtual bool OnKeyInputEvent(const SEvent& e)
{
switch (e.KeyInput.Key)
{
case KEY_F1:
{
// see if the editor object already exists
CSObject* obj = getObjectFactory()->getObjectPointer(ID_EDITOR);
// if it does, toggle whether it is active or not
if (obj) obj->setVariable("Active", stringc(!stringcToInt(obj->getVariable("Active"))));
// otherwise
else
// create a new editor object
CSObject* obj = createObjectByType("CSO_Editor", true, ID_EDITOR);
// we used this message
return true;
}
// add an event handler for the spacebar being pressed
case VK_SPACE:
{
// make sure that we have a valid level and physx world
if (getPhysXWorld())
// toggle rendering the physx world
getPhysXWorld()->setRenderDebugInfo(!getPhysXWorld()->getRenderDebugInfo());
// we used this message
return true;
}
// add an event handler for togglling the lights
case KEY_KEY_L:
{
// toggle using lighting for rendering
setUseLight(!getUseLight());
// we used this message
return true;
}
// add an event handler for togglling the lights
case KEY_KEY_F:
{
// toggle using lighting for rendering
setUseFog(!getUseFog());
// we used this message
return true;
}
}
// let the base class handle the event
return CSLevel::OnKeyInputEvent(e);
};
// add an event handler for the right mouse button being pressed
// this will toggle whether the FPS camera has control or not
virtual bool OnRMousePressedDown(const SEvent& e)
{
// if we have a valid camera
if (getCamera())
// toggle the mouse capture
getCamera()->setInputReceiverEnabled(!getCamera()->isInputReceiverEnabled());
// let the base class handle the event
return CSLevel::OnRMousePressedDown(e);
}
// add an event handler for the middle mouse button being pressed
// this will 'shhot' a box from the camrea into the scene
virtual bool OnMMousePressedDown(const SEvent& e)
{
// if we have a valid camera
if (getCamera())
{
CSObject* obj = createObjectByType("CSO_Cube", true);
if (obj)
{
obj->setPosition(getCamera()->getPosition());
obj->addForce(getCamera()->getTarget() - getCamera()->getPosition(), 50000);
}
}
// let the base class handle the event
return CSLevel::OnMMousePressedDown(e);
}
virtual void preFrame(const float &elapsedtime)
{
CSLevel::preFrame(elapsedtime);
CSObject* obj = getObjectFactory()->getObjectPointer(ID_CHARACTER);
if (GetAsyncKeyState(VK_SHIFT)) obj->setVariable("Run", "1"); else obj->setVariable("Run", "0");
if (IsKeyDown(KEY_KEY_W)) obj->setVariable("Forward", "1"); else obj->setVariable("Forward", "0");
if (IsKeyDown(KEY_KEY_S)) obj->setVariable("Backward", "1"); else obj->setVariable("Backward", "0");
if (IsKeyDown(KEY_KEY_D)) obj->setVariable("TurnLeft", "1"); else obj->setVariable("TurnLeft", "0");
if (IsKeyDown(KEY_KEY_A)) obj->setVariable("TurnRight", "1"); else obj->setVariable("TurnRight", "0");
if (IsKeyDown(KEY_KEY_Q)) obj->setVariable("StrafeLeft", "1"); else obj->setVariable("StrafeLeft", "0");
if (IsKeyDown(KEY_KEY_E)) obj->setVariable("StrafeRight", "1"); else obj->setVariable("StrafeRight", "0");
}
};
class myApp : public CSApplication
{
public:
// dual creation allows for better error handling
// constructors do not have a return value
virtual bool create(HWND hwnd = 0)
{
// call the base class to create the app
CS_CHECK_BOOL(CSApplication::create(hwnd), "ERROR! myApp::create() base class creation failed");
// set the caption on the irrlicht window to something nice
getEngine()->setWindowCaption("CobbleStones Game Engine - Example 6");
// instantiate a new level, initialize and create it
CSLevel* l = new myLevel();
l->initialize();
CS_CHECK_BOOL(l->create(this, ID_LEVEL), "ERROR! level creation failed");
// load up a nice demo file
CS_CHECK_BOOL(l->loadFromDisk(getDirectory("GameSaveDirectory") + "example6.cs"), "ERROR! unable to load level file");
// add the new level to the level manager and set it as the active level
getLevelManager()->addLevel(l);
getLevelManager()->setNextLevel(ID_LEVEL);
}
virtual void frame(const float& elapsedtime)
{
// call the base class
CSApplication::frame(elapsedtime);
// let the level render
CS_SAFE(getCurrentLevel(), render());
}
virtual bool OnKeyInputEvent(const SEvent& e)
{
switch (e.KeyInput.Key)
{
// if the user hits the escape key
case KEY_ESCAPE:
{
// exit the program
setMode(MODE_QUIT);
// we used this message
return true;
}
}
// let the base class handle the event
return CSApplication::OnKeyInputEvent(e);
};
};
int _tmain(int argc, _TCHAR* argv[])
{
// declare an app isntance
myApp app;
// initialize the app structure
app.initialize();
// if the app creates successfully, run it
if (app.create(0)) app.run();
else CS_LOG("ERROR! application did not create successfully. Exiting program gracefully....");
// cleanup whatever memory mess the app made
app.cleanup();
// tell the user we are done
CS_LOG("press any key to continue...");
// let the user see the log before exiting the program
// _getch();
}
Re: CobbleStones Game Engine
example7 adds menuing system.
all menus are CSLevel derived classes, allowing for full 3d environments 'behind' the menu buttons and text.
right now have fully functional main menu, options menu, 'new game' and 'return to game' menuing completed.
next step : gui buttons that are embedded in the 3d geometry. I have done this before so it should be fairly simple to insert an old code base.
this will allow for some very interesting effects......
in my mind right now i see a menu level that is fully 3d, with pillars placed around the world. as the user clicks on the pillar,
the character will walk up to the pillar and press the button. very interested to see how easy this is with the new object system.......
all menus are CSLevel derived classes, allowing for full 3d environments 'behind' the menu buttons and text.
right now have fully functional main menu, options menu, 'new game' and 'return to game' menuing completed.
next step : gui buttons that are embedded in the 3d geometry. I have done this before so it should be fairly simple to insert an old code base.
this will allow for some very interesting effects......
in my mind right now i see a menu level that is fully 3d, with pillars placed around the world. as the user clicks on the pillar,
the character will walk up to the pillar and press the button. very interested to see how easy this is with the new object system.......
Re: CobbleStones Game Engine
added gui on 3d surfaces. need to texture appropriately so that the gui elements look like part of the geometry, but functionality over looks for now.
added triggers and contact notifications to the physx system.
register for contact notifications through physx manager - example registerForCollisionResponses(OBJECT_TYPE::CSOBJECT, OBJECT_TYPE:CSOBJECT_CHARACTER)
will send message to characters when contacts with CSOBJECT type objects are detected.
in example 7, shooting boxes onto the terrain - when character 'touches' box, message is sent and box is destroyed.
since character to terrain collisions are not requested, no message is sent as character jumps / moves around terrain
since character to staticobject collisions are not requested, no message is sent as character collides with buildings
so far so good.......we can setup unlimited, any objecttype to any objecttype collision notifications
next step : add AI for NPC characters.
NPC characters are derived from CSObject_Character and therefor have action tables for animation controls.
built in CSObject functions for determining the 'in' 'left' and 'up' of objects allows for easy manipulation of character movement, rotation and animations.
need to create CSAI class to handle goal setting and decision making.
envisioning something like.....
setGoal(CSGOAL::CONSUME,someObjectId);
which will auto create additioanl goals to achive success like
addGoal(CSGOAL::GET,id);
which creates
addGoal(CSGOAL::GOTO,id);
so setting one goal create a list of goals to achieve. int his case :
goto the object, get the object, and then consume the object.
where character will use functions like
CSGoal_Consume::update()
{
CSObject* obj = getObjectPointer(someobjectid);
if (obj->getParent() == this)
{
//we own it, so just consume it
???
removethisgoal();
}
else
{
addGoal(CSGOAL_GET,someobjectid);
}
}
CSGoal_GoTo::update()
{
CSObject* obj = getObjectPointer(someobjectid);
if (obj)
{
if (closeEnough(obj->getPosition()) removeThisGoal();
else moveTowards(obj->getPosition())
}
}
CSGoal_Get::update()
{
CSObject* obj = getObjectPointer(someobjectid);
if (obj)
{
if (closeEnough(obj->getPosition())
{
addToInventory(someobjectid);
removeThisGoal();
obj->removeFromLevel();
}
}
else addGoal(CSGOAL_GOTO,someobjectid);
}
we will see how it goes, but it looks good on paper
added triggers and contact notifications to the physx system.
register for contact notifications through physx manager - example registerForCollisionResponses(OBJECT_TYPE::CSOBJECT, OBJECT_TYPE:CSOBJECT_CHARACTER)
will send message to characters when contacts with CSOBJECT type objects are detected.
in example 7, shooting boxes onto the terrain - when character 'touches' box, message is sent and box is destroyed.
since character to terrain collisions are not requested, no message is sent as character jumps / moves around terrain
since character to staticobject collisions are not requested, no message is sent as character collides with buildings
so far so good.......we can setup unlimited, any objecttype to any objecttype collision notifications
next step : add AI for NPC characters.
NPC characters are derived from CSObject_Character and therefor have action tables for animation controls.
built in CSObject functions for determining the 'in' 'left' and 'up' of objects allows for easy manipulation of character movement, rotation and animations.
need to create CSAI class to handle goal setting and decision making.
envisioning something like.....
setGoal(CSGOAL::CONSUME,someObjectId);
which will auto create additioanl goals to achive success like
addGoal(CSGOAL::GET,id);
which creates
addGoal(CSGOAL::GOTO,id);
so setting one goal create a list of goals to achieve. int his case :
goto the object, get the object, and then consume the object.
where character will use functions like
CSGoal_Consume::update()
{
CSObject* obj = getObjectPointer(someobjectid);
if (obj->getParent() == this)
{
//we own it, so just consume it
???
removethisgoal();
}
else
{
addGoal(CSGOAL_GET,someobjectid);
}
}
CSGoal_GoTo::update()
{
CSObject* obj = getObjectPointer(someobjectid);
if (obj)
{
if (closeEnough(obj->getPosition()) removeThisGoal();
else moveTowards(obj->getPosition())
}
}
CSGoal_Get::update()
{
CSObject* obj = getObjectPointer(someobjectid);
if (obj)
{
if (closeEnough(obj->getPosition())
{
addToInventory(someobjectid);
removeThisGoal();
obj->removeFromLevel();
}
}
else addGoal(CSGOAL_GOTO,someobjectid);
}
we will see how it goes, but it looks good on paper
Re: CobbleStones Game Engine
almost forgot, added collision response to test 'fire' object.
when character touches fire, message is sent describing the event.
when character recieves FIREDAMAGE event, text scrolls up the screen indicating that this is hot
since each object can either rely on default event handler or have their own,
we can do things like
when character touches fire, damage is attained.
when FireGolem touches fire, it grows in strength.
both objects receive the same message which is generated by the fire object itself, and can react hwoever they want.
when character touches fire, message is sent describing the event.
when character recieves FIREDAMAGE event, text scrolls up the screen indicating that this is hot
since each object can either rely on default event handler or have their own,
we can do things like
when character touches fire, damage is attained.
when FireGolem touches fire, it grows in strength.
both objects receive the same message which is generated by the fire object itself, and can react hwoever they want.
Re: CobbleStones Game Engine
example 8 :
added quite a bit of things - it now includes :
individual app files
individual level files
active menu system
main character
game objects
--- level trigger - sends text to level when detected
--- fire object - sends fire damage to penetrating object
--- full children branching. position, rotation, scale
--- NPC objects
working on trees and foliage.
on target for complete adventure game by example 10.
added quite a bit of things - it now includes :
individual app files
individual level files
active menu system
main character
game objects
--- level trigger - sends text to level when detected
--- fire object - sends fire damage to penetrating object
--- full children branching. position, rotation, scale
--- NPC objects
working on trees and foliage.
on target for complete adventure game by example 10.
Re: CobbleStones Game Engine
i can not download from github , it start downloading at first but stop when reach 12 or 13 mb .
Re: CobbleStones Game Engine
I will try to download today. I haven't tried before so......let's see what happens.airc wrote:i can not download from github , it start downloading at first but stop when reach 12 or 13 mb .
Re: CobbleStones Game Engine
I just downloaded the files with no issue......I am not a github expert by any means so not sure how I can help on this one.airc wrote:i can not download from github , it start downloading at first but stop when reach 12 or 13 mb .