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

Evan2009

Members
  • Content count

    15
  • Joined

  • Last visited

Community Reputation

111 Neutral

About Evan2009

  • Rank
    Member
  1. Okay, I'm getting closer. What I currently have for getting the function I want is.. [DllImport("libgameswf.dll")] public static extern void get_movie_info( [MarshalAs(UnmanagedType.LPStr)]string filename, ref int ver, ref int width, ref int height, ref float framesPerSecond, ref int frameCount, ref int tagCount); But now I'm getting a DllNotFoundException for some reason. The libgameswf.dll is currently in the debug folder and the main folder but still no luck.
  2. Definitely nice knowing the format if I have to do it from scratch. But I'm hoping to find some library that I could use to save time. Right now, I'm still checking out GameSWF. It looks like it's exactly what I need. I'm trying to figure out how to import the functions I need from a C++ dll to C# and some of the parameters in the signatures C# doesn't get along with. Take this function signature for example, void get_movie_info( const char* filename,int* version, int* width, int* height,float* frames_per_second, int* frame_count, int* tag_count); //C++ version Trying to find the C# equivalent [DllImport("libgameswf.dll")] public static extern void get_movie_info(string filename, out int ver, out int width, out int height, out float framesPerSecond, out int frameCount, out int tagCount);
  3. GameSWF looks like it might be a good choice. But I need to figure out what to PInvoke so I can use it. During my research I also came across Fluix, which is XNA functionality of loading a swf file and playing it. However, XNA loads in assets from the ContentManager and I need to load it from a file.
  4. Hello everyone, An artist I am currently working with is having some trouble creating sprite sheets from .swf animations that she's recieving from another company. She is managing but I would like to help improve her work flow and create a tool. However, I am not familiar with .swf files and how to load them. I was hoping to find something I could use for a C# WinForm application. I did some research earlier and found "AxInterop.ShockwaveFlashObjects.dll" and "Interop.ShockwaveFlashObjects.dll". But I don't think I have the correct dll versions, it's always breaking on me, returning FileNotFoundException when I try using them. The idea of the tool is to load in a .swf from a local file that I feed it from a dialog. Parse the information within the animation and start populating the new sprite sheet with the frames. After that animation is loaded and on the sheet the user can load another local .swf file. Once the sprite sheet is complete, then the user can save out the .png(or whatever format necessary) and at the same time create a .json file of all the animation data held within that sprite sheet for easy loading in the game engine. There are several tools that accomplish creating a spritesheet from .swf, but I have yet to come across a tool that does this for multiple animations/characters. The tools I've run into only create a sprite sheet for a single animation/character. Overall, I just need to figure out how to load these .swf files so that I may get each frame's data. Any help would be greatly appreciated, thank you.
  5. Just found something that could have been exactly what I was looking for. It is a C# interpreter that would help me extend my classes the way I was planning to (http://eco148-88394.innterhost.net/paxscriptnet/). But it looks like I'll have to purchase it in order to use it. Does anyone have any experience with paxScript or know of anything similar?
  6. Hello everyone, Recently I have started a project of making tools for a game project of mine. One of those tools is a level/object editor. I want to be able to add a new script to extend the behaviors of an object that is created within my tool. What I'm thinking is there needs to be a template for that object class. In that object template it will call the script that was added and parse through it, adding behaviors to that current object. The scripts would be in C#, similar to Unity. I'm new to this so I was hoping someone might be able to point me in the right direction for this type of functionality. Such as, examples with similar functionality or some websites/books. A few moments ago I found an open source project called CodeWorker, which is a code parser and source code generator. I'm reading through it right now to make sure it's something I can use. My tools are WinForms with XNA. Thank you for the help. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  7. Good morning everyone, Working on a side project of mine using OpenGL and ran into a problem with rendering a texture on the model I'm trying to animate. The model always shows up as completely black. I've bind the texture I'm trying to use to a quad and it rendered without a problem. This means that I'm loading/binding the texture correctly. I have also disabled lighting, and checked the texture coordinates I'm using which look fine. At the very least if the texture coordinates were wrong I should see something other than black. I have also checked glGetError and I'm not getting any errors. If anyone could point me in the right direction that would be great. Thank you. InitGL() [code] CLight::Initialize(); CTextureManager::GetInstance()->Initialize(); establishProjectionMatrix(width, height); //glShadeModel(GL_SMOOTH); glClearColor(1.0f, 1.0f, 0.0f, 1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_PERSPECTIVE_CORRECTION_HINT); glEnableClientState( GL_VERTEX_ARRAY ); //glEnableClientState( GL_NORMAL_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); mainCLight = new CLight(LSPOT); mainCLight->setDiffuse(1.0f, 1.0f, 1.0f, 1.0f); mainCLight->setPosition(0, 50, 0); [/code] DrawScene() [code] //Setup Scene glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); establishProjectionMatrix(windowWidth, windowHeight); //TODO: remove GLuint err = glGetError(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_LIGHTING); glDisable(GL_BLEND); //Update the scene from mouse control glTranslatef(translate.x, translate.y, zoom); glRotatef(rotateX, 1.0f, 0.0f, 0.0f); glRotatef(rotateY, 0.0f, 1.0f, 0.0f); //Draw all lights in the scene for(int i = 0; i < (int)CLight::lights.size(); i++) { CLight* test = CLight::lights[i]; CLight::lights[i]->updateLight(); } //Draw grid with no texture glEnable(GL_BLEND); glDisable(GL_TEXTURE_2D); drawGrid(); //Draw the model we're animating glDisable(GL_BLEND); model.DrawModel(bRenderSkin, bRenderPoints, bRenderJoints); //Draw Controls glColor3f(1.0f, 1.0f, 1.0f); glDisable(GL_LIGHTING); setOrtho(windowWidth, windowHeight); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); displayFPS(); drawControls(); //Clean glFlush(); SDL_GL_SwapBuffers(); [/code] CModel Render() [code] //Draw Quad TODO: remove later glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texHandle); glBegin(GL_QUADS); glVertex3f(-1.0f, -1.0f, 0.0f); // The bottom left corner glTexCoord2f(0, 0); glVertex3f(-1.0f, 1.0f, 0.0f); // The top left corner glTexCoord2f(1, 0); glVertex3f(1.0f, 1.0f, 0.0f); // The top right corner glTexCoord2f(0, 1); glVertex3f(1.0f, -1.0f, 0.0f); // The bottom right corner glTexCoord2f(1, 1); glEnd( ); //Draw Model glVertexPointer( 3, GL_FLOAT, 0, &m_vMeshes[i]->GetVertices()[0] ); //NOTE: Remember the [0] at the end when using vectors //glNormalPointer(GL_FLOAT, 0, &m_vMeshes[i]->GetNormals()[0]); glTexCoordPointer(2, GL_FLOAT, 0, &m_vMeshes[i]->GetTexCoords()[0]); glDisable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texHandle); glDrawElements( GL_TRIANGLES, (GLsizei)m_vMeshes[i]->GetIndices().size(), GL_UNSIGNED_INT, &m_vMeshes[i]->GetIndices()[0] ); [/code]
  8. So I got it to work but I'm not quite sure what I did. I took a break and came back, compiled a couple times and it stopped giving me an access violation. I've tried disabling the states right after my glDrawElements several times already but I don't understand why it started working now. But I still can't see the texture on my model yet nor are the lights affecting it. Here is my end result. [code] for(int i = m_vMeshes.size() - 1; i >= 0; --i) { //Make sure texture is loaded, get handle std::string szTex; int texHandle; //If the mesh has a texture if(m_vMeshes[i]->m_vTextureNames.size() != 0) { szTex = "data/Textures/" + m_vMeshes[i]->m_vTextureNames[0]; texHandle = CTextureManager::GetInstance()->GetTextureHandle(szTex.c_str()); //Bind Texture if(texHandle != -1) { glEnable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texHandle); } } // Draw Model glPushMatrix(); glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_NORMAL_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glNormalPointer(GL_FLOAT, 0, &m_vMeshes[i]->GetNormals()[0]); glTexCoordPointer(2, GL_FLOAT, 0, &m_vMeshes[i]->GetTexCoords()[0]); glVertexPointer( 3, GL_FLOAT, 0, &m_vMeshes[i]->GetVertices()[0] ); //NOTE: Remember the [0] at the end when using vectors glEnable(GL_LIGHTING); glDrawElements( GL_TRIANGLES, (GLsizei)m_vMeshes[i]->GetIndices().size(), GL_UNSIGNED_INT, &m_vMeshes[i]->GetIndices()[0] ); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisable(GL_LIGHTING); glPopMatrix(); } [/code]
  9. I am using 2D coordinates and right now I'm looking at what I have stored within my mesh and I see 2185 float[3] so 6555 floats and the same for my normals. My tex coords has 4370(2185*2) but my Indices is at 8385. Right now I'm looking through the code I made for the exporter. I'm loading the correct size according to the exported model's text file. It's the same exporter I used in a previous project of mine which worked but we were using a different method of rendering. Edit: If my pointer was overflowing or invalid then wouldn't it give me an access violation the first time the code runs?
  10. Yes, I have and it works if the enable states are in the Init(). However, if those states are only enabled within Init() and disabled every time during my draw I'll never see my model. So something odd is happening in my render I just can't put my finger on it. Edit: Here is the other render code. [code] //Setup Scene glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); establishProjectionMatrix(windowWidth, windowHeight); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_LIGHTING); glDisable(GL_BLEND); //Update the scene from mouse control glTranslatef(0.0f, 0.0f, zoom); glRotatef(rotateX, 1.0f, 0.0f, 0.0f); glRotatef(rotateY, 0.0f, 1.0f, 0.0f); //Draw all lights in the scene for(int i = 0; i < (int)CLight::lights.size(); i++) { CLight* test = CLight::lights[i]; CLight::lights[i]->updateLight(); } //Draw the model we're animating model.DrawModel(); //Draw grid with no texture glEnable(GL_BLEND); glDisable(GL_TEXTURE_2D); drawGrid(); //Draw Controls glColor3f(1.0f, 1.0f, 1.0f); glDisable(GL_LIGHTING); setOrtho(windowWidth, windowHeight); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); displayFPS(); drawControls(); //Clean glFlush(); SDL_GL_SwapBuffers(); [/code] Edit2: If I enable and disable the vertex and normal array state around glDrawElements no access violation. If I do the same thing with tex coord array then I will hit the access violation.
  11. Good morning everyone, Recently I've been working on a project using OpenGL and right now I've been trying to draw a model using arrays. I've looked around for postings with a similar problem to mine but nothing I've found has seemed to work or doesn't apply to my situation. I keep getting an Access Violation when I hit glDrawElements within my CModel class's draw(). The first time the draw code runs it doesn't hit that access violation so I'm wondering if I forgot to enable or disable something after that code runs. If anyone can shed some light on this it would help me a lot. Thank you. In my Init() I use [code] glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState( GL_NORMAL_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); [/code] Here is the draw code for CModel [code] for(int i = m_vMeshes.size() - 1; i >= 0; --i) { //Make sure texture is loaded, get handle std::string szTex; int texHandle; //If the mesh has a texture if(m_vMeshes[i]->m_vTextureNames.size() != 0) { szTex = "data/Textures/" + m_vMeshes[i]->m_vTextureNames[0]; texHandle = CTextureManager::GetInstance()->GetTextureHandle(szTex.c_str()); //TODO: Move elsewhere //Bind Texture if(texHandle != -1) { glEnable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texHandle); } } glPushMatrix(); //TODO: Add Translate code here based on input glNormalPointer(GL_FLOAT, 0, &m_vMeshes[i]->GetNormals()[0]); glTexCoordPointer(2, GL_FLOAT, 0, &m_vMeshes[i]->GetTexCoords()[0]); glVertexPointer( 3, GL_FLOAT, 0, &m_vMeshes[i]->GetVertices()[0] ); glDrawElements( GL_TRIANGLES, (GLsizei)m_vMeshes[i]->GetIndices().size(), GL_UNSIGNED_INT, &m_vMeshes[i]->GetIndices()[0] ); glPopMatrix(); //Draw Points glBegin(GL_POINTS); for(unsigned int j = 0; j < m_vMeshes[i]->GetVertices().size(); j++) { glVertex3f(m_vMeshes[i]->GetVertices()[j].v[0], m_vMeshes[i]->GetVertices()[j].v[1], m_vMeshes[i]->GetVertices()[j].v[2]); } glEnd(); } [/code]
  12. Recently started making an image going over ApochPiQ's implementation. If I'm wrong or something looks off please let me know. Learned a lot in the last few posts thank you for your input. [media]http://i1211.photobucket.com/albums/cc429/EvanVore/memmanpool.png[/media]
  13. Awesome, I'm looking forward to it.
  14. [font="Arial"][size="2"]Yea I'm sorry I didn't make that clear. I guess I was too caught up in trying to explain the problem. It was an interview question that was sent to me last week actually and I have already implemented my version and submitted it for review. Before I go into what I did I would like to make it clear that this was my first time for something like this. I simply want to expand my knowledge over a subject I'm not very experienced with. My Implementation: The follow are quotes that I wrote and sent to the interviewer explaining my implementation. Initialize: I first initialize all the data in the memory pool to -2 (which I realize now wasn't a good idea I'll explain later). That gives me something I can recognize unused data. Allocation: "For allocation, I begin at [0] of the memory pool and begin checking forconsecutive bytes that are available. Ifthe consecutive bytes equals the size passed in, then the data chunk willfit. However, this part is where Istarted having some trouble figuring out how to fit the data I wanted into twoor three bytes. If the size was 255 orless then it was possible to fit that into a single byte, but anymore than thatthere would need to be two. The signedbit would also give me trouble using the 2’s compliment, so I had to make sureto take care of that later on in deallocation. I also ran into the problem of how would the system know if it neededone or two bytes for the size when I’m deallocating. I decided on using one extra byte to hold thenumber of necessary bytes for the size. Although, I only needed 2 bytes at the maximum to hold the size, all Ineeded were 2 bits to tell me how many bytes were required. That is where my implementation falls shortat the moment. This means one of thebytes I used to tell the system how much data was allocated for that data chunkwasn’t using all of its bits. Perhaps ifI had more time I would think of a way to mask and shift what I needed that mayresult in saving a byte per allocation. If the size sent in did take two bytes then I needed to mask and zeroout the sides for both the higher and lower ends depending on what byte I wasworking with. The higher end was theonly one that needed to be right shifted by 8 making sure it would fit in thespecified location." Deallocation: "During the deallocation process I would receive the pointer from thestarting point of the data and not the header. The header I would read backwards from the pointer passed in, firstreading the number of bytes for the size, then reading the size itself. I believed this would help to keep itsimplified for the programmer using the system rather than adding 2 or 3 bytesin their head every time they allocated data. During the deallocation I needed to deal with the signed bit that wassaved out. For instance, 255 would besaved out as -1 because they can both equal “1111 1111” for a single byte. To fix this I simply added 256 if the datawas saved out as a negative, because we couldn’t have a negative size in thisinstance. For the higher end on thedeallocation side I also had to make sure to shift it back left by 8, restoringwhat it was previously then adding the lower end." Side note: I only needed to be able to allocate up to 16k. Problems I found afterwards: *If the user tries to allocate 254 bytes that will be saved into the pool as -2. Yea I laughed a little when I found that one. Again I haven't done memory management like this before. But I am very interested in what everyone else thinks, if they can improve this idea or have ideas of their own.[/size][/font] [font="Arial"][size="2"]Code of the allocate function. (Sorry about the formatting I'm trying to fix it.)[/size][/font] [font="Arial"][size="2"][code] [/size] void* allocate(int aSize) { // TODO: IMPLEMENT ME //Safety check if(aSize <= 0 || aSize > MM_POOL_SIZE) { onIllegalOperation("%d is not a valid allocation size.", aSize); return ((void*) 0); } int chunkPos = 0; //Starting point of the current memory chunk. int curByteNum = 0; //Current number of bytes that have been checked. int sizeofType = sizeof(char); //Loop through memory pool. for(int curIndex = 0; curIndex < MM_POOL_SIZE; curIndex++) //Note: Iterate through using the worst case 'any size' scenario. { //Check to see the current number of bytes checked is the correct size. if(curByteNum == aSize) { int poolIndex = sizeofType*chunkPos; //If the size sent in fits in one or two bytes. if(aSize <= 255) { //Set the header chars. memset(&MM_pool[poolIndex+1], 1, 1); //How many chars for size. memset(&MM_pool[poolIndex], aSize, 1); //Holds the size. //Set the size in the appropriate location. memset(&MM_pool[poolIndex+2], 0, aSize); return &MM_pool[poolIndex+2]; } else { //Find the bits for the size of the allocation. int firstInt = (aSize | 32512)^32512; //32512 = 0111 1111 = mask for the high end int secondInt = ((aSize | 255)^255) >> 8; //255 = 1111 1111 = mask for the low end //Set the header chars memset(&MM_pool[poolIndex+2], 2, 1); //How many chars for size. memset(&MM_pool[poolIndex+1], firstInt, 1); //First 8 bits of the size. memset(&MM_pool[poolIndex], secondInt, 1); //Second 8 bits of the size. Note: Remember to shift it back left later on. //Set the size in the appropriate location. memset(&MM_pool[poolIndex+3], 0, aSize); return &MM_pool[poolIndex+3]; } } //Memory is not free or will not fit. Start searching in the next chunk. if(MM_pool[curIndex] != -2) { curByteNum = 0; chunkPos = curIndex+1; } else { //Memory is free so far, keep iterating. curByteNum++; } } //Checked through the entire memory pool and no memory was available. onOutOfMemory(); return ((void*) 0); } [/code][font="Arial"] [/font][/font]
  15. [font=verdana, geneva, lucida,]Hello everyone, Recently I have been asked to write up a memory manager, something I've never done. They gave me the header file that had no virtual functions and I couldn't make any changes to. The source file had a const int called POOLSIZE and a char array called pool which was the size of POOLSIZE. I couldn't add anymore static or global variables and any information I needed to save had to be within the pool. The main they sent allocated size of a long and 255 bytes for a string. What bothers me is they also said the numbers should be close to 65530 before allocating memory and 65483 after the memory was allocated. That's 47 byte difference for 259 bytes that was actually requested. POOLSIZE is also set to equal 65536 within the source so the first 6 bytes were used for something. Am I missing something here or is there some sort of trick I'm unaware of? Maybe, I'm just reading to much into this. Anyways, if you have any ideas on the subject I'm very interested in what everyone here thinks. And if anyone could point me in the right direction to solve this problem that would be great. Thank you. P.S: Allocations are variable size and couldn't use functions that dynamically allocated memory during the program's execution.[/font]