PDA

View Full Version : Best thing to use for 2D Games.




MorphingDragon
Nov 6, 2009, 02:51 AM
Okay, so some of my friends and I are designing a side scrolling game as a University example. (We want to take an advanced course and we need to show previous skill) They want me to make a Mac version but I don't have enough experience to answer my question myself. Whats better for a 2D side scroller. OpenGL or Cocoa Functions like CI/QE? In terms of performance really, I don't really care how complicated the code gets.

EDIT:

My friends and I got accepted into one of the best Universities in New Zealand. They let you skip some 100 level papers in the second semester if you show previous skill in a C derived language. We decided to do a side scrolling 2D game and develop on our own platforms of choice. Then we decided to get John to make the core logic while Jake and I finish off designing the game. Then we would write the Graphics rendering in the local libraries (.Net/Cocoa etc). We get about a year if we start now.



ranguvar
Nov 6, 2009, 03:11 AM
Just make it OpenGL, so it'll be cross-platform.

MorphingDragon
Nov 6, 2009, 03:13 AM
Just make it OpenGL, so it'll be cross-platform.

That doesn't matter, I'm making the Mac Version, Jakes making the Windows Version in C# and John's making the Linux Version. Its for a portfolio, the University wont care.

ranguvar
Nov 6, 2009, 08:05 AM
That doesn't matter, I'm making the Mac Version, Jakes making the Windows Version in C# and John's making the Linux Version. Its for a portfolio, the University wont care.

Yeah, but it _will_ be the same game, won't it? So if all of you combine your efforts and write your game using OpenGL with, say, C/C++, you'll save lots of time.

Cromulent
Nov 6, 2009, 08:10 AM
OpenGL and SDL all the way.

Doing it the way you describe seems a massive waste of time. Why implement the same thing three times when you can all use a common code base?

lee1210
Nov 6, 2009, 12:26 PM
This is going to come off as being harsh, but it sounds like this is clearly demonstrating a lack of "previous skill" if you don't even know where to start. It also seems like the 3 of you should agree on a cross-platform toolchain, then you can pool your resources for making 1 solid, complete product. Right now it seems like all the time you'll be spending is on platform specific code. I'd argue that you're making 3 different games.

-Lee

Edit: To try to be somewhat helpful: What prior skillset are you trying to demonstrate? Algorithms? Coding a particular language? Design principles? Software engineering skills? Game design skills? It may be better to figure that out and pick a project that is better suited to those strengths. If you don't know how to program using Cocoa, and you don't know OpenGL, trying to put this together using those is not going to make your project look impressive. Even if you have a great algorithm, but the implementation is awful, they're going to see an awful implementation.

MorphingDragon
Nov 6, 2009, 02:40 PM
This is going to come off as being harsh, but it sounds like this is clearly demonstrating a lack of "previous skill" if you don't even know where to start.

My last languages was VB6. The Course requirements stated a C like language. So... duh I have not a lot of previous experience. Obj-C is the only C like language I know and I only started learning/using it about half a year ago. My last program on Obj-C was an In house prototype for a law firm. So I know how to use event driven, object orientated style programming at least. I don't know whats better because I haven't done anything past Aaron Hillegass' Examples in this area.

Wouldn't OpenAL be better than SDL for sound?..

Actually thats an Idea, What if the whole thing was coded in OpenAL/CL*/GL. With C#/Obj-C/QT front ends?

*I remember AMD saying that OpenCL can be used to write CPU code.
They all have C-Like syntax, and we have a whole year to do it.

lloyddean
Nov 6, 2009, 02:50 PM
That doesn't matter, I'm making the Mac Version, Jakes making the Windows Version in C# and John's making the Linux Version. Its for a portfolio, the University wont care.

Each comfortable on the their own respective platform no doubt.

I'd also suggest showing some programming and team skills by doing cross-platform game code.

Each one of you would then do your systems specific driver. Window message handlers, Mac Cocoa View Controller and whatever is required for the LINUX GUI of choice.

Cromulent
Nov 6, 2009, 03:57 PM
Wouldn't OpenAL be better than SDL for sound?..

SDL is not just for sound. It is an input library as well as other things. Given what you have said I would say stick with SDL rather than jumping into OpenAL.

