• 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.

NSDuo

Members
  • Content count

    40
  • Joined

  • Last visited

Community Reputation

329 Neutral

About NSDuo

  • Rank
    Member
  1. Got it!   achild, you were right. The texture reference wasn't being written because it was looking at the wrong reference container, and now it's fixed!     Thank you everyone!
  2. I suppose I was being a little stupid by not posting the full code ( I don't know if it was my ego or whatever...) but I asked for help, so here it is... int scene::dumpToFile(std::string file) { std::string wFileExt = file; wFileExt.append(".sinncascene"); //wFileExt.append(".txt"); // open for writing only //f.open(wFileExt); std::ofstream f; f.open(wFileExt, std::ios::trunc | std::ios::binary | std::ios::out); if (!f.good()) { printf("The file '%s' was not good", wFileExt.c_str()); return -1; } else if (!f.is_open()) { printf("The file '%s' could not be opened", wFileExt.c_str()); return -1; } // set header // 8 bytes ui8* header = (ui8*)"sinnca_"; f.write((char*)header, 8); // 2 bytes ui16 secondaryHeader = 18420; f.write((const char*)&secondaryHeader, 2); /* // set size of file ui64 fSize = sizeof(uint) + sizeof(long) + sizeof(entity) * entityRef.size() + sizeof(grid) * gridRef.size() + sizeof(scene) * sceneRef.size() + sizeof(image) * imageRef.size() + sizeof(texture) * textureRef.size(); // 8 bytes f << fSize; */ // write the number of assets // 4 bytes ui32 noOfAssets = (ui32)(imageRef.size() + textureRef.size()); f.write((const char*)&noOfAssets, 4); // write number of nodes // 4 bytes ui32 noOfNodes = (ui32)(entityRef.size() + gridRef.size() + sceneRef.size()); f.write((const char*)&noOfNodes, 4); /* ******************************************************************************** WRITE IMAGES ******************************************************************************* */ if (imageRef.size() > 0) { for (int i = 0; i < imageRef.size(); i++) { // what kind of asset is this? (2 bytes) //f.write((const char*) 1, 2); f.put((const char) 1); // 1 = image // what number asset are we at? (2 bytes) f.write((const char*) &i, 2); // what is the size of this asset? (2 bytes) ui16 sizeofthing = sizeof(ui16) + imageRef[i]->name.length() + imageRef[i]->path.length() + ((ui8)imageRef[i]->tb); f.write((const char*)&sizeofthing, 2); // this is for just in case the engine doesn't support this type of object yet // the size of the name and the name itself sizeofthing = imageRef[i]->name.length(); f.write((const char*)&sizeofthing, 2); f << imageRef[i]->name.c_str(); // the size of the filepath and the filepath itself sizeofthing = imageRef[i]->path.length(); f.write((const char*)&sizeofthing, 2); f << imageRef[i]->path.c_str(); // the texture blend mode f.write((const char*)&imageRef[i]->tb, 1); } } /* ******************************************************************************** WRITE TEXTURES AND COLORS ******************************************************************************* */ if (textureRef.size() > 0) { for (int i = 0; i < textureRef.size(); i++) { // what kind of asset is this? (2 bytes) //f.write((const char*) 2, 2); f.put((const char) 2); // 2 = texture // what number asset are we at? (2 bytes) f.write((const char*) &i, 2); // what is the size of this asset? (2 bytes) ui16 sizeofthing = (sizeof(ui16) + textureRef[i]->name.length() + (sizeof(ui16) * 5)); f.write((const char*)&sizeofthing, 2); // this is for just in case the engine doesn't support this type of object yet // the size of the name and the name itself sizeofthing = textureRef[i]->name.length(); f.write((const char*)&sizeofthing, 2); f << textureRef[i]->name.c_str(); // find the image this texture is linking to if (imageRef.size() > 0) { for (int j = 0; j < imageRef.size(); j++) { // theres got to be a faster way to do this if (imageRef[j] == textureRef[i]->getSource()) { // what image does this texture use? (2 bytes) f.write((const char*) &j, 2); break; } } } // write the x and y offset into the file (2 + 2 bytes) static int tempx, tempy; textureRef[i]->getOffset(tempx, tempy); f.write((const char*) &tempx, 2); f.write((const char*) &tempy, 2); // write the x and y size into the file (2 + 2 bytes) textureRef[i]->getSize(tempx, tempy); f.write((const char*) &tempx, 2); f.write((const char*) &tempy, 2); // write the base color f.write((const char*)&textureRef[i]->r, 1); f.write((const char*)&textureRef[i]->g, 1); f.write((const char*)&textureRef[i]->b, 1); f.write((const char*)&textureRef[i]->a, 1); } } // terminate the asset list, move on to nodes //f.write((const char*) -1, 2); f.put((const char) -1); // -1 is used to tell the engine to move on to other stuff /* ******************************************************************************** WRITE ENTITIES ******************************************************************************* */ if (entityRef.size() > 0) { for (int i = 0; i < entityRef.size(); i++) { // put it in! //f.write((const char*) 1, 2); f.put((const char) 1); // 1 = entity // what number node is this? f.write((const char*) &i, 2); // size of the entity entry ui16 sizeofthing = entityRef[i]->name.length() + 26; f.write((const char*)&sizeofthing, 2); // name and size of name sizeofthing = entityRef[i]->name.length(); f.write((const char*)&sizeofthing, 2); f << entityRef[i]->name.c_str(); // render object // currently only supports the sprite class //f.write((const char*) 0, 2); f.put((const char) 0); // but is it drawable? f.write((const char*) &entityRef[i]->draw, 1); // color for (int j = 0; j < colorRef.size(); j++) { if (colorRef[j] == entityRef[i]->col) { f.write((const char*) &j, 2); break; } } float position[9] = { (float)entityRef[i]->pos.x, (float)entityRef[i]->pos.y, (float)entityRef[i]->pos.z, (float)entityRef[i]->rot.x, (float)entityRef[i]->rot.y, (float)entityRef[i]->rot.z, (float)entityRef[i]->scl.x, (float)entityRef[i]->scl.y, (float)entityRef[i]->scl.z }; // entity position f.write((const char*) &position[0], sizeof(float)); f.write((const char*) &position[1], sizeof(float)); f.write((const char*) &position[2], sizeof(float)); // entity rotation f.write((const char*) &position[3], sizeof(float)); f.write((const char*) &position[4], sizeof(float)); f.write((const char*) &position[5], sizeof(float)); // entity scale f.write((const char*) &position[6], sizeof(float)); f.write((const char*) &position[7], sizeof(float)); f.write((const char*) &position[8], sizeof(float)); // find the parent! if (entityRef[i]->parent != Tree->currentScene) { for (int j = 0; j < nodeRef.size(); j++) { if (entityRef[i]->parent == nodeRef[j]) { f.write((const char*) &j, 2); } } } else { //f.write((const char*) -2, 2); f.put((const char) -2); // -2 is essentially a null pointer // because -1 is "move on" for the loader } } } /* ******************************************************************************** WRITE GRIDS ******************************************************************************* */ if (gridRef.size() > 0) { for (int i = 0; i < gridRef.size(); i++) { // put it in! //f.write((const char*) 2, 2); f.put((const char) 2); // 2 = grid // what number node is this? f.write((const char*) &i, 2); // size of the grid entry ui16 sizeofthing = gridRef[i]->name.length() + 30 + ((gridRef[i]->getX() * gridRef[i]->getY()) * 2); f.write((const char*)&sizeofthing, 2); // name and size of name sizeofthing = gridRef[i]->name.length(); f.write((const char*)&sizeofthing, 2); f << gridRef[i]->name.c_str(); // render object // currently only supports the sprite class //f.write((const char*) 0, 2); f.put((const char) 0); // but is it drawable? f.write((const char*) &gridRef[i]->draw, 1); // color // we don't need it for the whole grid // write grid size ui16 tempint = gridRef[i]->getX(); f.write(reinterpret_cast<const char*>(&tempint), 2); tempint = gridRef[i]->getY(); f.write(reinterpret_cast<const char*>(&tempint), 2); // go through the attributes of the tiles for (int j = 0; j < gridRef[i]->getX(); j++) { for (int k = 0; k < gridRef[i]->getY(); k++) { static bool tempbool = gridRef[i]->getTile(j, k)->getSolid(); f.write((const char*) &tempbool, 1); for (int l = 0; l < textureRef.size(); l++) { if (gridRef[i]->getTile(j, k)->getTex() == textureRef[l]) { f.write((const char*) &l, 2); break; // loop-ception! } } } } // grid position f.write((const char*) &gridRef[i]->pos.x, 4); f.write((const char*) &gridRef[i]->pos.y, 4); f.write((const char*) &gridRef[i]->pos.z, 4); // grid rotation f.write((const char*) &gridRef[i]->rot.x, 4); f.write((const char*) &gridRef[i]->rot.y, 4); f.write((const char*) &gridRef[i]->rot.z, 4); // grid scale f.write((const char*) &gridRef[i]->scl.x, 4); f.write((const char*) &gridRef[i]->scl.y, 4); f.write((const char*) &gridRef[i]->scl.z, 4); // find the parent! if (gridRef[i]->parent != nullptr) { for (int j = 0; j < nodeRef.size(); j++) { if (gridRef[i]->parent == nodeRef[j]) { f.write((const char*) &j, 2); } } } else { //f.write((const char*) -2, 2); f.put((const char) -2); // -2 is essentially a null pointer // because -1 is "move on" for the loader } } } f.close(); return 0; } int scene::readFromFile(std::string file) { std::string wFileExt = file; if (!wFileExt.find_last_of(".")) { // no file extention. put one on wFileExt.append(".sinncascene"); } std::ifstream f(wFileExt, std::ios::binary); if (!f.good()) { printf("File stream is not good."); return -1; } else if (!f.is_open()) { printf("Could not open %s", wFileExt.c_str()); return -1; } /* std::streampos pos = f.tellg(); char* buffer = (char*)Heap->allocate(pos, __alignof(char*)); // read the file f.seekg(0, std::ios::beg); f.read(buffer, pos); f.close(); // now we're done with the file and we can read from the buffer */ char buffer[8]; ui16 secondaryHeader = 0; f.read(buffer, 8); f.read((char*)&secondaryHeader, 2); if (!strcmp(buffer, "sinnca_") && secondaryHeader != 18420) { f.close(); printf("This is not a valid sinnca scene file"); return -1; } ui32 noOfAssets = 0; f.read((char*)&noOfAssets, 4); ui32 noOfNodes = 0; f.read((char*)&noOfNodes, 4); for (int i = 0; i < noOfAssets; i++) { int obType = 0, numAsset = 0, assetSize = 0; f.read((char*)&obType, 1); f.read((char*)&numAsset, 2); f.read((char*)&assetSize, 2); switch (obType) { case 1: { // It's an image! int nameSize = 0; f.read((char*)&nameSize, 2); std::string thingName; for (int j = 0; j < nameSize; j++) { static char c; f.read(&c, 1); thingName.append(&c); } // how long is the path? int pathSize = 0; f.read((char*)&pathSize, 2); // and the path itself std::string pathName; for (int j = 0; j < pathSize; j++) { static char c; f.read(&c, 1); pathName.append(&c); } ui8 blendMode = 0; f.read((char*)&blendMode, 1); image* im = createImage(thingName); im->load(pathName, (texBlend)blendMode); Tree->currentScene->imageRef.push_back(im); break; } case 2: { // It's a texture! // how long is the name? int nameSize = 0; f.read((char*)&nameSize, 2); // and the name itself std::string thingName; for (int j = 0; j < nameSize; j++) { static char c; f.read(&c, 1); thingName.append(&c); } int imageLink = 0; f.read((char*)&imageLink, 2); // in-image offset int xOff = 0, yOff = 0; f.read((char*)&xOff, 2); f.read((char*)&yOff, 2); // texture dimentions int xSize = 0, ySize = 0; f.read((char*)&xSize, 2); f.read((char*)&ySize, 2); // base color ui8 col[4] = {0, 0, 0, 0}; f.read((char*)&col[0], 1); f.read((char*)&col[1], 1); f.read((char*)&col[2], 1); f.read((char*)&col[3], 1); texture* tx = createTexture(thingName); tx->setSource(Tree->currentScene->imageRef[imageLink]); tx->setOffset(xOff, yOff); tx->setSize(xSize, ySize); tx->r = col[0]; tx->g = col[1]; tx->b = col[2]; tx->a = col[3]; break; } default: { int nameSize = 0; f.read((char*)&nameSize, 2); std::string thingName; f.read((char*)&thingName, nameSize); printf("Object '%s' was not recognized by this version of the engine. A newer version may be required or there was a mis-write when the file was created", thingName.c_str()); break; } } } int tempint = 0; f.read((char*)&tempint, 1); for (int i = 0; i < noOfNodes; i++) { int obType = 0, numNode = 0, nodeSize = 0; f.read((char*)&obType, 1); f.read((char*)&numNode, 2); f.read((char*)&nodeSize, 2); switch (obType) { case 1: { // It's an entity! int nameSize = 0; f.read((char*)&nameSize, 2); std::string thingName; for (int j = 0; j < nameSize; j++) { static char c; f.read(&c, 1); thingName.append(&c); } // this space reserved for renderObj reading int renderLink = 0; f.read((char*)&renderLink, 1); // will this entity draw by default? bool willDraw = true; f.read((char*)&willDraw, 1); // Which texture will we use? int textureLink = 0; f.read((char*)&textureLink, 2); float position[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; for (int j = 0; j < 9 ; j++) { f.read((char*)&position[j], sizeof(float)); //position[j] = endian32bit(position[j]); } int parentLink = -2; f.read((char*)&parentLink, 1); entity* en = createEntity(thingName); en->draw = willDraw; en->col = textureRef[textureLink]; /* en->pos.x = position[0]; en->pos.y = position[1]; en->pos.z = position[2]; en->rot.x = position[3]; en->rot.y = position[4]; en->rot.z = position[5]; en->scl.x = position[6]; en->scl.y = position[7]; en->scl.z = position[8]; */ if (parentLink == -2 || parentLink < 0) { en->parent = this; } else { en->parent = nodeRef[parentLink]; } break; } case 2: { break; } default: { break; } } } f.close(); return 0; } I know there are some weird characters being written, but they were for safeguards I thought I needed at the time, and I really thought I was reading the file correctly.
  3. float x = 0.0f, y = 40.0f, z = 1.0f; void writeTheFile() { std::ofstream f; f.open(wFileExt, std::ios::trunc | std::ios::binary | std::ios::out); f.write((const char*)&x, sizeof(float)); f.write((const char*)&y, sizeof(float)); f.write((const char*)&z, sizeof(float)); f.close() // did I forget this in the last post? I know it's in the program code... } This is basically it.
  4. So I've been working on writing and reading binary file, and I'm surprised that I have gone for as long as I did without any big problems, but I seem to have run into this roadblock that I can't get around. I'm having trouble reading float values from the files I've written, and I'm not exactly sure what causes the problem. // say this is the file // 0.0 // 40.0 // 1.0 int main(ig var, nore nvar) { float a, b, c; std::ifstream f("myfile.fff", std::ios::binary); f.read((char*)&a, sizeof(float)); f.read((char*)&b, sizeof(float)); f.read((char*)&c, sizeof(float)); printf("a: %f\nb: %f\nc: %f\n", a, b, c); } The results I get are:   a: 0 (good, that's what I wanted)   b: 0.0000000000000000000000000000000000000000237211804 (... that's not 40)   c: 0.000000000000000000000000000000000000373583929 (uuugghh)     I searched on google and found that it might be an endian problem and this is where it get confusing for me. I looked in the debugger, changed the value view to 'bytes hex' and I get:   the value of 40:  00 00 20 42   the value of the result:  20 42 00 00   Now because I'm self-taught in c++ there are numerous gaps in my skill set, but I have been understanding that endian-ness is like reading bytes from left to right, or right to left, but this result seems more "shuffled". I also understand that endian-ness differs across processor architectures, so why would this be happening when the file is being written and read on the same machine?    Do I need to fix this with byte swapping?(shuffling) or is there something else that could be the culprit?
  5. I disabled all of the graphics states and got it to work, thank you!   Now I can figure out which one was causing the problem (right after I get some sleep first).
  6.  I'm trying to draw a simple polygon in iOS, but I always end up with a blank glClearColor'ed screen. When I compile the cross-platform code for the desktop, it works.   I've implemented my own matrix functions, set up the shaders properly with "lowp, mediump" appearing only in the mobile version. I don't even get errors with the shaders or OpenGL on desktop or mobile.   From this I've guessed that the problem must be in my rendering code, but I copied the code from a tutorial project that does work and I still can't get anything to render.   Here is my sprite rendering code //Mobile Renderer static const float POSITION[ 8 ] = { 0.0f, 0.0f, // Down left (pivot point) 1.0f, 0.0f, // Up left 0.0f, 1.0f, // Down right 1.0f, 1.0f // Up right }; glUseProgram(Graphics->currentShader->getProgram()); //Graphics->setMatrixMode(SINNCA_MODELVIEW_MATRIX); //Graphics->loadIdentity(); //Graphics->scale(100.0f, 100.0f, 0.0f); GLint att = glGetAttribLocation(Graphics->currentShader->getProgram(), "position"); // returns 0, so that was successful glEnableVertexAttribArray(att); glVertexAttribPointer(att, 2, GL_FLOAT, GL_FALSE, 0, POSITION); glUniformMatrix4fv(Graphics->currentShader->uniformMVMatrix, 1, GL_FALSE, (float*)Graphics->getModelMatrix()); // also works glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); /*//Desktop Renderer. With the matrices and shader this works perfectly glBindBuffer(GL_ARRAY_BUFFER, vBuffer); glBufferSubData(GL_ARRAY_BUFFER, 0, 4 * sizeof(vertex), vertices); glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)offsetof(vertex, texco)); glVertexPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)offsetof(vertex, position)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iBuffer); glUniformMatrix4fv(Graphics->currentShader->uniformMVMatrix, 1, GL_FALSE, (float*)Graphics->getModelMatrix()); glEnableVertexAttribArray(Graphics->currentShader->attributePosition); glVertexAttribPointer(Graphics->currentShader->attributePosition, 2, GL_FLOAT, GL_FALSE, 0, 0); glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, NULL); //glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); */ Is there something wrong with the code or am I forgetting another step?
  7. I'm having trouble compiling DevIL. I manage to configure it the way I want (without directx and with the OpenGL utiliies), but when I give the "make" command I get this error:   "error: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++' make[1]: *** [libIL_la-il_exr.lo] Error 1 make: *** [all-recursive] Error 1"   After some googling, I found that the error means that the computer is trying to compile C++ code with a plain C compiler (and that makes sense that it wouldn't work). However I couldn't find any solutions on how to correct it.   Is there a way to solve this or is it a problem only the lib ray developers can address?
  8. FIXED!!!   What I should have remembered is that my framework has a companion app to help test its functions. And it was the application failing to build when my framework was having no problems. Apparently I needed to:   1: Add the static library to my framework. 2: Add "usr/local/include" and "usr/local/include/freetype2" as the framework's header search paths. 3: Then add "usr/local/include" and "usr/local/include/freetype2" as the companion application's header search paths.     EDIT: NOW FIXED I spoke too soon. Once I started using the library, I got errors saying: "_BZ2_bzdecompress" not found, "_BZ2_bzdecompressEnd" not found, and "_inflate" not found. This was fixed by downloading the "bzip" and "zlib" libraries and including them in my project.
  9. It didn't work...   I added the static library and set the header search path to "usr/local": didn't work. I changed the path to "usr/local/lib": didn't work. I changed the path to "usr/local/include": I think it worked once, but when I added the next include it stopped working, and it won't work even when I set it back.   Is there a way to see where the compiler is actually looking?
  10. I'm trying to get started with Freetype2 in my Xcode 4 project (on Mac OS X of course). I successfully compiled the library through the command line, and I got two dylibs and a static library. I figured I just add one of them to my project and I'll have access to the files right?   Obviously because I'm posting this, it didn't work. #include<ft2build.h> // FILE NOT FOUND   The tutorials specified doing it like this.   #include<libfreetype/ft2build.h> // FILE STILL NOT FOUND   Nope.   #include<libfreetype.a/ft2build.h> #include<libfreetype.dylib/ft2build.h> // HOW DID I THINK THIS WOULD WORK?   I was desperate with this attempt...     I also tried working with the header/library/framework search paths, but couldn't get Xcode to find the files   So... Is there an additional step I didn't know about when adding a non-framework library to a project? Could something have gone wrong when I made the libraries? Should I be including them differently for Mac OS? Did I not provide enough information about my problem? (I always do somehow...)
  11. [quote name='crancran' timestamp='1323190391' post='4891130'] It isn't uncommon in game frameworks to have a scripting system/manager class that on a pre-defined interval (every game loop or every X frames or every X milliseconds) the update() method on the script manager class is executed which iterates each active script and runs the script's update method (or some variant thereof). This is a great way to write game logic that you want to test out and prototype too and if you find the performance isn't ideal, you can then transpose that logic to C++ later if you find it needs to be faster. But the concept allows you rapidly prototype features which is a huge advantage. [/quote] That sounds somewhat like the second method. When you say "each active script", what exactly does that mean? Do you mean a ".lua" file for every scene?
  12. I have a series of nodes used to organize various events into scenes within my engine. However, it has recently occurred to me that I have no idea how to properly program logic for these scenes individually. The only ways I know I could do this is: [b]Many "if" or "case" statements [/b] [code] -- this would be in lua if level1 then level1logic() elseif level2 then level2logic() elseif level3 then level3logic() end -- and so on and so on [/code] I have a strange gut feeling that this method might be too slow and confusing. [b]Scenes calling lua functions[/b] [code] // this would be in C++ scene::callLogic() { luaCall("functionName"); } // and then currentScene->callLogic(); [/code] This is the method I like the most, but I have a feeling it won't work These are the two methods for scripting logic that I was able to come up with, but I'm not sure which one is the best, or even if they're the correct approach at all. I would really appreciate the help.
  13. Never mind, I figured it out. I fixed it by putting a reference to the object tables in another table, and making changes whenever an object was deleted. Looks like I should get started on those tutorials!
  14. A while ago I asked about controlling classes in a vector from lua using LuaBind. I asked so I could create and control objects and assets as needed in the lua script. It turns out, after getting rid of luabind this became possible. Even though I got this working, I still need to make it practical to use. For example, I want to create an object like I would create a variable like this: player = entity:new() -- and then I can adjust an object like this player:move(37, 94) Here's how it works. When "new()" is called a new metatable is made and a value called "itr" is assigned a number that tells lua where the object is in the C++ vector. The metatable also contains functions that call C++ functions based on the itr value. So according to the above code, when I call player:move(), the move() function calls it's C++ equivalent like this: function entity:move(x, y) move(self.itr, x, y) end However, problems occur when I delete objects. When I delete an object, it erases the object in the vector and shifts the ones after it down. In lua however the "itr" value causes the instance to reference the wrong object. I would like to create objects with the method I showed above, but how should I keep track of the object positions? Also in my last thread, I said I would create a series of video tutorials if I got this working, so people would have less questions about using lua. I still plan on doing this, as well as a written version on the GDwiki.
  15. Still, nothing is working. Last night I tried to create a new lua table every time the constructor for my entity class was called. It didn't work, I got a BAD ACCESS runtime error. This morning I got an idea to create these update functions. The first argument would tell my engine the position in the vector, and then I would give it the information I wanted to update... That didn't work either. My game engine won't work without being able to access the data that's created, but every attempt to work around the errors fails. Has anyone made, or seen a working asset managing class that could properly exchange data with lua through luabind?