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

Tolito

Members
  • Content count

    78
  • Joined

  • Last visited

Community Reputation

256 Neutral

About Tolito

  • Rank
    Member
  1. Thanks! It is the same thing in general. It is simply a matter of storing the sockaddr information and updating it for sendto, the SDL_net version. Thanks!
  2. I'm writing a simple command-line based chat client using C and SDL_net. This page has been useful: http://content.gpwiki.org/SDL:Tutorial:Using_SDL_net#Using_UDP   The code on that page works well for clients connecting to a host and sending messages to the host. What I am now trying to do is have the host send data back to each client.   It seems like it would be relatively simple, but I can't find any notes anywhere for it. Can anyone help me out with the code that needs to be added to the client and the host so the host can send messages back to the clients? Thanks!
  3. Thanks! Hopefully others with this question will come across this post!
  4. Update:   For my new multiplication function, I simply did this:     SDL_Rect r={0,0,XRES,YRES};     SDL_SetRenderDrawBlendMode(screen,SDL_BLENDMODE_MOD);     FillRect(screen,&r,color);This multiplies the new color to the screen without the need for accessing and editing the screen pixels, multiplying to them one by one. Since this is why I was needing to access the renderer pixels, this is no longer a problem.
  5. Thanks again! Since no pixel representation can be found, it sounds like my idea of storing said pixels as an SDL_Surface after they have been copied to the renderer is not a possibility. The only efficient possibility for doing this may be copying the to-be-blitted region of each texture, multiplying to the copy, rendering the copy to the SDL_Renderer, and destroying the copy. Doing this effectively is all over my head, though. Should I keep using SDL_Surfaces for everything and do the multiplication and rendering there, then storing as a texture and rendering that to the renderer at whatever scale?
  6. Thanks for the reply! Actually, I am using SDL_RenderCopy to copy textures to the screen, which is of type SDL_Renderer. Instead of updating every texture each frame, I want to edit the pixels of the renderer itself, basically the final version of the screen. I am trying to avoid using an SDL_Surface since this will be calculated each frame and I want to do all of this in the GPU. Creating a surface that is a copy of the renderer, multiplying the colors there, converting the surface to a texture, and using SDL_RenderCopy again to put the edited colors back on the renderer would work, but it seems like there is a more efficient way of doing that. Is there a way to access and edit the pixels of an SDL_Renderer itself? Thanks again!
  7. When I was storing the screen as an SDL_Surface, I could multiply colors to it like so:    Uint32 *pixels = (Uint32 *)screen->pixels;     unsigned int x, y;     for(y=0;y<screen->h;y++) {         for(x=0;x<screen->w;x++) {             // Code to edit each pixel here.         }     } I am migrating my code to work with SDL_Textures again, which requires using an SDL_Renderer. I am familiar with using SDL_RenderCopy and all of those functions, but I'm not sure how to go about editing the individual pixels rendered to an SDL_Renderer, and this is necessary. Does anyone have any suggestions on how to do this? Thanks!  
  8. Thank you for the useful responses, everyone! My guess was that using SDL_Textures instead would help, but there was a problem loading a 10,000x8 image as a texture. It looks like using an image that is squarer works, so that is no longer a problem.   I think my last question regarding SDL_Textures is this: by what means can I edit the contents of an SDL_Renderer? With SDL_Surfaces, using what will be rendered to the screen as a surface, I can easily edit pixels. I wrote a function to multiply a color to every pixel on a surface, which is then rendered to more. How can I go about doing the same thing for a renderer? Maybe I should start a new topic, but replies to this question are welcome. Thanks again, everyone!
  9. Thank you for your response!   One image is approximately 10,000x8 pixels, which doubles to 20,000x16. Having everything scaled in advance was working well with SDL 1.2, but when storing that many pixels was the only way to display a scaled version to the screen and they couldn't all be stored, and having been told that SDL 2.0 could natively draw graphics double the scale without a slowdown, I migrated the code to SDL 2.0.   There unfortunately is still a slowdown, even when scaling only the final version of the image instead of each individual one.   The native resolution is less than 320x240 pixels. This is a suitable resolution for the graphics that are in use and it saves space. It looks much better with double the resolution, however, but has high-detailed graphics that cannot all be stored in ram if everything is double the scale.   I heard that SDL 2.0 could natively do this. Would the slowdown still be present if I were to write my own version of SDL_BlitSurface that blits four pixels for every one pixel of a surface? What I'm thinking SDL_BlitScaled does is it does math to scale the surfaces before blitting them to the screen.
  10. I'm unfortunately bringing this topic back from the dead (initially posted here: http://www.gamedev.net/topic/651375-double-screen-resolution/)   In favor of using SDL_BlitScaled, I migrated all of the code to SDL 2.0. Unfortunately, the slowdown is back again. How can I double the screen resolution so that every 1x1 pixel is a 2x2 pixel? I'm surprised that they still haven't implemented anything like this. It runs at full speed at the small resolution, but I would like for it to be double that without having to scale all of the graphics in advance, which will consume more ram.   Is there something that I am forgetting? Thanks!
  11. Thanks for the response.   I am using SDL without OpenGL, using SDL_RenderCopy to display graphics. Double buffering seems to be for OpenGL only: http://wiki.libsdl.org/SDL_GL_SetAttribute#Remarks   Tiles render, but VSync doesn't work: screen=SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE ); Nothing renders (this should enable VSync alongside software rendering): screen=SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE ); Everything renders but tiles (if using 2,000x8, the tiles render, but the 11,000x8 image is necessary for this project): screen=SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED ); What I am asking: How do I (a) enable VSync in SDL 2.0 with software rendering, or (b) how can I store the 11,000x8 pixels image as a texture in the GPU? It stores in ram properly because it renders with software rendering.
  12. The image that is the map tiles is approximately 11,000 pixels wide. When I load it into SDL_Texture with software rendering, it works. When I use this, however, it does not: screen=SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE );Using [b]SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE[/b] without [b]SDL_RENDERER_ACCELERATED[/b] also does not work. If I want the tiles to render, I must supply [b]SDL_RENDERER_SOFTWARE[/b] only. How do I enable VSync in SDL 2.0 with software rendering, or why can I not store that as a texture in the GPU, yet I can store it in the CPU just fine?   Thanks!
  13. I added code to work with surfaces that are double their original scale and made them be scaled after being loaded. It took a while to implement, but the doubled resolution renders more quickly now. The original, doubled, and fullscreen resolutions are now all available to the user. Hopefully storing the scaled surfaces will not be a problem for the system requirements! Thanks for the input! I was hoping there was a way to render at double the resolution without having to scale the surfaces, but this will do.
  14. Thanks for the response! This is almost finished, so switching to something other than SDL 1.2 at the last minute may be more work than necessary. Is there some kind of way to scale screen and then do SDL_Flip(screen); instead of making a duplicate that is a scaled version of screen and then blitting to screen, flipping screen afterwards? I tried running the scaling code in the background without re-blitting and there was no slowdown. Blitting the duplicated and scaled surface to screen before doing SDL_Flip(screen); is what causes the major slowdown to occur.
  15. if(new_screen_w && new_screen_h && (stored_res_x!=new_screen_w || stored_res_y!=new_screen_h) ) screen=SDL_SetVideoMode( new_screen_w, new_screen_h, 32, SDL_SWSURFACE ),stored_res_x=new_screen_w,stored_res_y=new_screen_h; That's what I was saying. The problem was probably not occurring because it only had to blit for one fourth of the size of the window. With that line of code enabled, however, it must do four times the blitting, which led to an entire system slowdown.     Instead of scaling and blitting a duplicate, how can I scale the screen itself and use SDL_Flip on that? For example, this: scale(screen); SDL_Flip(screen); Instead of this: SDL_Surface *scaled=scale(screen); SDL_BlitSurface(scaled,NULL,screen,NULL); SDL_Flip(screen); I tried running the code with scaling going on in the background with no re-blitting. There was no lag. Blitting without scaling also results in no lag. With both scaling and blitting, however, the entire system slows down. Thanks again!