Why do you think OpenAL is "better" than SDL for sound? You won't be doing anything approaching professional audio I would imagine so basically anything will do as long as it is cross platform (which SDL is) and is easy to learn (which OpenAL is not).

Actually thats an Idea, What if the whole thing was coded in OpenAL/CL*/GL. With C#/Obj-C/QT front ends?

*I remember AMD saying that OpenCL can be used to write CPU code.

Do you need to use OpenCL? There is no point in using it just for the hell of it.

MorphingDragon
Nov 6, 2009, 04:04 PM
Do you need to use OpenCL? There is no point in using it just for the hell of it.

No, but it would be unique. You need to do anything to stand out in the world of students.

Cromulent
Nov 6, 2009, 04:14 PM
No, but it would be unique.

Well its your project but bear in mind that Mac OS X is the only platform with a production ready OpenCL implementation. Nvidia I believe have released OpenCL beta drivers for Windows and perhaps ATI have too. Linux is quite a bit behind I believe.

Also the more time you spend learning about technologies like OpenCL is less time spent working on your game which is actually your real project. It would be pretty stupid to spend a vast amount of time implementing a clever game using OpenCL only to end up with a rubbish game because you forgot to actually save some time for designing and implementing game play.

You need to do anything to stand out in the world of students.

How about just trying to make the best game in the class?

MorphingDragon
Nov 6, 2009, 04:20 PM
Well its your project but bear in mind that Mac OS X is the only platform with a production ready OpenCL implementation. Nvidia I believe have released OpenCL beta drivers for Windows and perhaps ATI have too. Linux is quite a bit behind I believe.

Also the more time you spend learning about technologies like OpenCL is less time spent working on your game which is actually your real project. It would be pretty stupid to spend a vast amount of time implementing a clever game using OpenCL only to end up with a rubbish game because you forgot to actually save some time for designing and implementing game play.

ATi is the only one left in Beta on other platforms and nVidia has already released its own SDK.

How about just trying to make the best game in the class?
Its not a class, its a project for special admission to an advanced paper. Plus we can skip some 100 level papers. We get a year to do it.

Cromulent
Nov 6, 2009, 05:05 PM
ATi is the only one left in Beta on other platforms and nVidia has already released its own SDK.

Nope.

The only drivers from Nvidia which support OpenCL are the 195 series of drivers and they are still in beta.

Catfish_Man
Nov 6, 2009, 06:55 PM
OpenCL would be a very strange choice for game logic. I don't expect it would work very well.

skunkworker
Nov 6, 2009, 09:57 PM
I would have to definitely say Box2D. its all in c++ & is cross platform.

admanimal
Nov 6, 2009, 10:14 PM
You guys do understand that the purpose of OpenCL is to use GPUs for things -other- than games/graphics, right? While I guess technically it is feasible to use it for parts of game logic or physics or something, that's not really what it is intended for, and using it for that while you also have graphics for the GPU to process would probably just slow things down.

Regular old OpenGL graphics will already be accelerated by the GPU without OpenCL being involved.

savar
Nov 6, 2009, 10:24 PM
Okay, so some of my friends and I are designing a side scrolling game as a University example. (We want to take an advanced course and we need to show previous skill) They want me to make a Mac version but I don't have enough experience to answer my question myself. Whats better for a 2D side scroller. OpenGL or Cocoa Functions like CI/QE? In terms of performance really, I don't really care how complicated the code gets.

I've seen enough threads like this over the last decade, that I can confidently say there is about a 2% chance this game ever actually gets built.

The single biggest flaw is that you're already talking about what languages to build the game (hint: languages don't make a damn bit of difference) and you haven't talked at all about what the game will be like.

I'm not criticizing... just pointing out that we've seen this pattern before.

MorphingDragon
Nov 7, 2009, 12:03 AM
You guys do understand that the purpose of OpenCL is to use GPUs for things -other- than games/graphics, right? While I guess technically it is feasible to use it for parts of game logic or physics or something, that's not really what it is intended for, and using it for that while you also have graphics for the GPU to process would probably just slow things down.

OpenCL is a general language, it is just marketed as an alternative to CUDA. It can be used to program anything that can add 2 + 2.
I've seen enough threads like this over the last decade, that I can confidently say there is about a 2% chance this game ever actually gets built.

The single biggest flaw is that you're already talking about what languages to build the game (hint: languages don't make a damn bit of difference) and you haven't talked at all about what the game will be like.

