Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Pong game

This thread is locked; no one can reply to it. rss feed Print
Pong game
iheartcoffee
Member #16,518
August 2016
avatar

Hi,
I'm interested in developing a small pong game as a hobby project. I have some experience in programming (1st year Comp Sci). However, I currently only know Python 3. I was thinking of learning C or C++ but I'm not sure which would be best suited for use with Allegro. Looking for advice :)

pmprog
Member #11,579
January 2010
avatar

Have you done object-orientated programming in Python? If no, try C; if yes, try C++

Allegro is written in C, and can be used in the same way in both C and C++... The only difference would be your code interacting with Allegro.

Also, according to the bindings page Allegro already comes with a Python binding. So you could continue to use Python if you wanted

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

pmprog said:

Have you done object-orientated programming in Python? If no, try C; if yes, try C++

^^^

C++ and Java and C# are similar. C is included (mostly) in C++, if you want to be --pedantic about it.

The first three emphasize OOP. C does whatever you want if you know what you're doing. It's all implemented the same under the hood anyway.

But aside from that, I'd say work with Python for a while. If the Python Allegro binding doesn't work out, there's also PyGame, which I've heard mixed things about.

amarillion
Member #940
January 2001
avatar

Honestly, it doesn't matter that much.

Both C and C++ will work. But they will teach you different programming styles.

If you really want to learn some new skills, do both. First do it in C, then in C++. As you learn more languages, you'll learn that some parts of programming are universal, but you'll also learn the differences in emphasis between the different languages.

bamccaig
Member #7,536
July 2006
avatar

Elias has Python bindings for Allegro 5 that I think ship with the distribution (not sure on the details for various platforms, but Elias offered this pregenerated copy on IRC: http://allegro5.org/allegro.py). If you have trouble with it you can post here or join the #allegro IRC channel on the freenode network and ask there. Since you already know Python it might be best for you to avoid overwhelming yourself with too much to learn, and stick with Python for now. Your current goal is most likely to create games, not to learn an ancient, overly complex programming language that you most likely won't need in your professional career.

C and C++ are quite dated these days, and there are several modern languages battling it out right now to replace them. It probably doesn't make a lot of sense for you to learn either at this point. There's still value in knowing them if you're going to be a systems level programmer, or will be actively contributing to open source projects that are already using them, but otherwise you'd be better off spending your time learning newer tech. Especially for a first year student I'd encourage you to focus on learning things that are more relevant to today.

Append:

Actually I think the Python bindings are really just function exports and so you'll still need to manage Allegro resources/memory manually in Python... Which is rather unfortunate. Despite that hurdle it's probably still less to learn if you go with Python.

RmBeer2
Member #16,660
April 2017
avatar

If you want to learn what is universal in all languages, you don't need to learn all languages, just the flowchart.

I am disappointed in the stupid comments from @bamccaig , which has been subjected to negative publicity about programming languages. ¬¬

Do not listen to it, it only says nonsense, C and C++ are universal languages and serve everything, today it is widely used and they will never be obsolete.
Even if you handle C++, the result would be the same and possibly easier with C, especially for the Pong game that you propose.

They can lie to you that one language is better than another, but do not get carried away, the languages considered "modern" are the worst. Avoid using at all costs the Rust, Go, Java, Javascript, PHP, and C#.

🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈

Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024!

bamccaig
Member #7,536
July 2006
avatar

RmBeer2 said:

C is forever. It's great. Believe me. All the people know, it's great. Don't even look at those other, "modern" languages. No good [for me] can come from that.

It occurred to me while doctoring this quote that it sounds like a Trump speech. I am stoned...

pmprog
Member #11,579
January 2010
avatar

RmBeer2 said:

They can lie to you that one language is better than another, but do not get carried away, the languages considered "modern" are the worst. Avoid using at all costs the Rust, Go, Java, Javascript, PHP, and C#

Are you talking language syntax here, or what happens to them to be run on the computer? Also, do you consider the "modern" C and C++ standards part of your C/C++ are great, or "modern are the worst"?

Either way, they all have their pros and cons (I guess Javascript even has a pro? Maybe?).

I work a lot with C#, and in terms of typing/syntax/readability, I much prefer this over C++.
It comes with baggage, and reduced control over things like memory usage. However, you can build a single executable that will run across Windows, Linux, x86, and ARM (which is presumably why Unity picked it).

And let's face it, some times you just gel with a particular thing even if it isn't "the best option".

My honest advice to the op, would be try a few out, and see which you like. Languages are like cars... Once you learn how to drive, you can drive (almost) any, but different cars give you different things (economy, speed, safety)

DanielH
Member #934
January 2001
avatar

There's baggage with every language.

Do a comparison (Pros vs Cons) and choose for yourself.

Ease

Performance
compiled (C/C++,D) > virtual compiled (ie java) > interpreted (ie Python, JS)

Java is compiled but to it's own virtual machine which then has to be translated at runtime.

Garbage Collection
Some like automatic garbage collection. While others believe it makes you a lazy coder.

With shared_ptr and others, there is a sort of 'automatic' garbage collection in C++.

Java is a memory hog and can hold onto the memory in the garbage until needed.

RmBeer2
Member #16,660
April 2017
avatar

@bamccaig : Maybe, but at least I know what's best and I don't get carried away by other people's opinions. ;)

@pmprog : C and C++ (At least the old version of C++), are intended to be a tool and serve the programmer. But all the languages considered modern like the ones I have mentioned are just a spectacle and not a tool. It's like turning a toaster into a Linux machine, a remote control car or even a miniature TV, it's just fun, but it's useless (Although that's what they've done with HTTP and its derivatives, and it's quite a frakinstein monster).
It would be silly to look for the pros and cons because there is nothing to for look, they are simply toys or experiments.

EDIT ========================

I must also emphasize that Python, Perl, and Ruby is also garbage, but that if it can be a personal thought, it may be really useful for others. So I have not commented. Perhaps the most convenient thing is that you learn Python to learn how to program, and then use it forever whenever you want something immediate.

🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈

Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024!

LennyLen
Member #5,313
December 2004
avatar

RmBeer2 said:

it's just fun, but it's useless

Like writing a 486 emulator. ;)

DanielH
Member #934
January 2001
avatar

All languages are garbage except Pascal. Pascal forever!!!

Actually, I like java as a learning tool but would never use it personally. Recently I wanted to expand and a learned Python. Very similar to other languages, but once again I would never use it personally.

Unless I had to. :)

pmprog
Member #11,579
January 2010
avatar

bamccaig
Member #7,536
July 2006
avatar

Quote:

Like writing a 486 emulator. ;)

{"name":"tenor.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/f\/3fb4ba8bc46bebbab3449503d6fe84a5.gif","w":498,"h":278,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/f\/3fb4ba8bc46bebbab3449503d6fe84a5"}tenor.gif

RmBeer2
Member #16,660
April 2017
avatar

DON'T MESS MY 486 SONS OF BITCH!!!!!!

{"name":"1080218_0.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/4\/f4ed60a6a8a155ce4aa7fefea93b9896.gif","w":468,"h":335,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/4\/f4ed60a6a8a155ce4aa7fefea93b9896"}1080218_0.gif

NT: My previous comments is probably not funny at all, which is why I deleted.

🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈

Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024!

Go to: