User avatar
Grimmy
Posts: 35
Joined: Sun Jan 19, 2014 2:23 am
Location: The Windy Shitty
Contact: Website

Programming a 2D game. Software suggestions anyone?

Mon Jan 27, 2014 11:11 pm

Hello guys!

I recently received my pi in the mail, and after about two weeks of lurking forums and fiddling with it. I'm finally starting to get the hang of this gadget and am looking for a project to work on.

That being said, I'm posting to see if you guys have any good software suggestions when it comes to programming/developing a 2D video-game using my Rpi unite. Personally, I wanted to try and make a side-scroller type arcade game (Final Fight, Metal Slug, Contra, ets). But in all honesty, I'm blank when it comes to what exactly I should be using and how to get my foot in the door.

So far, I like the idea of using Python and Pygame:
http://www.pygame.org/wiki/about

I also found this tutorial for it (having one is a deal breaker for a noob like me):
http://programarcadegames.com/index.php?lang=en

I heard that the Rpi favors Python as a language, AND I also heard that python is a fairly powerful tool worth getting to know. Plus, the software's compatible with raspbian! But is it the right choice for a noob? How steep is the learning curve? End result worth the hardship? The website has a bunch of good-looking games... but the junk tends to out-weigh the decent material.

I heard someone suggestion OpenGl being a good place to start..

Anyone have any better software/tutorial suggestions?
Anyone using the Pi for something similar?

Thanks ahead of time :D

P.s. I know I'm fairly uninformed about programming, but point me in the right direction and I'll start pushing forward.

P.p.s. I found this article and felt I had to "pass-it-on". It's very comprehensive and applies to the subject.:
http://higherorderfun.com/blog/2012/05/ ... atformers/
Life: the busy idleness.

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: Programming a 2D game. Software suggestions anyone?

Tue Jan 28, 2014 1:31 am

Make no mistake about it, game programming is going to be harder than you think. Having said that though, for a 2d side-scroller like you're describing, IMHO python and pygame are an excellent choice. Although python is slow compared to C++, I found it a nice language to learn, and although the raspi is slow compared to a modern PC, I'm pretty sure you could get a decent side-scrolling beat-em-up or shooter out of it. That article is excellent, btw.

To show you that I'm not competely talking out of my behind, here's what I made with pygame before putting it on hold due to issues. This isn't running on the raspi, and needed to be stripped-back in order to run at a decent speed (though it *did* run, with minimal changes), but a smart guy online says it was very inefficient due to using trigonometry instead of vector maths for the enemy/bullet movements, and it could have ran pretty decently with a bit of tweaking...

www.youtube.com/watch?v=odzhK0dzkJg
note: I may or may not know what I'm talking about...

User avatar
Grimmy
Posts: 35
Joined: Sun Jan 19, 2014 2:23 am
Location: The Windy Shitty
Contact: Website

Re: Programming a 2D game. Software suggestions anyone?

Tue Jan 28, 2014 2:55 am

toxibunny wrote:Make no mistake about it, game programming is going to be harder than you think. Having said that though, for a 2d side-scroller like you're describing, IMHO python and pygame are an excellent choice. Although python is slow compared to C++, I found it a nice language to learn, and although the raspi is slow compared to a modern PC, I'm pretty sure you could get a decent side-scrolling beat-em-up or shooter out of it. That article is excellent, btw.

To show you that I'm not competely talking out of my behind, here's what I made with pygame before putting it on hold due to issues. This isn't running on the raspi, and needed to be stripped-back in order to run at a decent speed (though it *did* run, with minimal changes), but a smart guy online says it was very inefficient due to using trigonometry instead of vector maths for the enemy/bullet movements, and it could have ran pretty decently with a bit of tweaking...

http://www.youtube.com/watch?v=odzhK0dzkJg
My tools of trade are more towards editing/manipulation and animation. That being said, I'll be a bit more handy when the design aspect of the game roles around. But when my pi came in the mail, not only was it far from what I expected, it almost instantly became my new favorite hobby. Long story short, a good challenge will keep my busy for awhile (I just want to know I've got a nice foundation to start with.)

Do you still use pygame? or have you moved on to something else. such as C++? To be honest, I like your game! I reminded me of a old-school zombie shooter. Was it a lot of work/coding? I wish I understood what you mean when you mention "trigonometry" and "vector maths".

Now you say it's not as fast as C++. What do you mean? Like less flowery? Or processing wise?

Last question :P, if one begins to learn python, does it translate well if I ever want to switch to something else? Or is each language it's own?