I'm not criticizing... just pointing out that we've seen this pattern before.

In all honesty I don't care, If I did well in the Scholarship exam I can skip level 100 papers altogether. I was just asking for an opinion. But I think you're right on the money for this going down the gurgler. They chickened out of the Scholarship exam, and all it was is basic theory and experienced programming.

I haven't done any of the planning I've just been asked to make a Mac Version. I was thinking of Making games with my sister but I'd be better off making websites for money.

Oh and just because I can, have you ever seen an advanced 3d shooter coded in Basic?

Cromulent
Nov 7, 2009, 12:38 AM
OpenCL is a general language, it is just marketed as an alternative to CUDA. It can be used to program anything that can add 2 + 2.

OpenCL is not a language. It is an API.

Although it did require the addition of one or two things to the C language, calling it a language is probably taking it a bit far.

MorphingDragon
Nov 7, 2009, 01:10 AM
OpenCL is not a language. It is an API.

Although it did require the addition of one or two things to the C language, calling it a language is probably taking it a bit far.

I call openGL a language too, its just habit. I suppose I should stop it when I go to Uni.

lee1210
Nov 7, 2009, 09:53 AM
My previous post was made lacking some of the details you've provided since then. If you have a whole year, this seems a lot more feasible. You really need to exercise project management and design for a long project like this. Personally, I would decide amongst the three of you whose going to be the "lead", that will deal with tracking project milestones, etc.

You need to set up source control, plan goals along the way (a single, 1 year goal of completing a game on 3 platforms is not realistic, you need to break the tasks down), divide the tasks up, etc. There's going to be a lot more than coding required to get this project done. There's going to be a lot more project management, design, engineering, etc. to get all of the pieces put together, etc.

There are corollary tasks for a game that may be difficult. Level design, art design, etc. which really aren't skills that come along with being a good programmer. If you have some people you know that have some of these skills (Art is probably easier than level design...), recruit them to help. Maybe ask around at the art dept. of the school to see if they have anyone that could get some credit for providing digital art for such a project.

I would spend at least a few weeks, if not a month or so, doing nothing but planning. Researching the tech that best suits a cross-platform project like this, deciding how you can use them together, deciding the "rules" for the game, how the collision detection should work, tracking of statistics (health, score, experience, whatever you want in the game), drawing up what the UI will look like, etc.

This sounds very ambitious, but i hope you and your friends can pull it off. Good luck!

-Lee

MorphingDragon
Nov 7, 2009, 03:30 PM
My previous post was made lacking some of the details you've provided since then.

Yeah, I have a really bad habit of doing that. :o

admanimal
Nov 7, 2009, 10:27 PM
OpenCL is a general language, it is just marketed as an alternative to CUDA. It can be used to program anything that can add 2 + 2.


Actually, no. There is a very specific type of parallel computation that can be effectively accelerated by OpenCL, and it's not a type that is normally found in game logic. Basically you need to be able to represent your computation as a kernel function applied to a matrix or vector.

OpenCL and CUDA are only "general purpose" in the sense that you can use them to reap the benefits of massively parallel GPUs for things other than just graphics...but they still have to be parallelizable computations.

MorphingDragon
Nov 8, 2009, 04:13 AM
Actually, no. There is a very specific type of parallel computation that can be effectively accelerated by OpenCL, and it's not a type that is normally found in game logic. Basically you need to be able to represent your computation as a kernel function applied to a matrix or vector.

OpenCL and CUDA are only "general purpose" in the sense that you can use them to reap the benefits of massively parallel GPUs for things other than just graphics...but they still have to be parallelizable computations.

OpenCL can be used to program the CPU as well. For a Sidescroller it would be overkill but not for something that has incredibly complex Physics or AI it would be an option.

Catfish_Man
Nov 8, 2009, 12:00 PM
I'd be interested to see which (if any) AI algorithms vectorize properly. Neural nets maybe?

admanimal
Nov 8, 2009, 06:51 PM
I'd be interested to see which (if any) AI algorithms vectorize properly. Neural nets maybe?

My point exactly...just being "incredibly complex" doesn't mean you can implement something effectively with OpenCL- it has to be (ideally very) parallelizable in order for there to be any point in using OpenCL for it.

