简体   繁体   中英

What do I need to write a small game on Linux?

I want to make a simple game: 2d, single-player, without tons of animations and special effects. I am not interested in ready to use game engines, I want to learn to write some code in a quite universal language. I am using Linux (AMD64) and looking for something easy with nice library for games. I do not want to mix few languages, most of them are in fact fast enough themselves for my needs. Cross platform would be an advantage, however all I need is a good Linux support.

I have been considering few solutions.

Ruby
+ Language looks very nice.
+ I am going to learn Ruby.
- I am afraid I can have problems with additional libraries.
- This thread about game libraries for Ruby could be longer.

SDL + C
+ It is used for games.
+ It is very easy to set up.
+ There is a lot of additional libraries.
+ It is cross-platform.
- The solution is quite low level.
- The language is sometimes quite hard to read.

QT + C++
+ It is very easy to set up.
+ The standard QT libraries supports everything I can possibly need.
+ It is cross-platform.
+ The documentation is good.
- The compilation is slow.
- The language looks horrible.
- The size of standard QT libraries is too big to comprehend.

Environment of web browser
+ I am going to learn something more about this environment.
+ It is somewhat used for games.
+ It is quite cross-platform.
- It would be too much experimental.

Java
+ It is used for games.
+ The standard Java libraries supports everything I can possibly need.
+ It is cross-platform.
- It is quite hard to set up.
- The size of standard Java libraries is too big to comprehend.
- The source code in Java could look better.
- I think I do not want to learn Java.

Google Go
+ I am going to learn Google Go.
- There is big problem with libraries.
- The solution would be quite low level.

Python
+ It looks some people do games in Python, according to this thread .
+ It looks there are probably more libraries than for Ruby.
- The Ruby language looks better.
- I think I do not want to learn Python.

C++ + something else
+ It is used for games.
+ It would be probably cross-platform.
+ There is a lot of libraries.
- I do not need C++ extensions over C.
- Compilation could be slow, there are fast compilers for C, not for C++.

Haskell
+ I am going to learn Haskell.
- Many things about programming computer games looks too much imperative.
- It looks I can have some problems with libraries.
- Compilation (GHC) looks slow.

There is probably something more to consider. Does anyone have experience in making small games for Linux in non mainstream solutions? Does anyone have an advice for me?

This may not be exactly what you were looking for but I would say this is what you need most: "stop planning, start building."

You're trying to compare A to B to C to D, when you apparently don't really know any of them as well as you want.

Start by picking one of them that you want to know (say Ruby, since it's at the start of your list), and start trying to do what you want. You will partially succeed, and partially fail, and both of these outcomes will contribute both the programming knowledge you want, and you'll either finish your game, or gain enough knowledge that you can make an educated choice about moving to another platform.

Some Python recommendations (I seriously think you will not regret it as a language choice ; given your needs):

Pygame would be terrific for writing a small game (especially for 2D). Good (community based) support, documentation, examples, cross-platformness for free...

If you want to go 3D Ogre3D may be worth a look.

Python + PyGame。

Ok. C in general (Visual C#, C++, C, Objective C, and so on) has many pros. It is fast, and I mean fast. However, it takes a while to develop something simple. Java is a cross between C (being hard to learn and taking a while to develop something) and python (lightweight and powerful). Python is what you should learn in my opinion. It is easy to learn. It is powerful. It is lightweight. It is cross-platform compatible. It is flexible. It has so many libraries for it, you shouldn't have trouble finding the right tool for the job. That is my opinion.

I think that Java is the best for making simple programs because it is easy to learn and has lots of support. Eclipse is a good program for compiling and writing Java code. I don't like C++ or C, Java is very good because it can run on any operating system and can make very complicated games like Minecraft or simple like Pac-Man.

there are fast compilers for C, not for C++

This isn't quite right. Rather, there are features of c++ which make for slow compilation. Write c-like c++ and you get just as fast compilation as if you had written plain c in the first place. That's one of the advantages of c++.

Not that a really recommend this, and serious c++ people will wince if you do.

Working in a browser with Javascript and HTML5 is actually not experimental! Since the canvas element was introduced, you can use it to just draw into the browser. A game loop can be implemented by Javascript timers.

With Javascript and HTML5, you can built cross-plattform games without any framework (though you might want to use jQuery or the like for convenience).

About the canvas element:

http://diveintohtml5.ep.io/canvas.html#divingin

I would use Python and pygame. Python is powerful, and is relatively easy to learn. There's lots of awesome resources, and is very versatile. I would suggest the pygame module for graphics. pygame.org has very thorough documentation.

There are so many games that look and feel so many different ways, and so many ways to write them out there. I think it's impossible to know what you have in mind without a thorough explanation of the game.

I think a better approach would be to assume you want to (generally speaking) make a game like some of your favorite games. If this is true, find out what was used to create those games and use the same tools.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM