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

popcorn

Members
  • Content count

    419
  • Joined

  • Last visited

Community Reputation

151 Neutral

About popcorn

  • Rank
    GDNet+
  1. From the album test

  2. Hi, I've used guichan before and managed to get it working in Visual C++ Express 2008. I've even managed to use it to create a very simple editor for a 2d scrolling shooter. Since you have all the source code for guichan it's possible for you to simply include all the files with your project and it'll work fine but obviously this is not a great solution. Anyway what I did was open up a new win32 console project and checked the static library box. I then included all the relevant files from guichan and created a static library. Alternatively you could create a dll but I personally felt a static library would do the job fine. I found this useful static library help. After I did this I just created paths for where the library was in VC++ by going to: tools->options->projects and solutions->include to add in the path for the header files and then: tools->options->projects and solutions->library files to add in the path for the created library Also for projects using the library remember to let the linker know you have additional dependencies by doing: project->properties->linker and then add the name of your library in the additional dependencies section. In my case I added GuiChanLib.lib.
  3. Unity

    Quote:Original post by DragonicZero I'm glad I could help. Thanks for the suggestion, actually I am now using the technique I talked about on my earlier post for regulating my framerate (the one where I check if a frame took the time it should, if it was faster, wait for the difference between the time it should have taken and the time it took, instead of skipping the remaining frames, which is what was causing the jumpiness on my animation in the first place, so now I get a smooth animation while at 30 or 60 fps. I noticed your game a little jumpy too, you could get your fps more constant by doing what I did. But I finally decided not to cap my framerate and just use "SDL_Delay(1);" because with that the program uses around 7% CPU, I tried "SDL_Delay(0); but it used around 13% CPU, that's why I stayed with 1. EDIT: I fixed something on the code above because it gave almost the same effect as the one on the first code because there wasn't enough precision, so I changed the const int on the first lines to const float, sorry if that caused any confusion. OK DragonicZero I'll bear your advice in mind but at the moment I feel the way the fps are calculated is fine, I personally don't feel the game is a little jumpy. The method in lazy foos tutorials does seem to take more CPU time than your suggestion though since I notice that it takes about 24 - 26% of CPU time.
  4. rafehi when you draw your grid are you drawing a grid image on top of your map, if you are then this is probably the reason why it is so slow, I think it would be easier if you just drew lines. So if your mapEditor picture is 640 * 640 say and your tiles are 32 * 32 then you would only have to draw 20 lines across the way and 20 lines down the way. That would be your grid. When I drew a grid for my editor(done in C++ with SDL and guichan) this is what I did. I'm using tiles of 64 * 64 w = width, q = height, 640 = width of map, 1280 = height of map. for(int i = 0; i < mapHeight; i++) { graphics->drawLine(0, w, 640, w); w += 64; } for(int j = 0; j < mapWidth; j++) { graphics->drawLine(q, 0, q, 1280); q += 64; }
  5. If thats the case then what nhatkthanh posted should work, that is putting the bmp file in the project folder where the code is, this is what I do and it works all the time so I'm puzzled why it doesn't work for you.
  6. Unity

    Thanks DragonicZero, it was your second option that was correct, I started the timer before entering the game loop, I've changed the code so that the timer starts when 's' is pressed and it calculates at 29 - 30fps straight away. I can understand about not wanting to open programs from unknown sources so thanks for explaining and for checking the program. About your problem, not that I'm much help but maybe you could try running at a lower fps like 30/40fps instead of 60fps and see if it runs better?
  7. Unity

    Hi, I don't want to hijack the thread but I tried this too and was also wondering whether I had implemented the code correctly too. It is exactly the same code that DragonicZero has posted up. DragonicZero - When you start the game does the framerate start at zero and then gradually builds up to the framerate you set? I've set the framerate to 30fps and the framerate builds up slowly from zero to about 28- 29 fps I think. Download the game and have a look, is it the same behaviour as your game? Game here Mines is an AMD opteron 180 @ 2.4Ghz, 2GB of RAM with a Geforce 6800GT GPU, WinXP SP3.
  8. Quote:Original post by jyk So I guess my main question would be, why, during development, do you need to run your application from the debug/release/whatever folder? Why can't you just run it from the IDE? I don't usually run the program from the debug/release folder during development but whenever I create a project I always put the required dlls in those folders because that was my understanding of the lazy foo article I posted up. It's now just habit to do so but after this discussion I suppose I don't really need to do this. It sometimes comes in handy when I'm browsing through my various projects and want to just run the program to see what it is instead of loading up the project in the IDE but then again maybe I need to come up with better names for projects..
  9. Quote:Original post by jyk I don't put the dll's in my release and debug folders, and the executables run just fine. Are you running the app from the IDE? Or using some other method? How does that happen, if I don't put the dll's in the release and debug folders, and try to run the executable it complains that it can't find SDL.dll etc. Yes I am running the app from the IDE, but once I build my project and the executable is produced in the release folder, if I run the exe from this folder I need to put the dll's in this folder as well as bitmaps etc. Quote: I'm a little unsure about the advice to put the dll's in the same directory as the executable. Most non-trivial applications have multiple builds (debug, release, etc.), and this would mean putting copies of any libraries and data needed in the executable folders for all of your builds. This in turn would mean maintaining all of these sets of files separately, which I'm really pretty sure is not the way to do it; content development should be made as easy and fluid as possible, and having to duplicate each change in multiple places would add a lot of unnecessary difficulty. Yes it is kinda difficult whenever I create a new project but I don't know any other way to do this. Quote: By default, VC++ (2008 at least) sets up projects so that the current working directory is the directory that contains the project file. If you place all of your libraries and data files in this directory, you shouldn't have any problem. (Of course if you want, you can specify a different directory as the working directory via the IDE.) The way it is setup on my machine is: MyDocuments->VisualStudio2008->Projects->SolutionFolder. The SolutionFolder contains: Solution file, Release/Debug folders(I put my dll's and bitmaps etc in these folders), project folder. The project folder contains: The project file, all the code, other resources(bitmaps etc), Release/Debug(this contains the object files for the code as well as the buildlog) Quote: For deployment, yes, the files should go in the same directory as the executable. Again though, I don't think this is (or should be) necessarily the case during development. (If I'm wrong about any of this, I imagine someone will come along and offer a correction.) What do you mean by deployment, if you mean release your program with a proper installer etc then that's not possible with VC++ 2008 express, deployment for me just means the executable in the release folder.
  10. Quote:Original post by jyk Quote:Original post by popcorn I use VC++ 2008 express and whenever I create an SDL project I put all the files I need in the folder where my code is as well as putting those files(dll's, bitmaps etc) in the debug and release folders.Unless I'm really missing something here, you shouldn't have to duplicate any of those files (and doing so just makes project maintenance and content development harder). Maybe I *am* missing something though - may I ask why you duplicate all of your files in the debug and release folders? I just followed the instructions on Lazy Foo's site: Quote: Now take the SDL.dll from the archive (it should be inside the lib subfolder) and extract it. You're going to put this in the same directory as your project/exe when you compile it. Alternatively, you can copy SDL.dll to C:\WINDOWS\SYSTEM32 so your SDL app will find SDL.dll even if it's not in the same directory. If you're using a 64bit version of Windows, you'll want to put the dll in C:\Windows\SysWOW64. The problem with this method is if you have multiple SDL apps that use different versions of SDL, you'll have version conflicts. If you have SDL 1.2.8 in SYSTEM32 when the app uses 1.2.13 you're going to run into problems. Generally you want to have your SDL.dll in the same directory as your executable developing and you'll always want to have SDL.dll in the same directory as the exe when distributing your app. If you don't put the dll's(SDL.dll etc) in your release or debug folder and you try to run the executable then it doesn't work.
  11. mrhodes, it's hard to give advice without seeing examples of the work you have done so far. When I make programs in SDL I usually just use the same game loop code all the time, that is: #include "SDL.h" #include "SDL_ttf.h" const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; const int SCREEN_BPP = 32; int main( int argc, char* args[] ) { //Start SDL SDL_Init(SDL_INIT_EVERYTHING); SDL_Surface *screen = NULL; screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE); SDL_WM_SetCaption("SDL Program", NULL); SDL_Event event; bool quit = false; while(!quit) { while(SDL_PollEvent(&event)) { if(event.type == SDL_QUIT) { quit = true; } } SDL_Flip(screen); } //Quit SDL SDL_Quit(); return 0; } This is pretty much the game loop and is not something I ever mess with, I then build the classes I need for my game like enemy, player, utilities etc and put all that into a game class. Incidentally I've wanted to make an 2D RPG like final fantasy too but it is a lot of work.
  12. I use VC++ 2008 express and whenever I create an SDL project I put all the files I need in the folder where my code is as well as putting those files(dll's, bitmaps etc) in the debug and release folders.
  13. Well I managed to do this: Can't say it was my own work though, this article is where all the code really came from so credit to the people involved. Rotating a bitmap with an angle of any value. The code examples are written for windows but I managed to convert it to SDL. Heres my code in case anyone is interested: #include "SDL.h" #include "SDL_ttf.h" #include <iostream> #include <cmath> using namespace std; #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; const int SCREEN_BPP = 32; Uint32 getpixel(SDL_Surface *surface, int x, int y) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch(bpp) { case 1: return *p; case 2: return *(Uint16 *)p; case 3: if(SDL_BYTEORDER == SDL_BIG_ENDIAN) return p[0] << 16 | p[1] << 8 | p[2]; else return p[0] | p[1] << 8 | p[2] << 16; case 4: return *(Uint32 *)p; default: return 0; /* shouldn't happen, but avoids warnings */ } } void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to set */ Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch(bpp) { case 1: *p = pixel; break; case 2: *(Uint16 *)p = pixel; break; case 3: if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { p[0] = (pixel >> 16) & 0xff; p[1] = (pixel >> 8) & 0xff; p[2] = pixel & 0xff; } else { p[0] = pixel & 0xff; p[1] = (pixel >> 8) & 0xff; p[2] = (pixel >> 16) & 0xff; } break; case 4: *(Uint32 *)p = pixel; break; } } SDL_Surface *createSurface(int width, int height) { SDL_Surface *surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0, 0, 0, 0); return surface; } int main( int argc, char* args[] ) { //Start SDL SDL_Init(SDL_INIT_EVERYTHING); SDL_Surface *screen = NULL; screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE); SDL_WM_SetCaption("SDL Rotation Test", NULL); SDL_Event event; bool quit = false; SDL_Surface *surface = createSurface(60, 50); SDL_Surface *temp = NULL; temp = SDL_LoadBMP("disasteroids2_master.bmp"); SDL_Rect userClip; userClip.x = 448; userClip.y = 295; userClip.w = 60; userClip.h = 50; SDL_BlitSurface(temp, &userClip, surface, NULL); SDL_FillRect(screen, NULL, SDL_MapRGB(SDL_GetVideoSurface()->format, 75, 150, 255)); int angle = 45; float radians=(2*3.1416*angle)/360; float cosine=(float)cos(radians); float sine=(float)sin(radians); float Point1x=(-surface->h*sine); float Point1y=(surface->h*cosine); float Point2x=(surface->w*cosine-surface->h*sine); float Point2y=(surface->h*cosine+surface->w*sine); float Point3x=(surface->w*cosine); float Point3y=(surface->w*sine); float minx=min(0,min(Point1x,min(Point2x,Point3x))); float miny=min(0,min(Point1y,min(Point2y,Point3y))); float maxx=max(Point1x,max(Point2x,Point3x)); float maxy=max(Point1y,max(Point2y,Point3y)); int DestBitmapWidth=(int)ceil(fabs(maxx)-minx); int DestBitmapHeight=(int)ceil(fabs(maxy)-miny); SDL_Surface *rotate = createSurface(DestBitmapWidth, DestBitmapHeight); cout << "Angle: " << angle << endl; cout << "Surface width: " << rotate->w << endl; cout << "Surface height: " << rotate->h << endl; Uint32 pixel; for(int x=0;x<DestBitmapWidth;x++) { for(int y=0;y<DestBitmapHeight;y++) { int SrcBitmapx=(int)((x+minx)*cosine+(y+miny)*sine); int SrcBitmapy=(int)((y+miny)*cosine-(x+minx)*sine); if(SrcBitmapx >= 0 && SrcBitmapx < surface->w && SrcBitmapy >= 0 && SrcBitmapy < surface->h) { pixel = getpixel(surface, SrcBitmapx, SrcBitmapy); putpixel(rotate, x, y, pixel); } } } SDL_BlitSurface(rotate, NULL, screen, NULL); SDL_Flip(screen); while(!quit) { while(SDL_PollEvent(&event)) { if(event.type == SDL_QUIT) { quit = true; } } } SDL_FreeSurface(temp); SDL_FreeSurface(surface); SDL_FreeSurface(rotate); //Quit SDL SDL_Quit(); return 0; } I can only guess that it is related to the rotation matrix stuff that Concentrate links to in his post. I will need to take some time to see if I can really understand whats going on here.... Does anyone know if it is related to the rotation matrix stuff pointed out by Concentrate? [Edited by - popcorn on July 8, 2010 12:23:22 AM]
  14. Denzin, I forgot: 4. You cannot tilt your monitor :) The reason is I want to understand the theory behind this and how to program this. From searches here and on google what I've mentioned are always the most common answers.
  15. I am looking at how I could possibly rotate the following sprite by about 20 degrees. The width is 60 pixels and the height is 50 pixels. I am using SDL. The following apply. 1. I cannot use openGL. 2. I cannot use SDL_gfx. 3. I cannot use a paint package to rotate the image. How would I do this? [Edited by - popcorn on July 7, 2010 6:31:29 PM]