autorelease
Nov 8, 2009, 07:02 PM
OpenCL can be used to program the CPU as well. For a Sidescroller it would be overkill but not for something that has incredibly complex Physics or AI it would be an option.

Argh, yet another person who misunderstands OpenCL.

Yes, OpenCL kernels can run on a CPU. Yes, the OpenCL kernel language is similar to C. However, OpenCL has no interactive capabilities. It's impossible to write an entire game only in the OpenCL kernel language!

OpenCL kernels are not full programs. An OpenCL kernel is basically a single function, that gets run on multiple pieces of data. While it's possible to add looping and branching, OpenCL will terminate execution of a kernel if it takes too long.

So OpenCL is basically "a scripting engine for parallel computation." The kernel language is "general-purpose" in the sense that it's Turing-complete, but the restrictions imposed on OpenCL kernels limit its functionality. You can use OpenCL to handle certain subtasks in a game (image processing, particle effects, pathfinding, etc.), but the statement "I'm going to write a game in OpenCL" makes no sense.

MorphingDragon
Nov 8, 2009, 09:53 PM
I'd be interested to see which (if any) AI algorithms vectorize properly. Neural nets maybe?

You could do it the same way ID programs the AI for doom. Step on location, monster attacks.

MorphingDragon
Nov 8, 2009, 10:03 PM
"I'm going to write a game in OpenCL" makes no sense.

Hah, its all in interpretation. Ah the english language. :rolleyes: I'm well aware of What OpenCL is.

Oh and, I had a talk to the other two guys. We had an idea and talked to our Computing teacher for the last time *Sniff. We ended up with C++ Core with SDL with the AI, controls, sound etc. But Image rendering would be a local library so Cocoa/.Net/QT etc. We figured it would be easier than all of us learning OpenGL and GL Bindings. While The core was being written by John, me and Jake would work on Game Design.

admanimal
Nov 8, 2009, 10:27 PM
I'm well aware of What OpenCL is.



Your responses strongly suggest otherwise, but whatever. Good luck with your project.

chrono1081
Nov 9, 2009, 07:52 AM
I've seen enough threads like this over the last decade, that I can confidently say there is about a 2% chance this game ever actually gets built.

The single biggest flaw is that you're already talking about what languages to build the game (hint: languages don't make a damn bit of difference) and you haven't talked at all about what the game will be like.

I'm not criticizing... just pointing out that we've seen this pattern before.

+1

Honest questions: Have you ever made a game before? I would suggest if you are making it on windows, linux and mac go with C++ and SDL w/ OpenGL for hardware accelleration (yes SDL claims hardware accelleration but OpenGL is MUCH better).

Now, that being said if you have never used C++ its going to be a pain in the ass to get a game up and running with it. Not only will you need to learn it with all of its "gotchas!" but you will also need to build an SDL/OpenGL framework if that is what you are using then make the game. This will take quite a while...

wrldwzrd89
Nov 9, 2009, 08:04 AM
Just as a note, if you're going to be developing an SDL-based game that targets Snow Leopard, do NOT use SDL version 1.2.13 or earlier! You need SDL 1.2.14 or later to target Snow Leopard.

mongrol
Nov 9, 2009, 04:48 PM
Just as a note, if you're going to be developing an SDL-based game that targets Snow Leopard, do NOT use SDL version 1.2.13 or earlier! You need SDL 1.2.14 or later to target Snow Leopard.

Drop SDL. Use C++ and SFML. This get's you cross platform support and openGL acceleration built in. Quicker, easier and let's you concentrate on the game rather than the gfx engine.

wrldwzrd89
Nov 9, 2009, 04:56 PM
Drop SDL. Use C++ and SFML. This get's you cross platform support and openGL acceleration built in. Quicker, easier and let's you concentrate on the game rather than the gfx engine.
SFML? I've not heard of this. I program, so I'm interested. Link me up!

mslide
Nov 9, 2009, 05:24 PM
But Image rendering would be a local library so Cocoa/.Net/QT etc.

Have you considered using Qt for all platforms (and not using SDL, cocoa, .net, etc)? I've never developed any games using Qt, but I use it a lot for all sorts of different applications on windows, macs and linux. If you did decide to use OpenGL, it supports that as well. You could probably do the whole game without having a single line of platform specific code with C++/Qt. Even better if you all can decide on a common build system. For example, I use cmake and that can generate makefiles, xcode project files and visual studio project files.

