• 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.
Sign in to follow this  
Followers 0
Tolito

SDL 2.0 - Double Screen Resolution

6 posts in this topic

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!

0

Share this post


Link to post
Share on other sites

Well, rescaling everything on every frame doesn't look like a good idea to me, unless:

1 - Zooming in and out plays a significant role on your gameplay;

2 - Your game is zooming in and out constantly or too often;

3 - You'd need to use too many different zoom levels simultaneously.

But I am afraid I don't know anything that can render a scaled image without actually going through the expensive process of scaling it.

 

But if you do not change your zoom continuously or anything like that, I'd recommend against real-time scaling. It is a rather expensive process, and I'd prefer not to do it on-the-fly.

In most cases, RAM is cheaper than computing power, so I would choose to pre-scale everything to a given zoom level.

 

But if the zoom level changes too often, pre-scaling may really be a bad option. In this case, you should try to reduce the number of scaling processes to a minimum.

The first thing I'd try would be drawing everything to a Buffer and then bliting it scaled to the screen. But it would still require a scaling of a big chunk of data on-the-fly, so... no miracles.

 

Can you give us more details on why exactly you need this feature?

Edited by dejaime
1

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

As exOfde has already said, you should be using textures instead of surfaces. This will allow you to take advantage of your GPU's processing power to transform images quickly and efficiently, and scaling is automatic given the destination rect. The reason you're experiencing slowdown is because you're using the CPU for image processing, which is very slow for that kind of thing.

1

Share this post


Link to post
Share on other sites

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!

0

Share this post


Link to post
Share on other sites


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.
It's not about "squarity" (non power of 2 textures are supported extremelly well nowadays) but about maximum size (each dimension sepatrately). Also, just that it works on your machine means nothing (it's GPU dependant).

 

Generally and oversimplyfying and making assumptions:

- at the moment of writing up to 1024 is a very safe size, if it does now work it means the hardware is too outdated to bother

- 8192 is the maximum that is reasoanably safe for modern/higher end machine, do not exceed this number under any circumstances (at the moment of writing this post)

- my unscientific and not necessarily correct observation is that 4096 is a safe target size or 2048 if you want to support older laptops

 


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.
The short answer is, you can't. OK, you can but... It's a can of worms, can be ultra slow on some machines (and again, just because it works fast on your machine means nothing). Generally, it's highly not recommended.

If you need to direct pixel access it's probably best to just do it on SDL_Surface and then convert to SDL_Texture.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0