B
B
baalmor2013-02-02 21:52:37
Qt
baalmor, 2013-02-02 21:52:37

How to write a game server in Qt?

Hello everyone,
I have a task to write a game server for a turn-based strategy. Planned workload of 2000-2500 peak players. The target platform for the server is *nix (most likely ubuntu server, maybe freebsd)
I would like to know if Qt is suitable for these purposes, and what pitfalls may arise? Interested in the following:
Is this tool productive enough for these purposes? (we agree that the developer has direct hands)
Complexity of implementation in comparison with alternative java/C++ tools.
In general, the sanity of the idea. (maybe Qt isn't designed for this and it's worth looking into other tools?)

Answer the question

In order to leave comments, you need to log in

8 answer(s)
R
Riateche, 2013-02-03
@Riateche

I think it will. In the presence of direct hands, Qt does not hold back performance in any way.
Native C++/Qt code will definitely run faster and consume fewer resources than Java. Writing in pure C++ is, in my opinion, more difficult than writing in Qt. As for other C++ libraries, finding a decent alternative is not easy. Qt is an easy to use, well documented, powerful general purpose library. There are many features in Qt that you can use to implement your task (including the aforementioned QTcpServer, as well as tools for parallel computing), which indicates that the tool is suitable for the task.
The complexity of the implementation depends on the experience of the developer. For a developer with more experience with Qt, writing with Qt will be easier than with other tools. For a Java developer, the opposite is true. There is no excessive complexity in Qt, that's for sure.

B
bogolt, 2013-02-03
@bogolt

Qt is not designed for servers. This is a great library for desktop applications.
If you are planning to take Qt to get better control over networking functions then you should consider boost.asio. Its asynchronous interface is much more complex, but the result is worth it. The code is very fast and efficient.
Let me be curious about the network protocol. Will it be bare TCP or something more advanced. If you have not yet decided or have already chosen TCP, I can recommend looking at xmpp. He's just wonderful. True, there are not so many libraries that implement it in C, however libstrophe should be enough.

S
Sergey Lerg, 2013-02-03
@Lerg

Qt for servers is still not sharpened.
Recently, I have been writing network services in Go, it is convenient to write, everything is there, everything is fast, modern.

Q
qxfusion, 2013-02-02
@qxfusion

Qt is C ++ only with MOC
Well, compare it with Minecraft for example - there the server is written in Java (as far as I remember) and everyone is happy :)

C
cyberorg, 2013-02-02
@kyberorg

The performance is about the same, but Qt - after compilation (MOC and GCC ++) it is machine code. Java is JVM bytecode.
To run Qt, it seems that libqt will be needed, for Java - JRE.
the java.net library is a very powerful tool in the right hands.

D
Dmitry Guketlev, 2013-02-03
@Yavanosta

To use a low-level language when you can get by with a manageable, in my opinion, wastefulness, in relation to the programmer's working time. One little memory leak forgotten somewhere will provide you with many hours of debugging. Use C# (mono) or Java.
The load of 2000-2500 is not so prohibitive. As a last resort, make a cluster of n servers. This is much easier than trying to win a few percent of performance using a low-level language, while having a decent chance of getting into a puddle.
To avoid holivars:
I'm not saying that any Java or C# program is as fast as C++. I argue that a _good_ Java\C# program does not last much longer than a _good_ C++ counterpart. Managed languages, like C++, have their own quirks that must be taken into account, and then the performance will be quite decent.

S
sdevalex, 2013-02-03
@sdevalex

If you know Qt well, then there is only one pitfall - you will have to pay money for commercial use.

I
Ilya Kovalevsky, 2013-02-21
@namespace

Qt is a universal tool for developing high-level software products of any scale. Whatever they tell you, don't listen to them.
The nice thing about Cute is that it's plain C++ with cool stuff like signal&slot or qmetaobject. There are different wrappers for almost everything. For example, for std::map there is QMap. There is a bunch of strong different useful functionality.
In addition, Qt is built in such a way that the result is the most low-level bytecode for a given platform.
Good luck :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question