Good luck with your project. Unless you wanted to do otherwise for a learning experience, I see little reason why you would have to use platform specific libraries or frameworks.

chown33
Nov 9, 2009, 05:49 PM
SFML? I've not heard of this. I program, so I'm interested. Link me up!

If only there was a way to search the internet by entering words like "sfml" in a small text field, then pressing a button labeled "I'm feeling lucky"...

wrldwzrd89
Nov 9, 2009, 06:28 PM
If only there was a way to search the internet by entering words like "sfml" in a small text field, then pressing a button labeled "I'm feeling lucky"...
Just searched Google for SFML, the library is in exactly zero of the top ten results. Searching for "SFML Library" is even less helpful... suffice to say, I cannot find it. :o

Eric5h5
Nov 9, 2009, 09:16 PM
Just searched Google for SFML, the library is in exactly zero of the top ten results.

Er...no. It's in 7 out of the top 10 results, including the first 4.

--Eric

MorphingDragon
Nov 10, 2009, 12:12 AM
Dp

MorphingDragon
Nov 10, 2009, 12:14 AM
+1

Honest questions: Have you ever made a game before? I would suggest if you are making it on windows, linux and mac go with C++ and SDL w/ OpenGL for hardware accelleration (yes SDL claims hardware accelleration but OpenGL is MUCH better)..

We'd have to learn OpenGL. We already know (mostly) local rendering libraries. Yes I have made games before, granted they were in VBasic.

Now, that being said if you have never used C++ its going to be a pain in the ass to get a game up and running with it. Not only will you need to learn it with all of its "gotchas!" but you will also need to build an SDL/OpenGL framework if that is what you are using then make the game. This will take quite a while...

I did a tiny bit of C++ learning how to integrate it in Obj-C++. I'm not writing the C++ code.

Drop SDL. Use C++ and SFML. This get's you cross platform support and openGL acceleration built in. Quicker, easier and let's you concentrate on the game rather than the gfx engine.

Are there any other advantages to SFML? Mature Code > Slightly more features that could be replicated easily.

chown33
Nov 10, 2009, 12:46 AM
Er...no. It's in 7 out of the top 10 results, including the first 4.

Which makes the "zero of the top ten" comment by wrldwzrd89 rather odd.

And the search terms SFML Library increase the relevance of search results, not decrease it: no more Seafloor Mapping Lab or Skyline Freight & Management Ltd.

Even more oddly, I can't get it to change much:

Original English-language results: http://www.google.com/search?hl=en&q=sfml

French: http://www.google.com/search?hl=fr&q=sfml

Spanish: http://www.google.com/search?hl=es&q=sfml

Russian: http://www.google.com/search?hl=ru&q=sfml

Hebrew: http://www.google.com/search?hl=he&q=sfml

So if wrldwzrd89 would please post the URL of the "zero hits" search results, I'd be interested in what search parameters lead to such a huge difference in results. I wonder if it's due to language, regional, or some other difference.

GorillaPaws
Nov 10, 2009, 02:11 AM
I wonder if it's due to language, regional, or some other difference.

Also, if he's signed in to his Google account when conducting a search, Google tries to tailor it's results to you based on a bunch of other variables I believe. Perhaps this is an example of this technology being more harmful than helpful.

wrldwzrd89
Nov 10, 2009, 08:02 AM
Which makes the "zero of the top ten" comment by wrldwzrd89 rather odd.

And the search terms SFML Library increase the relevance of search results, not decrease it: no more Seafloor Mapping Lab or Skyline Freight & Management Ltd.

Even more oddly, I can't get it to change much:

Original English-language results: http://www.google.com/search?hl=en&q=sfml

French: http://www.google.com/search?hl=fr&q=sfml

Spanish: http://www.google.com/search?hl=es&q=sfml

Russian: http://www.google.com/search?hl=ru&q=sfml

Hebrew: http://www.google.com/search?hl=he&q=sfml

So if wrldwzrd89 would please post the URL of the "zero hits" search results, I'd be interested in what search parameters lead to such a huge difference in results. I wonder if it's due to language, regional, or some other difference.
Well that's odd. I repeated my search on a different computer. Top hit is the library. Must be something screwy with my home Mac, which I used to do the first search.