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

Portable graphics programming?

10 posts in this topic

After analyzing the source-code of games like Doom, Abuse and Wolf3D, and inspecting their ports to SDL and other platforms, i'm curious about the architecture and techniques used for rendering. They don't use SDL or any other platform-specific code for rendering sprites or text to the screen, neither they use it for sound. So, porting the graphics part is quite easy. 

 

Is this the job of a software renderer? Where i can find more information about 2D software renderers? 3D might be good use too, but i'm curious about implementing a 2D game entirely in software, relaying in SDL only for the platform-specificity.

0

Share this post


Link to post
Share on other sites

The original Doom and Wolf3D most certainly had platform-specific code. I have no idea what Abuse is, so I won't comment on their approach. SDL Doom uses SDL's rendering. So I'm left scratching my head on what code you're looking at that doesn't use SDL nor any platform-specific code to render. Unless you're looking at code that uses OpenGL to render, which is available on a lot of platforms.

 

You can use SDL's rendering functions if you're already going to use SDL to avoid platform-specific code. If you're using SDL2, it will even use hardware acceleration when able. There is no requirement that other software renderers support a lot of platforms, and often they do not. If there's a reason you don't want to use SDL for rendering even though you're already using it for other purposes, perhaps you can elaborate on the rationale. What platform are you targeting that SDL supports outside of rendering, but not in rendering?

0

Share this post


Link to post
Share on other sites

Wolf3D ports replace the direct framebuffer access, which is why you're seeing rendering to bitmap. On most hardware you'd ever use now, you will not have direct framebuffer access.

 

If you want to render to bitmap first, you can do that. With SDL, you'd use SDL_SetRenderTarget. You can even SDL_LockTexture and mess with the texture pixel-by-pixel however you want. Or you could just make your own bitmap altogether and write your own draw functions. I don't recommend any of this, and still think you should just use SDL since you're already using SDL.

 

You could also use an old version of OpenGL ES to get portability. I suppose it's even more portable than SDL, and it's certainly more portable than a software renderer that has system-specific optimizations so it can run at a less terrible speed. Although you're already tied to SDL's portability, so I still have no idea why you don't just use SDL.

0

Share this post


Link to post
Share on other sites

Do you know any tutorials or books on rendering directly to the framebuffer? I would love to learn more about it, and write a small engine with this support. It's amazing for porting to non-standard platforms. (DC, PS1, etc.)

0

Share this post


Link to post
Share on other sites

Writing directly to the framebuffer means you're going to deal with hardware-specific bugs, timing requirements for the bus and for the video hardware, etc. that normally get handled by drivers. It is a very, very bad idea to write directly to the framebuffer unless you are actually writing a video driver. Just write to a bitmap and blit it every frame.

 

On Windows, you can't directly access the framebuffer unless you're a graphics driver. For old versions of Windows, there were bugs you could exploit to gain access, but you'd usually just crash the OS anyways. SoftICE did the best job, and even they failed to run on tons of hardware. If you are writing a graphics driver, you'd be passed the address of the framebuffer by Windows. You'd want to learn Windows Display Driver Model (WDDM).

 

On Linux, I think you still can access the framebuffer directly at 0xd0000000. No clue if that would work on 64-bit. If you're going to mess with the framebuffer on Linux, you should probably use fbdev.

0

Share this post


Link to post
Share on other sites
No, no. I mean creating a virtual framebuffer with my bitmap pixels and then streaming that to the hardware framebuffer using the driver API. At least, that's how i did on my Wolf3D SDL port.


Any other book other than Michael Abrash's about virtual fbs? Edited by jbadams
0

Share this post


Link to post
Share on other sites

Michael Abrash? Are you reading about Mode X rendering on VGA hardware or something? Those types of optimizations will do absolutely nothing for you on modern systems that have to emulate VGA. It's certainly fun to read about the cool stuff we did to extract every bit of performance on a 386 with a VGA chip, but not all that useful to portable code writing.

 

What you are describing is just rendering to a texture and then displaying said texture. But you seem to want resources on how to more effectively restrict your options when rendering to texture, which is pretty much the opposite of what books teach. Books teach to unrestrict you, not to restrict you.

 

If you want to write portable code, read about portable code and write in an environment that requires portable code. Use SDL. Or use NaCl and you'll run on PC, iOS, Android, and anywhere else Chrome exists. But you don't seem to want to use the tools available for portable coding either, so I'm at a loss trying to figure out what you even want.

0

Share this post


Link to post
Share on other sites
Hello,
 
Copied from a post of mine in the Multiplayer forum
 
This is my impoverished map of the world right now:
 
1) C++ + SDL 2.0 + OpenGL ES 2.0 compliant -> Native application (Windows/OSX/iOS/Android/Linux)
2) C++ + SDL 2.0 + OpenGL ES 2.0 compliant -> LLVM -> Emscripten -> Browser (Chrome and Firefox + others)
 
This allows for you to make a C++ framework where you have different renderers (minimal variations of OpenGL commands) and that would cover almost the whole market with no plug-in install required.
 
Since you mentioned platformers and sprite based games, those can be emulated with calling different quad rendering commands in OpenGL. Of course if you prefer going old school you could simply generate the pixels yourself, then copy them to the graphics buffer via a texture.
Edited by jbadams
Restored post contents from history.
0

Share this post


Link to post
Share on other sites

Do you know any tutorials or books on rendering directly to the framebuffer? I would love to learn more about it, and write a small engine with this support. It's amazing for porting to non-standard platforms. (DC, PS1, etc.)

 

Rendering directly to the framebuffer would be terribly inefficient on the PS1.

0

Share this post


Link to post
Share on other sites

 

Hello,
 
Copied from a post of mine in the Multiplayer forum
 
This is my impoverished map of the world right now:
 
1) C++ + SDL 2.0 + OpenGL ES 2.0 compliant -> Native application (Windows/OSX/iOS/Android/Linux)
2) C++ + SDL 2.0 + OpenGL ES 2.0 compliant -> LLVM -> Emscripten -> Browser (Chrome and Firefox + others)
 
This allows for you to make a C++ framework where you have different renderers (minimal variations of OpenGL commands) and that would cover almost the whole market with no plug-in install required.
 
Since you mentioned platformers and sprite based games, those can be emulated with calling different quad rendering commands in OpenGL. Of course if you prefer going old school you could simply generate the pixels yourself, then copy them to the graphics buffer via a texture.
 
spinningcube

 

 

While i agree with you that this is a pretty standard way of portability for modern games, i'm looking to design a versatile and simplistic architecture. I'm trying to write a very simple game engine, written in C, capable of small 2D platformers, RPGs and so on. The biggest objective is making the engine highly portable across different devkits. Currently, the DC, PS1, N64 and GBA. All of them, C89-compatible and easy to render whole bitmaps to the screen... but not so easy to load and handle separate assets. That's why my questions is about rendering to the whole screen at once.

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