Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

113 Neutral

About Arivor

  • Rank
  1. Arivor

    SDL_Layer even slower than SDL?

    Okay, thanks for your help anyway. I'm not that great an expert, but I'll definitely take a closer look at the SDL_Layer files.     No need to apologize. You brought me onto the right track, I think. With SDL_Layer I get a stable 21 ms/frame, which goes up to around 28ms/frame with a thousand (small) objects. So it was my code: When I first wrote it for vanilla SDL, I regulated the speed by limiting it to one update for every few frames (dumb idea, I know...). So if I update once per frame, I can use SDL_Layer without lag. A thousand objects at once should suffice for a small project like this. Btw, I tried with and without SDL_DisplayFormat() and cannot make out any difference (neither by eye nor by measuring).     Actually, SDL 2.0 I believe is heavily attached to OpenGL, but with SDL 1.2 I think it's only true OpenGL code that benefits from hardware acceleration. I could be wrong though, I don't know if initializing the screen with SDL_OPENGL can be done without OpenGL specific code, but he could try adding that to the flags when calling SDL_SetVideoMode().   Don't know for sure though, just something to look into. I'm able to use that flag, but with SDL_Layers it just gives me a black screen. No idea if that's SDL_Layer's fault or that flag just needs some special code.     Thanks for all your help! Going back to coding now ;-) -Arivor
  2. Arivor

    SDL_Layer even slower than SDL?

    $glxinfo | grep render direct rendering: Yes OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile GL_NV_conditional_render, GL_ARB_ES2_compatibility,
  3. Arivor

    SDL_Layer even slower than SDL?

    I'm on Linux Fedora, and as far as I can tell, all my drivers are up to date. -Arivor
  4. Hello everyone,   I'm currently experimenting with SDL for some basic scrolling shooter. Since the moving background reeeally slowed things down, I went online and found "SDL_Layer". The documentation is sparse, but I thought I'd figured it out - until I tried it. With just the background in one layer and a single object in another, it's just as slow as vanilla SDL. Because of the moving background I can't use dirty rects. Unfortunately, Google was not helpful on this topic, so I presume there is something wrong with my code.   Here is what I tried: SDL_Surface *screen; if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ) { fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); // Initialize screen screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF ); if( screen == NULL ) { fprintf(stderr, "Unable to init video: %s\n", SDL_GetError()); exit(1); } rmask = 0x00ff0000; gmask = 0x0000ff00; bmask = 0x000000ff; amask = 0xff000000; display = SDLayer_CreateRGBLayeredDisplay(SDL_HWSURFACE | SDL_FULLSCREEN, SDLAYER_FLIP, LAYERS, layer_widths, layer_heights, 32, rmask, gmask, bmask, amask); SDLayer_SetColorKey(display, SDL_SRCCOLORKEY, 0); // without this, only the topmost layer will be visible bmpBackground = SDL_LoadBMP("Background.bmp"); if(bmpBackgroundRewind == NULL) { fprintf(stderr, "Couldn't find a graphic: %s\n", SDL_GetError()); exit(1); } bmpPlayer = SDL_LoadBMP("Player.bmp"); if(bmpPlayer == NULL) { fprintf(stderr, "Couldn't find a graphic: %s\n", SDL_GetError()); exit(1); } SDL_SetColorKey(bmpPlayer, SDL_SRCCOLORKEY, SDL_MapRGB(bmpPlayer->format, 255, 0, 255)); I then enter the main loop, which repeatedly triggers the draw() function: SDL_Rect background; SDL_Rect dest; static int background_y = 0; if(++background_y >= HEIGHT) background_y=0; // draw a moving background background.x = 0; background.y = background_y; background.w = WIDTH; background.h = HEIGHT; SDLayer_Blit(bmpBackground, NULL, display, &background, 0); background.x = 0; background.y = background_y-HEIGHT; background.w = WIDTH; background.h = HEIGHT; SDLayer_Blit(bmpBackground, NULL, display, &background, 0); // draw the player dest.x = player1.x; dest.y = player1.y; dest.w = player1.w; dest.h = player1.h; SDLayer_Blit(bmpPlayer, NULL, display, &dest, 1); // draw the buffer to the screen SDLayer_Update(display); I currently disabled everything else, so it's definitely this bit which is causing the slowness. My laptop isn't the fastest one out there, but the speed I'm currently getting can't be right.   Also, I have a hunch the moving background could somehow be realized with viewports and scrolling factors, but should I even bother? When the program's finished, there will be way more objects to update, and it doesn't even work smoothly for one. Or is there some alternative to blitting that I missed?   Anyways, thanks in advance for any help!   Sincerely Arivor
  5. Arivor

    Beginner hoping for a few pointers

    I don't really like flash, so I never got into that language. I have no idea if it suits my purpose. Thanks for the suggestion anyway. For now, I'm finding my way with JME. Once I got blender 2.62 to export ogre/xml files, I might use that to do a 3D tile based game. Sincerely Arivor
  6. Arivor

    Beginner hoping for a few pointers

    Thanks, that looks interesting. Could be a bit overpowered for my purposes, but I'll definitely take a closer look. I tried PyGame two or three times and wasn't too happy with it, but that's just my personal experience. Sincerely Arivor
  7. Arivor

    Beginner hoping for a few pointers

    Thanks for your response, fla! That's a good argument. Do you have any recommendations here? Yeah, but for compiled languages, I'd have to provide one version for every system, and I'd have to recompile for every update in the code. So each time I want to fix a bug, it'll be "hey there, can anyone compile my game on Windows 32-bit, please?". Or am I mistaken here? Sincerely Arivor
  8. Hello all, I've now watched this forum for a few days and I think I've come to the right place. I'll come straight to the point: I have some experience in programming and want to revive an old dream of mine: Creating an oldschool RPG. Here's a list of things that come to mind: "Oldschool": No fancy 3D graphics, no realtime playing - just turn based, tile map. Should be cross-platform - I think the best way is to use Java - any other recommendations? I already made a few simple games - some "shoot' em up", Pong, that stuff; fiddled with bitmaps in Delphi way back on Windows. I'm not sure on whether to use a pre-made engine. While it would speed things up, I'd rather know what goes on "behind the stage", and I don't know if I can achieve that without creating from scratch. Any advice? (Oh, and if I were to use something pre-made, it'd have to be licensed under some form of copyleft so I don't have to struggle with licensing problems.) As mentioned, I made some simpler games with Delphi's VCL. But I really don't know where to begin with this one, and albeit having searched the internet for a long time, I didn't find any tutorials that really addressed my problem. My hope now is that the community in this forum can point me a way to start. Okay, thanks for reading this, and please point out if I have to give more information. Thanks for your time! Sincerely Arivor P.S.: Please excuse my English since it's not my native language.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!