• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

thatdudeoverthere

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

136 Neutral

About thatdudeoverthere

  • Rank
    Newbie
  1. I'll currently run into a dead end trying to fix this error. I'm trying to pass a asIScriptObject ("*asObj") to the script and keep receiving the asINVALID_ARG return code. The factory function returns a valid pointer to the asIScriptObject and everything runs smoothly until I pass that same pointer to the script engine for the "update function". I would be more than happy to post more code as needed to help. Here's some of the revelant source code C++ file "Script_Manager.cpp" [source lang="java"] void Script_Manager::init() { //...code left out for simplicity....// // Register the object methods r = ScriptEngine->RegisterObjectMethod("SceneNode", "vector3 &getPosition() const", asMETHOD(SceneNode, getPosition), asCALL_THISCALL); assert( r >= 0); r = ScriptEngine->RegisterObjectMethod("SceneNode", "void setPosition(const vector3 &in)", asMETHODPR(SceneNode, setPosition, (const Vector3 &pos), void), asCALL_THISCALL); assert( r >= 0); /////////GAME MANAGER REGISTERING////////// //Register all the reference types so the Script ScriptEngine can interpret them in the scripts //Register the 'GameManager' which is really an alias for the BaseApplication Singleton class r = ScriptEngine->RegisterObjectType("GameManager", 0, asOBJ_REF | asOBJ_NOCOUNT); //////////GAME ENTITY REGISTERING////////// //Register the 'GameEntity' type which is really an alias for the Game_Entity class r = ScriptEngine->RegisterObjectType("GameEntity", 0, asOBJ_REF); //Register the 'GameEntity' addRef/release behaviours r = ScriptEngine->RegisterObjectBehaviour("GameEntity", asBEHAVE_ADDREF, "void addRef()", asMETHOD(Game_Entity, addRef), asCALL_THISCALL); r = ScriptEngine->RegisterObjectBehaviour("GameEntity", asBEHAVE_RELEASE, "void release()", asMETHOD(Game_Entity, release), asCALL_THISCALL); //r = ScriptEngine->RegisterObjectMethod("GameEntity", "void setID(int newID)", asMETHOD(Game_Entity, setID), asCALL_THISCALL); r = ScriptEngine->RegisterObjectMethod("GameEntity", "SceneNode@ getSceneNode()", asMETHOD(Game_Entity, getSceneNode), asCALL_THISCALL); assert( r >= 0); //local instance that shouldn't be used outside of this 'init' function CScriptBuilder ScriptBuilder; ScriptBuilder.StartNewModule(ScriptEngine, "ScriptModule"); r = ScriptBuilder.AddSectionFromFile("apple.as"); r = ScriptBuilder.BuildModule(); ScriptModule = ScriptEngine->GetModule("ScriptModule"); //create a pointer to a asIScriptContext ctx = ScriptEngine->CreateContext(); ctx->SetExceptionCallback(asFUNCTION(ExceptionCallback), 0, asCALL_CDECL); // Get the object type asIObjectType *type = ScriptEngine->GetObjectTypeById(ScriptModule->GetTypeIdByDecl("Player")); ScriptFunction = type->GetFactoryByDecl("Player@ Player(GameEntity@ Entity)"); UpdateFunction = type->GetMethodByDecl("void Update()"); } [/source] C++ file "Entity_Manager.cpp" [source lang="cpp"]void Entity_Manager::addGame_Entity(Game_Entity* addedEntity) { EntityList.push_back(addedEntity); addedEntity->setID(EntityList.size()); } void Entity_Manager::spawnGame_Entity(BaseApplication* GameManager, std::string filename, Ogre::Vector3 pos) { Game_Entity* entity = new Game_Entity(); entity->gEntity = GameManager->getSceneMgr()->createEntity(filename, filename + ".mesh"); entity->gSceneNode = GameManager->getSceneMgr()->getRootSceneNode()->createChildSceneNode(); entity->gSceneNode->attachObject(entity->gEntity); entity->init(GameManager); //set the spawn position entity->gSceneNode->setPosition(pos); addGame_Entity(entity); } //This is called in the Gameplay State... (left out for simplicity) void Entity_Manager::update(BaseApplication* GameManager) { for(EntityIterator = EntityList.begin(); EntityIterator != EntityList.end(); ++EntityIterator) { (*EntityIterator)->update(GameManager); } }[/source] C++ file "Game_Entity.cpp" [source lang="cpp"]void Game_Entity::init(BaseApplication* GameManager) { int result; GameManager->getScriptManager()->getScriptContext()->Prepare(GameManager->getScriptManager()->getFactoryFunction()); result = GameManager->getScriptManager()->getScriptContext()->SetArgObject(0, this); result = GameManager->getScriptManager()->getScriptContext()->Execute(); asObj = *(asIScriptObject**)GameManager->getScriptManager()->getScriptContext()->GetAddressOfReturnValue(); asObj->AddRef(); } void Game_Entity::update(BaseApplication* GameManager) { int result; result = GameManager->getScriptManager()->getScriptContext()->Prepare(GameManager->getScriptManager()->getUpdateFunction()); //this appears to be the source of my woes.... result = GameManager->getScriptManager()->getScriptContext()->SetArgObject(0, this->asObj); result = GameManager->getScriptManager()->getScriptContext()->Execute(); }[/source] AngelScript file "Player.as" [source lang="plain"]class Player { Player(GameEntity @Entity) { health = 100; @self = Entity; } void Update() { self.getSceneNode().setPosition(self.getSceneNode().getPosition() + vector3(.25, 0, 0)); } GameEntity@ self; int health; }[/source] -THANKS IN ADVANCE!
  2. I'm curious to whether this is true, that classes that are a 'base' class or a 'derived' class must be registered as a reference type and cannot be registered as a value type. I am planning on expanding this example with more complex classes for my applications, but wanted to cover this before I moved on and have to rewrite code accordingly. For example: (C++) [source lang="cpp"] class Base { public: virtual void execute() = 0; }; class Derived : public Base { public: Derived(); ~Derived(); virtual void execute(); int value; }; [/source] And this is how I registered them for angelscript NOTE: addRef() & Release() are left out for clarity. (asOBJ_REF type) [source lang="cpp"] // Register the derived type result = asEngine->RegisterObjectType("derived", 0, asOBJ_REF ); assert( result >= 0 ); result = asEngine->RegisterObjectBehaviour("derived", asBEHAVE_ADDREF, "void addRef()", asMETHOD(Derived, addRef), asCALL_THISCALL); assert( result >= 0 ); result = asEngine->RegisterObjectBehaviour("derived", asBEHAVE_RELEASE, "void Release()", asMETHOD(Derived, Release), asCALL_THISCALL); assert( result >= 0 ); result = asEngine->RegisterObjectProperty("derived", "int value", asOFFSET(Derived, value)); assert( result >= 0 ); result = asEngine->RegisterObjectMethod("derived", "void execute()", asMETHOD(Derived, execute), asCALL_THISCALL); assert( result >= 0 );[/source] And this is how I registered them for angelscript (asOBJ_VALUE type) [source lang="cpp"] result = asEngine->RegisterObjectType("derived", sizeof(Derived), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CD); assert( result >= 0 ); result = asEngine->RegisterObjectProperty("derived", "int value", asOFFSET(Derived, value)); assert( result >= 0 ); result = asEngine->RegisterObjectMethod("derived", "void execute()", asMETHOD(Derived, execute), asCALL_THISCALL); assert( result >= 0 );[/source] When I use the asOBJ_REF version of the code it works properly, but when I use the asOBJ_VALUE version I receive a access violation. So my question is whether this is true or am I registering the value type version incorrectly?
  3. i'm redesigning my code as we speak(well as we type) the code i posted seemed too cubersome and bugged obviously. but thanks evillive2http://www.gamedev.net/community/forums/images/icons/icon92.gif
  4. [smile]Hi guys i'm new here and this seems to be the section to go to and i need some help access violation reading locations with my game using irrlicht and msvc express 2008... So i guess i'll post some code and see what you guys think... the problem void level_manager::load_level01() { level_mesh = glevel_manager->getSceneMgr()->getMesh("media/level.x"); //<--the violation glevel_manager->getSceneMgr()->getMeshManipulator()->makePlanarTextureMapping(level_mesh->getMesh(0), 0.004f); level_node = glevel_manager->getSceneMgr()->addAnimatedMeshSceneNode(level_mesh); level_node->setMaterialTexture(0, glevel_manager->getVideo()->getTexture("media/level.jpg")); level_node->getMaterial(0).SpecularColor.set(0,0,0,0); } the game manager of all the managers #include "game_manager.h" #include "game_entity.h" #include "level_manager.h" game_manager::game_manager() { initalizeDevice(); initalizeDrivers(); init(); } game_manager::~game_manager() { //closes the engine } void game_manager::initalizeDevice() { gDevice = createDevice(EDT_DIRECT3D9,dimension2d<s32>(640,640),32,false,true,true,this); if(gDevice == NULL) gDevice = createDevice(EDT_OPENGL,dimension2d<s32>(640,640),32,false,true,true,this); } void game_manager::initalizeDrivers() { gVideo = gDevice->getVideoDriver(); gSceneMgr = gDevice->getSceneManager(); gGUIEnv = gDevice->getGUIEnvironment(); gDevice->setWindowCaption(L"Project_METAL Irrevelant Studios"); //dwarfmesh = gSceneMgr->getMesh("media/dwarf.x"); //dwarfnode = gSceneMgr->addAnimatedMeshSceneNode(dwarfmesh,0,-1,vector3df(-5,-20,35)); camera = gSceneMgr->addCameraSceneNodeFPS(); } void game_manager::init() { //to be coded } IrrlichtDevice* game_manager::getDevice() { return gDevice; } IVideoDriver* game_manager::getVideo() { return gVideo; } ISceneManager* game_manager::getSceneMgr() { return gSceneMgr; } IGUIEnvironment* game_manager::getGUIEnv() { return gGUIEnv; } game_entity* game_manager::get_entity_manager() { return entity_manager; } level_manager* game_manager::get_level_manager() { return mlevel_manager; } bool game_manager::OnEvent(const SEvent &event) { if (event.EventType == EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown) { switch (event.KeyInput.Key) { case irr::KEY_ESCAPE: gDevice->closeDevice(); break; case irr::KEY_KEY_0: mlevel_manager->load_level01(); break; case irr::KEY_KEY_1: gDevice->closeDevice(); break; default: break; } } return false; } i know not all of you are familiar with irrlicht and access violations are tricky but i really need some help and i keep staring at the debugger trying to solve this for hours. Anyhow thanks in advance for any help. (p.s.)i can post more code if it will make things easier to solve. [Edited by - thatdudeoverthere on April 30, 2009 8:00:02 PM]