Sign in to follow this  

Confusion about a number of new technologies

This topic is 2829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I was wondering what the status-quo is right now on several topics like: 1. multi-core cpu support in games 2. CUDA (well, in general doing computations on the gpu) Is it practical to start investigating further into one or even two of those areas? I'm basically searching for methods of displaying as many autonomuous agents as possible on the screen at the same time. They all have to have some sort of update() game logic and act on their own. These technologies all sound very exciting but it's really overwhelming for me at the moment. Intel has a whole number of software products that claim to help with parallel computing, are those tailored to game developers? Nvidia CUDA seems to be the leading solution for gpu computing right now, I guess I would need to buy a nvidia card then? Currently Radeon 4800 series. What's your advice on this? Nvidia marketing doesnt really suggest any disadvantages of using cuda.

Share this post


Link to post
Share on other sites
1. Yes. Pretty much every game released after 2008 is parallelized to some extent. See http://pastebin.com/FnQEbN1W for a list.

2. Yes. Not necessarily through CUDA (which is specific to nvidia*) though. For example every game with PhysX support can take advantage of a CUDA-enabled GPU to speed up physics. In the upcoming 3.0 release of Bullet physics engine there will be acceleration through OpenCL, which runs on both GPUs and CPUs. And then nearly every modern engine's particle system is simulated on GPU using render-to-texture, which constitutes a form of GPGPU as well.

* if you choose to use CUDA, you will have to write a software implementation anyway for those who don't have a CUDA enabled nvidia GPU. You'll have to carry the burden of maintaining two independent functions that do the same thing. OpenCL on the other hand should run everywhere, on every modern GPU and CPU, but it's still somewhat young.

Share this post


Link to post
Share on other sites
Direct3D has no equivalent for OpenCL? I realize that OpenGL has many benefits, but their API just looks so ugly (sry, I don't want to offend anyone, it's a matter of personal taste). CUDA is a language as I understand it, do games created with CUDA techniques only run accelerated on nvidia graphic cards when deployed? That would pretty much destroy any advantage.

Your list includes Supreme Commander, I have played this map myself, and it doesnt seem to use more than two cores at a maximum. And the sequel according to Chris Taylor doesnt have any multicore support at all despite allowing similarily large battles. GPUs are made to be powerful parallel processors, could I theoretically do all my game logic on a gpu?

How hard is it to support multiple cpu cores in games? I know some thread programming in Java, but I assume that it is much harder when Intel has to release their own software products just to help with it.

Share this post


Link to post
Share on other sites
OpenCL is not dependent on OpenGL in any way. It's just following the same design paradigm as others (OpenGL, OpenAL, OpenVG, OpenCV, OpenIL, ...). You can use OpenCL together with DX without any problems. Use whatever suits your needs.

There's the Compute shader in DX11 that does GPGPU computing in DirectX environment. As far as I know it's more targeted at games though.

And yes, you can implement most of your logic in GPU, as a matter of fact one of the DX11 Compute demos includes a GPU-based multi-agent AI simulation.

Share this post


Link to post
Share on other sites
Sorry, I overlooked your other questions.

CUDA is more of an extension over C and C++ than a full blown language. It defines a bunch of macros and new calls (mainly for defining kernels and invoking them). It comes with a compiler that compiles the GPU code (kernel), the rest of the code is compiled with available CC (e.g. g++, MSVC++, ...).

The CUDA runtime also contains an emulator that can be used to execute the code on platforms without an nvidia GPU, but this emulation is very slow, is not parallel and generally can not be used as a drop-in replacement for a CUDA chip. Not in production environment such is a realtime game anyway.

As for multi-core support - there are many ways of doing that. You of course need threads. The possibly simplest way is to split your engine into specific tasks, e.g. renderer thread, IO thread, logic thread, physics thread... and achieve some sort of parallelism. It doesn't scale very well (a 4-thread engine will not benefit from an 8-core CPU) and tends to waste resources anyway (IO thread will just sit there when no file needs to be loaded).

A better way is to divide your workload into discrete units and spawn as many threads as required, and then distribute these work units betwen them. This approach is more complex to implement manually, but is fully scalable.

There are several toolkits that help with the second approach - for example OpenMP does this pretty much automatically. It's very easy to work with.

And then there's OpenCL, which is like CUDA or Compute, only it runs on more hardware and platforms and, unlike CUDA, it can take advantage of not only GPUs, but multi-core CPUs as well (e.g. there's a realtime raytracer that runs on an i7 using OpenCL).

Share this post


Link to post
Share on other sites

This topic is 2829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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