gremlins
Posts: 2
Joined: Mon Feb 02, 2015 12:25 am

Game programming, some questions on direction to go.

Mon Feb 02, 2015 12:41 am

Hi!

I'd like to learn game programming on the Raspberry Pi. Last game I programmed was back in College... so it's been awhile.

Here's my dilemma...

I know Oracle provides it's version of Java for the RPI and I originally thought about using Java because of past experience with the language. When I think about it though, being that I'm dealing with roughly the equivalent of a 300mhz pentium, maybe learning and using C++ would be better.

Would I be better off in using C++ than Java? or would Java be a good choice for this platform?

User avatar
SpazzTechTom
Posts: 15
Joined: Sat Jan 31, 2015 12:50 am
Location: Glen Rock, PA. USA
Contact: Website

Re: Game programming, some questions on direction to go.

Mon Feb 02, 2015 3:38 am

I was wondering the same thing myself a while back. Although I was trying to decide between C and Python. I have played with C, C++, Java, C#, Python, and Objective-C. I have to admit I like Java, but its hard to beat C for pure performance. Since performance could be an issue on the Pi as you point out, its hard to beat C. Although, for making GUI's its hard to beat Java or Python for ease of use. So I'm considering combining C with Python for some projects I have planned.

I have clocked C vs Python by toggling GPIO with both and measuring the signal with my oscilloscope. C is not just a little faster, its like 100+ times faster. I measured it. Here is a link to my oscilloscope plots and the code I used to compare Python with C by toggling a GPIO pin:
http://www.spazztech.com/python-vs-c-on-rpi.html

However, making a GUI in C might take a little more effort than makes sense.... unless someone has a good C library for this they want to share. So I'm thinking of making GUI's with Python and handling the underlying logic flow with C code. Since Python is extensible with C, I think this should work out well. Although, I admit I have not actually tried it yet.

So maybe you could do something similar. Java is great for making the user interface, but maybe handle the program logic with something like C or C++ for performance sake.
SpazzTechTom
Having fun with technology!

gremlins
Posts: 2
Joined: Mon Feb 02, 2015 12:25 am

Re: Game programming, some questions on direction to go.

Mon Feb 02, 2015 4:12 am

Thank you and well noted. I think I may go the C++ route due to the reasons you listed above.

So, when going beyond the normal programming manuals, what would work for OpenGL ES? I know that one would need OpenGL ES 2.0 manual and I saw that book for that. Does anyone out there have any great reading or tips for someone just starting out?

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Game programming, some questions on direction to go.

Mon Feb 02, 2015 6:34 am

Have you thought about using an existing game engine ?
This might save you some work.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Beginners”