Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I already know many computers today have a GPU that supports DirectX and OpenGL. But what about computers that don't? Can I write a simple 2D game that does not rely on the GPU, so that it works even on older machines?

Is there a cross-platform C or C++ game library that will let me do this? Ideally, such a library would let me toggle hardware acceleration with very few lines of code.

share|improve this question
    
You can even do it 3D, the first Unreal Tournament ran on the CPU. –  Psykocyber Oct 17 '11 at 19:33
    
How old are you thinking? just about anything that's still running is going about support some variant of OpenGL or DirectX. –  David Lively Oct 17 '11 at 20:28
    
@DavidLively I know that i may sound a bit "old" but there are still users having old harware, including using the video memory of the motherboard (they don't support either DirectX or OpenGL, at least for the old ones). Plus, as from the answers i got, it's not difficult to toggle hardware acceleration, so it's a big deal anyway. –  user999687 Oct 17 '11 at 20:44
    
Hardware-accelerated GPUs of one kind or another have been standard for a long time. Are you also planning on targeting Windows 98, machines with sub-200MHz CPUs, or 64MB RAM? –  user744 Oct 17 '11 at 22:14
1  
GPUs completely unnecessary: igf.com/php-bin/entry2012.php?id=56 –  michael.bartnett Jan 22 '12 at 1:12

6 Answers 6

up vote 6 down vote accepted

Certainly- you can use SDL and I believe it does everything on the CPU by default. You can actually get some pretty good performance if you manage your code well.

share|improve this answer
    
Thanks! SDL is one of the game libraries that i am going to pick (together to Allegro). –  user999687 Oct 17 '11 at 19:01

Do you think Pong used a GPU?

The Flash games you play on the web all the time, do you think they use a GPU?

(It's only these last few weeks that Flash games can at last be developed to use GPU support. And Flash has been around for considerably more than a decade.)

Of course it's possible. I'd been playing games for a decade before there was even such a thing as an accelerated graphics card for the consumer market, let alone entire Turing-complete processors dedicated to graphics (and more specifically, for games graphics).

share|improve this answer
    
Thanks for the reply. I was just confused, since now the only things that i can see around is DirectX and OpenGL, or other game libraries that supports those two (at least, regarding C/C++). –  user999687 Oct 17 '11 at 19:12
    
This answer is disingenuous - Pong did not have a GPU, but it also didn't have a CPU. Very early games used TTL chips and nothing we'd recognize as a programmable computer today. –  user744 Oct 18 '11 at 9:16
    
@JoeWreschnig (a) CPU != microprocessor. Take the time to read some of the older literature and you will quickly determine that the use of TTL in a CPU did not somehow magically prevent it from being a CPU. A CPU is a role in computer architecture in which TTL was the fundamental technology at the time. (b) You need to go and re-read the definition of disingenuous, because it's clear you don't know how to use it. –  Nick Wiggill Oct 18 '11 at 9:40
    
@Nick: Except it wasn't a CPU implemented in TTL, the game was implemented in TTL. It was not a programmable computer, and so there was no CPU. –  user744 Oct 18 '11 at 10:00
    
@JoeWreschnig That was a CPU. "The central processing unit (CPU) is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system." That's the definition. They've been around since the 40's. Your views on what constitutes a CPU, are inaccurate. Nowhere will you find a definition that necessitates programmability (i.e. software encoded instructions). –  Nick Wiggill Oct 18 '11 at 10:11

Don't forget, first-generation video games were written for an oscilloscope! And by first-generation video games I mean pong. A GPU remember, is a math processor, which is also what a CPU is. It's just more specialized.

share|improve this answer

It's absolutely possible: The first computer games existed before GPUs--which as you point out, are hardware designed to accelerate 3D math. Anything that's being done on the GPU can also be done on the CPU, although usually at a slower overall speed. (The initial release of Quake, for instance, only used software rendering[1])

Mesa3D is an OpenGL implementation that claims to support full-software rendering. (I haven't used it other than as a reference implementation, though).

share|improve this answer
    
"Usually at a slower speed" is highly subjective and as a general statement, pretty poor in understanding of the differences. A simple outline is that ops that fit the SIMD paradigm well, and that minimise conditional logic, are good choices for the GPU. This includes mass number-crunching type tasks such as raw pixel pushing or vertex processing, while CPUs are the general purpose workhorse and delegator. In cutting edge research into real-time raycasting and global illumination, subparts of the algorithms used are delegated very carefully to extract optimal performance from CPU and GPU both. –  Nick Wiggill Oct 17 '11 at 19:27
2  
I'd rather not debate the semantics of "usually" and "overall". I had hoped it was a vague enough assertion: in general, considering the overhead costs of shipping jobs to the GPU, getting to do tons of parallel ops there is a win, although there may be some cases where this isn't true. –  Clayton Hughes Oct 17 '11 at 20:09
    
It's fair to say there are as many cases where your original statement is not true, as where it is. And unless you have a solution specifically suited to those parallel ops, no, it won't be any faster, it may in fact be a lot slower. Perhaps better to just represent the facts more accurately, than to try to avoid a "debate". Let's try not to mislead anyone. –  Nick Wiggill Oct 17 '11 at 20:50

if it's only about 2d games, I suggest you use either flash 10 or SDL, but if you think your game might contain 3d assets and rendering you can also use Irrlicht. it's basicaly an open-source cross-platform 3d engine with support for both hardware and software rendering:

from wiki:

Irrlicht supports 3D rendering via OpenGL, DirectX 8 and 9, OpenGL ES, and internal software rasterizers.

share|improve this answer

While what you ask is possible it is worth noting that there is usually practically no advantage in discarding 3D acceleration. All modern PCs have built in 3D acceleration. The few old machines without this feature constitute an extremely small games market, and you'd probably have other compatibility issues with those as well.

I fear that you are asking this question for the wrong reason.

share|improve this answer
    
I was just searching for a way to build a game pretty available to everyone, even for users having older hardware. Plus, as i said, i requested a cross-platform game library, so i obviously expected some loss of compatibility (for specific hardware platforms), but at least i had to program less and still having a product targeted for a large portion of users. Nice point though, i would like to have a game available to (almost) everyone. But since i'm still a newbie and i won't code for multiple platforms, i think this is the way to go--- at least for now. –  user999687 Oct 17 '11 at 20:24
    
As a newbie you should first of all get a library that is easy to use, I'm not saying that couldn't be a non-accelerated one, but the criterion is not going to ease the search. –  eBusiness Oct 18 '11 at 13:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.