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


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About luke2

  • Rank
  1. Heyo, I have a quick question about getting a camera moving the way I want. So, what I want my camera to do is to be able to move on x,y,z axis (glTranslatef) and rotate on horizontal and vertical axis (y & x axis respectively). I accomplish this by: glRotatef(horizontalRotationInDegrees, 0.0f, 1.0f, 0.0f); glRotatef(verticalRotationInDegrees, 1.0f, 0.0f, 0.0f); glTranslatef(translationVector.x, translationVector.y, translationVector.z); Before I send a frame's render data to GL. However, there is a slight side effect to how I'm doing it, rotation works as expected, rotating around the Camera's origin. But when I do rotations then translations, the translations are still on the cardinal axis as opposed to moving relative to the camera. If I reverse rotations and translation, then the translation is relative to the camera but rotation is from the cardinal origin. class Camera { public: void translate(); void addHorizontalRotation(float rotationInDegrees); void addVerticalRotation(float rotationInDegrees); void addTranslation(Vector3f translation); private: float horizontalRotationInDegrees; float verticalRotationInDegrees; Vector3f translationVector; }; My camera class isn't very complex, all it really does is holds a few values and calls the rotations/translation in the translate() method.
  2. wow, sure which I heard of s&p before now... With a little culling, I think that will actually be suitable for my needs! Thanks
  3. So, I've been thinking about a data structure to hold all the units in my game. The overriding prerogative is O(1) checking to see if an enemy unit is right next to a particular unit. The first idea I had was a sparse-array, which works great except for diagonals/anything other than straight ahead/behind/left/right. The second was an oct-tree like those used in FPS's except that isn't really O(1), more like O(nlog(n)). The third idea I had was cutting up the battlefield into logical NxN blocks. A unit marks it's particular block as occupied, and keeps track of which block it is currently in. Checking if a neighboring (or any other block) is occupied is O(1)... but for large maps this can be rather memory intensive (hence sparse array idea) The fourth idea is number 3. Except instead of using a 2d array for the map, use a dictionary keyed to logical coordinates, there being no value for empty blocks, thus saving a ton of memory. Any suggestions? I'll be going with number 4 unless someone has a better idea.
  4. Quote:Original post by Geometrian Step 2: Better solution: don't transform your vertices in hardware; that's what a vertex shader is for. Use a static VBO, but move the vertices according to a function or a texture in the shader. -G Could you explain what you mean by using a vertex shader to transform vertices? If these sprites are moving around, independently of one another, how can a texture define that?
  5. Righto... So, I: 1. Fill up buffer 2. Link it/Load it to GL Per frame: 3. Modify the data as appropriate 4. Send changes to GL My only other question is that this VBO tends to centralize data, would this mean that I should write my sprite code procedurally? I'm not sure how I could elegantly do it OOP (unless I made prodigious use of static members)
  6. But if all my quads are moving constantly, won't this mean I'll be pumping/overwriting my VBO every frame or so?
  7. I've used OpenGL before, but only in immediate mode. It was a fairly intuitive: glBegin(..) //Transformations.. //Draw textured quad glEnd() For each sprite. But this doesn't scale too well, especially with all the function overhead. Enter OpenGL 3.0 which apparently does away with immediate mode in favor of Vertex Buffer Objects. As I understand VBO's: You define an array of data, tell OpenGL how to interpret it (interweaved etc), fetch a VBO handle, bind that handle to the array/load it in. And it magically draws the geometry very quickly. But what I don't quite understand: How do I do multiple, separate quads in one VBO, which are all changing position/orientation often. And I'm talking 30k+ quads here. I would think modern hardware can handle 100k quads easily enough, I'm just not sure how to go about drawing them efficiently.
  8. YES ENDORPHINE Thanks a bunch, I'm downloading the LE version right now...
  9. No, that wasn't it... (Natural Selection is just what I keep thinking of, probably had something to do with the fact that they used some sort of genetic algorithm for their animatinos)
  10. Hello, A few years ago I was doing some work for animation, and accidentally stumbled upon a program that was really cool/usefull. Basically, you defined a few things (people, objects) and what they were supposed to do (punch that other guy with your arm/shoot him) and it would generate some really good animations. One of the examples that it came with (which really impressed me) was 2 people being chased by this big monster (gorrila type thing). It grabbed them both and killed them with a very realistic animation, I was able to remake that in about half an hour. Fast forward a few years, and now I can't find it. I'm think it's name was Natural Selection, but google didn't help (and the forum sticky didn't seem to have it). I only ever got a trial version. Does anyone know of the software I'm talking about?
  11. Thanks eq, but I've already figured out the problem: It was all in the way that I formated my data, if I send just 'dir' to the console, it waits for the enter key before doing anything. All I needed to do was add '\n' to simulate an enter key. After that, just a few server side bugs, and I have a working example! If any1 would like to see the working copy of my program, just ask and I can send it to you ;) And btw, eq, you mentioned sites about windows system programming; would you mind giving me some linkys to a few? Thanks for your help all!
  12. Surely my programing has not surpassed all others' in complexity?
  13. Although that might be enough to fib a cmd console to an 'average' user, I don't think that will be enough, especially if the user tries to do some of the more complex command line stuff that aren't actually programs. Not only that, but the method you've described would not allow interactive applications - only ones that take input as a parameter. And that is essentially my program, a remote, interactive command line. (Please note that I am having NO issues with the remote part, only the interactive part of my program isn't working...)
  14. Hello all, I've been trying to redirect the I/O of cmd.exe so that my app can send cmd input, and take cmd's output. My main resource for this has been this msdn article [url]http://msdn2.microsoft.com/en-us/library/ms682499.aspx[/url] Creating a Child Process with Redirected Input and Output (Windows) I've been focusing on using anonymous pipes, which seem to be suited to my needs, but there is a problem... It works alright the first time I input something, I get the console's opening screen (Microsoft Windows...Copyright...current_directory>[cursor here]). When I type in any command, dir for example, I then get a newline with just "More?" and no output from the previous command. After the "More?" line, I don't get any more output from the pipe. As best I can tell, the code in the prior article, which mine is based off of, is meant to only make one read/write pass with the child process- as opposed to doing all the reading/writing that I need to. The suspect code segments are my Read and Write pipe functions: ReadFromPipe DWORD ReadFromPipe( char* buff, DWORD readLength ) { DWORD dwRead; if ( hChildStdoutWr != NULL ) { CloseHandle(hChildStdoutWr); hChildStdoutWr = NULL; } // Read output from the child process, and write to parent's STDOUT. memset( buff, -1, BUFSIZE ); DWORD x = ReadFile( hChildStdoutRd, buff, readLength, &dwRead, NULL); return x; } WriteToPipe DWORD WriteToPipe( LPCVOID data, DWORD length ) { DWORD writtenBytes; BOOL b = WriteFile(hChildStdinWr, data, length, &writtenBytes, NULL); if ( hChildStdinWr != NULL ) { CloseHandle(hChildStdinWr); hChildStdinWr = NULL; } return writtenBytes; } Now, you see those if statements, which close my StdinWr and StdoutWr handles? I don't think I should have those there, but without them, I don't even get the "More?" line... Here is the main loop of my program: //Inside of void ClientProc( const char* ip ) while( true ) //ClientDisConn should end this program. { PollEvents( host ); PeekNamedPipe( hChildStdoutRd, data, BUFSIZE, &bytesRead, &availBytes, NULL ); if( bytesRead > 0 ) { ReadFromPipe( data, (DWORD)BUFSIZE ); int length = 0; for( int i = 0; i < BUFSIZE; i ++ ) if( data[i] > -1 ) length++; else break; printf( "Message sent\n" ); PACKET* p = CreatePacket( data , (UINT)length ); SendPacket( p, peer ); } } And incase the problem isn't in there, here is my entire program: #include "ServerAndClientProcs.h" #include "NetWrapper.h" #include "enet.h" #include &lt;windows.h&gt; #include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;iostream&gt; #include &lt;list&gt; HANDLE hChildStdinRd, hChildStdinWr, hChildStdoutRd, hChildStdoutWr, hInputFile, hStdout; std::list&lt;PEER*&gt; peerList; bool CreateControlledCMD(); bool CreateChildProcess(); DWORD WriteToPipe( LPCVOID data, DWORD length ); DWORD ReadFromPipe( char* buff, DWORD readLength ); void ServerConn( EVENT &e ); void ServerMsgRecv( EVENT &e ); void ServerDisConn( EVENT &e ); void ClientConn( EVENT &e ); void ClientMsgRecv( EVENT &e ); void ClientDisConn( EVENT &e ); void ServerProc() { ADDRESS addr; HOST host; addr.host = ENET_HOST_ANY; addr.port = 1029; host = *CreateHost( addr, 2 ); NetEvent nConn = ServerConn; NetEvent nMsg = ServerMsgRecv; NetEvent nDisConn = ServerDisConn; RegisterCallBacks( &nConn, &nMsg, &nDisConn ); std::string input; std::string terminate = "END"; while( input != terminate ) { PollEvents( &host ); if( _kbhit() ) //Asynchronous console I/O -- almost an oxymoron.. { char in = _getch(); std::cout &lt;&lt; in; if( in == 0xD ) //0xD == ENTER { std::cout &lt;&lt; std::endl; PACKET* p; p = CreatePacket( (char*)input.c_str() , (UINT)input.length() + 1 ); printf( "Packets sent\n" ); for( std::list&lt;PEER*&gt;::iterator itor = peerList.begin(); itor != peerList.end(); ++itor ) SendPacket( p, (*itor), 0 ); } else input += in; } } } void ServerConn( ENetEvent &e ) { printf( "Client connected\n" ); peerList.push_back( e.peer ); } void ServerMsgRecv( ENetEvent &e ) { for( unsigned int i = 0; i &lt; e.packet-&gt;dataLength; i++ ) std::cout &lt;&lt; e.packet-&gt;data[i]; } void ServerDisConn( ENetEvent &e ) { printf( "Client disconnected\n" ); peerList.remove( e.peer ); } void ClientProc( const char* ip ) { ADDRESS addr; char data[BUFSIZE]; DWORD bytesRead, availBytes; RtlZeroMemory( data, BUFSIZE ); HOST* host; PEER* peer; addr.port = 1029; host = CreateClient( ); peer = Connect( host, addr, ip ); if( peer != NULL ) CreateControlledCMD(); NetEvent nConn = ClientConn; NetEvent nMsg = ClientMsgRecv; NetEvent nDisConn = ClientDisConn; RegisterCallBacks( &nConn, &nMsg, &nDisConn ); while( true ) //ClientDisConn should end this program. { PollEvents( host ); PeekNamedPipe( hChildStdoutRd, data, BUFSIZE, &bytesRead, &availBytes, NULL ); if( bytesRead &gt; 0 ) { ReadFromPipe( data, (DWORD)BUFSIZE ); int length = 0; for( int i = 0; i &lt; BUFSIZE; i ++ ) if( data[i] &gt; -1 ) length++; else break; printf( "Message sent\n" ); PACKET* p = CreatePacket( data , (UINT)length ); SendPacket( p, peer ); } } } void ClientConn( EVENT &e ) { } void ClientMsgRecv( ENetEvent &e ) { printf( "Message received\n" ); WriteToPipe( (LPCVOID)e.packet-&gt;data, (DWORD)e.packet-&gt;dataLength ); } void ClientDisConn( ENetEvent &e ) { ShutdownNet(); ExitProcess(1); } bool CreateControlledCMD() { SECURITY_ATTRIBUTES saAttr; BOOL fSuccess; // Set the bInheritHandle flag so pipe handles are inherited. saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; // Get the handle to the current STDOUT. hStdout = GetStdHandle(STD_OUTPUT_HANDLE); // Create a pipe for the child process's STDOUT. if (! CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) return false; // Ensure that the read handle to the child process's pipe for STDOUT is not inherited. SetHandleInformation( hChildStdoutRd, HANDLE_FLAG_INHERIT, 0); // Create a pipe for the child process's STDIN. if (! CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) return false; // Ensure that the write handle to the child process's pipe for STDIN is not inherited. SetHandleInformation( hChildStdinWr, HANDLE_FLAG_INHERIT, 0); // Now create the child process. fSuccess = CreateChildProcess(); if (! fSuccess) return false; return true; } bool CreateChildProcess() { TCHAR szCmdline[]=TEXT("cmd.exe"); PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; bool bFuncRetn = FALSE; // Set up members of the PROCESS_INFORMATION structure. ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) ); // Set up members of the STARTUPINFO structure. ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.hStdError = hChildStdoutWr; siStartInfo.hStdOutput = hChildStdoutWr; siStartInfo.hStdInput = hChildStdinRd; siStartInfo.dwFlags |= STARTF_USESTDHANDLES; // Create the child process. bFuncRetn = (bool)CreateProcess(NULL, szCmdline, // command line NULL, // process security attributes NULL, // primary thread security attributes TRUE, // handles are inherited 0, // creation flags NULL, // use parent's environment NULL, // use parent's current directory &siStartInfo, // STARTUPINFO pointer &piProcInfo); // receives PROCESS_INFORMATION if (bFuncRetn == 0) return false; else { CloseHandle(piProcInfo.hProcess); CloseHandle(piProcInfo.hThread); return bFuncRetn; } } DWORD WriteToPipe( LPCVOID data, DWORD length ) { DWORD writtenBytes; BOOL b = WriteFile(hChildStdinWr, data, length, &writtenBytes, NULL); if ( hChildStdinWr != NULL ) { CloseHandle(hChildStdinWr); hChildStdinWr = NULL; } return writtenBytes; } DWORD ReadFromPipe( char* buff, DWORD readLength ) { DWORD dwRead; if ( hChildStdoutWr != NULL ) { CloseHandle(hChildStdoutWr); hChildStdoutWr = NULL; } // Read output from the child process, and write to parent's STDOUT. memset( buff, -1, BUFSIZE ); DWORD x = ReadFile( hChildStdoutRd, buff, readLength, &dwRead, NULL); return x; } VOID ErrorExit (LPSTR lpszMessage) { fprintf(stderr, "%s\n", lpszMessage); ExitProcess(0); } Btw, this program is actually a networked one, eg I have a server, which the client connect too, and the server acts like a remote command line.
  15. In Iodine, ITasks are not threads, although with some slight modifications in Messenger... and maybe a bit of ITask clean up I guess I could make them threads... But right now, Kernel has a list of ITasks, and it basically: foreach( ITask task in tasks ) task.update( delta ); for each frame. tasks include things like the RenderTask, CollisionTask, and SceneTask. [edit] It occurs to me, could my engine benefit if I made the engine tasks (rendering, collisions, etc) all part of one thread and put the game task on one other thread? I can do this easily since they only communicate via messages... [Edited by - luke2 on November 27, 2007 9:18:39 AM]