Thanks you!
Life: the busy idleness.

User avatar
AndyD
Posts: 2329
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Programming a 2D game. Software suggestions anyone?

Tue Jan 28, 2014 4:34 am

Grimmy wrote:Now you say it's not as fast as C++. What do you mean? Like less flowery? Or processing wise?
The differences between languages like Python and C/C++ (and other languages) often causes much heated debate. Python in general runs slower than compiled C/C++ but the difference will depend on a number of things.
Grimmy wrote:Last question :P, if one begins to learn python, does it translate well if I ever want to switch to something else? Or is each language it's own?
If you learn any programming language it will translate into learning other programming languages. Once you have a number of programming languages under you belt then it gets easier to learn new ones.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5531
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Programming a 2D game. Software suggestions anyone?

Tue Jan 28, 2014 5:32 am

Maybe start by making pong. The game logic is simple enough that you can only focus on learning the tools you're using and it won't take long. Then, when you have the basics covered, you will already know how to draw surfaces, move things around, work with variables and so on, and you can focus on implementing the actual game. I think trying to do everything at once can be a little too much. For example, you can have a simple goal, like being able to run around on a single screen map. When you have that, add simple physics and collision detection, then shooting and dumb enemies, then focus on the AI and then finally level design. Then you can slowly build it up from there. That way, each goal is manageable and you can feel yourself progressing towards the final goal. Anyway, that's just a few tips.

As far as the tools you should be using, it really doesn't matter. They will all do the job. Whether you choose python and pygame, C/C++ and SDL or C#, you'll learn a lot and it will be easier to pick up any other language. Once you are comfortable with a programing language, learning others is a matter of getting the syntax right and maybe picking up some new concepts. The hard part of programming isn't learning the language, but learning a new way of thinking.

Jkwiseman465
Posts: 1
Joined: Tue Jan 28, 2014 8:18 pm

Re: Programming a 2D game. Software suggestions anyone?

Tue Jan 28, 2014 8:25 pm

Pygame is great but you whatever you program in you will learn a lot . :shock:

paulie
Posts: 260
Joined: Thu Jan 19, 2012 6:51 pm

Re: Programming a 2D game. Software suggestions anyone?

Tue Jan 28, 2014 10:20 pm

Just did apt-get install xscreensaver-data-extra xscreensaver-gl and discovered there's a 'missile command' screen saver!
Four bases to defend, with nukes raining down to be shot at.

http://en.m.wikipedia.org/wiki/Missile_Command
It has been my custom to use Xeyes

User avatar
peepo
Posts: 305
Joined: Sun Oct 21, 2012 9:36 am

Re: Programming a 2D game. Software suggestions anyone?

Wed Jan 29, 2014 8:21 am

for openGLES 2.0 on RPi you may like https://github.com/peepo/openGL-RPi-tutorial

its a way to gaming, and if you are thinking camera in game....

let me know if you do go this route, as most of the openGL guff is 3d and I'm also more interested in 2d just now

Jonathan

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: Programming a 2D game. Software suggestions anyone?

Wed Jan 29, 2014 10:11 pm

It's also worth having a look at the source for the pi3d library - https://github.com/tipam/pi3d

That's probably what I'm going to be using for my next big project, which will be a pong console, complete with home-made paddle controllers... 8-)
note: I may or may not know what I'm talking about...

Fidelius
Posts: 418
Joined: Wed Jan 01, 2014 8:40 pm

Re: Programming a 2D game. Software suggestions anyone?

Thu Jan 30, 2014 10:39 am

Grimmy, I think the new hardware accelerated JavaFX library which is a part of the upcoming (March 2014) Java 8 is very attractive also to game programmers, because it's relatively easy to learn and use.
The Java 8 early access (EA) version runs nicely on the Pi. Judging from its 3D examples which I've seen so far, I think it's able to also provide large 2D sprites, like those in your mentioned Metal Slug... :-)

User avatar
peepo
Posts: 305
Joined: Sun Oct 21, 2012 9:36 am

Re: Programming a 2D game. Software suggestions anyone?

Thu Jan 30, 2014 12:11 pm

openVG is also possible, it just depends on your interests and abilities.

http://www.peepo.co.uk hosts and links to quite a number of SVG games,
i suppose would translate to openVG with little effort.

~:"

Fidelius
Posts: 418
Joined: Wed Jan 01, 2014 8:40 pm

Re: Programming a 2D game. Software suggestions anyone?

