GSoC project: Hedgeroid Netplay - frontlib progress

Hello again.

Over the last weeks, I have been busy working on the new frontend library (frontlib for short), which is written in plain C for best portability. By now, the scope of the library has become clearer, so I want to give a short overview of what it will look like, what already works, and what still needs to be done. As you can see in the image above, one of the things that already work is the map preview rendering.

In my last blog entry, I wrote that there would be a function for each kind of message that could be sent to the engine or the server, and a callback function for each kind of message that could be received. Since then, I have become convinced that this low-level approach is not a good idea, since using a library with that API would not actually save much work.

The first important change is that the frontlib now contains data structures that can hold all important game configurations: The choice of map, team and hedgehog information, game and weapon schemes. It can also read and write .ini files with these settings, so it now handles more than just networking.

As a consequence, the frontend can now quickly build a game configuration by loading weapon schemes and other settings from .ini files, and then ask the frontlib to pass this entire configuration to the engine. The same data structures will also be used for netplay communication, so it will be easy to tie everything together and e.g. start the engine with game settings received from the server.

To start a new game, the frontend can now pass the entire configuration to the frontlib at once, and let the frontlib work out how and when it needs to be sent to the engine. Likewise, the callback functions have changed in keeping with this higher-level approach. For example, the engine sends several different messages to inform the frontend about the statistics: Which team won, who did the most damage in one shot and other data you can see on the statistics page after each game. Instead of providing a callback for each of these messages, the frontlib will aggregate the information in a data structure and pass this to a single "onStatistics" callback function once the information is complete.

At the moment, there is still a large TODO comment in the code where this statistics feature should be. However, most of the work for interacting with the engine is already done and working. The frontlib can already start different types of games, record and play demos as well as store and load savegames. The "map preview" feature, which lets the engine render a small image of the map when you set up a game in the frontend, is completely implemented and working.

On the other hand, the server communication, which is a fairly significant part of this library, still needs to be written. According to my original schedule, the library should be finished by the end of this week, but I might have to extend this by a few days. After the frontlib is done, I can start integrating it into the Android port to implement netplay.

To give an impression of how the frontlib will be used from the frontend code, here is the testing code that was used to create the map image above. You can also click that image to see the actual text output.

I downloaded Hedgeroid on my dad's new android and it works very nicely! Big Grin

Quote:

Tell me about the Hedgeroid? I never heard this game Sad Smiley

But great Big Grin :D

Quote:

Tell me about the Hedgeroid? I never heard this game Sad Smiley

But great Big Grin

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]