Fri Feb 14, 2014 11:30 am

So, Grimmy, could you find a favourite tool to evaluate your game idea?

In order to evaluate it ("I wanted to try and make a side-scroller type arcade game"), I did a simple sprite test on the Raspberry Pi, using Java 8_beta and its build-in Javafx library, which draws hardware accelerated polygons on the Pi via OpenGL-ES, i.e. flat texture rectangles in our case. To make it look more interesting, I borrowed a few sprites from a friend's video-game. :-)

Here's the little test's video.

Image

To get 60 fps, a few compromises were necessary: many small sprites stress the Pi more than fewer bigger sprites, as do large alpha masks, etc.
So, a R-Type or Metal-Slug game is technically possible on the Pi, in high-resolution at 60 fps and in a high-level programming language like Java. Still, a full game with sound and logic needs a cleverly optimised implementation to run smoothly on the Pi. But the basics work, i.e. pixel shifting here, which would probably represent 75%+ of the final game's load.
Last edited by Fidelius on Fri Feb 14, 2014 3:03 pm, edited 5 times in total.

kindydevel
Posts: 1
Joined: Mon Nov 27, 2017 10:39 pm

Re: Programming a 2D game. Software suggestions anyone?

Mon Nov 27, 2017 10:45 pm

I am making 2 d platformers about 2 years , I think u should also ask some details in stackoverwflow , it's very useful resource I think ,
btw also can share high quality]sound effect pack for ur game

https://stackoverflow.com
https://www.lucidsamples.com/sound-effe ... undle.html

User avatar
Nfarrow
Posts: 47
Joined: Sat Dec 20, 2014 1:24 am
Location: Oklahoma, USA
Contact: Website Facebook Twitter YouTube

Re: Programming a 2D game. Software suggestions anyone?

Mon Jun 25, 2018 12:51 am

Well, I do have some bad news if you want to program your game in pyGame to run on python3. I was working on an RPG typestyle and since pygames doesn't use SDL 2 it really only uses one core and only SDL v1. I got as far as adding background tiles(animated) and it was unplayable.


https://www.instagram.com/p/Bj9djwBHiID ... gievampire

My personal code example. (Animation and movement of the player)
https://gist.github.com/VeggieVampire/8 ... 541a744ee
Twitter: @farrownick
Instagram veggievampire
I own a lot of Pis....

User avatar
Imperf3kt
Posts: 1915
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Programming a 2D game. Software suggestions anyone?

Mon Jun 25, 2018 1:00 am

Nfarrow wrote:
Mon Jun 25, 2018 12:51 am
Well, I do have some bad news if you want to program your game in pyGame to run on python3. I was working on an RPG typestyle and since pygames doesn't use SDL 2 it really only uses one core and only SDL v1. I got as far as adding background tiles(animated) and it was unplayable.


https://www.instagram.com/p/Bj9djwBHiID ... gievampire

My personal code example. (Animation and movement of the player)
https://gist.github.com/VeggieVampire/8 ... 541a744ee
This thread is several years old.

As to using SDL2, why not use Ren'Py?
Pygame SDL2 was written by the same person who created Ren'Py (Tom Rothamel), helping make Ren'Py work reasonably well on a Raspberry Pi 3B.


Note that the version in the Repos is outdated and experimental. Visit Renpy official website for more information.
Google is ubiquitous - learn to use it!
https://opensource.com/life/16/10/how-ask-technical-questions

User avatar
Gavinmc42
Posts: 2619
Joined: Wed Aug 28, 2013 3:31 am

Re: Programming a 2D game. Software suggestions anyone?

Mon Jun 25, 2018 3:01 am

Wow, lets dig up old threads ;)

I started with Python and Pygame, ok for simple stuff if a bit dated.

But I have been using Free Pascal in Ultibo for baremetal programing for the last two years.
The Lazarus/FPC system allows for very fast development.

Finally got around to 2D in the last year- OpenVG turned out to be easier than I thought.
But 3D has stumped me until recently.

I am still trying to get it installed ( er started last night) :oops:
But the Castle Game Engine is looking very interesting.
https://castle-engine.io/
Perhaps one day I will understand it enough to port it to Ultibo ;)

You can start out slow and reinvent the wheel and learn a lot.
But there comes a time you just want to make the game not make the tool to make the game.

The Castle Game Engine runs on most hardware/OS and because it is based on FPC it should work even on Pi's.

On the other hand Tim is making recent progress.
viewtopic.php?p=1327550
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “General discussion”