Hello everyone. Now that the Summer of Code has been over for a while, it's time to finally give you the promised demo of my Android netplay project.
The demo allows you to play Hedgewars online on your Android phone/tablet, both with people running the same demo or a current Win/Linux/Mac nightly build. Please keep in mind that new nightlies may not be compatible with this demo, so I have put the current Windows and Mac builds up for download as well. This allows you to test Hedgeroid cross-platform play against a compatible version.
The size is way up from the alpha release on the market, because this demo includes all the game data needed for online games. I only left out the music, because that would have blown it up to twice that size. When you first start the game, it will copy all the assets to SD card as well, which can take a while. This is not an ideal state of affairs, but it should be good enough for the purpose of this demo.
As with the last demo, you will have to uninstall the market version before installing this one, because it is not signed with Xeli's key. Also as last time, this demo comes with no warranty, so if your phone melts as a result of running it, please don't blame me - it's my first Android project. That said, my tablet and phone are still very much working, and the app doesn't ask for the DEVICE_MELTDOWN permission anyway.
It has been quiet for a long time now, while I withdrew into a deep and mysterious cave to learn the mysteries of Android development. Now I have finally returned (and shaved), and can show you the first results of my project that are actually interesting to all you Android users.
This .apk (Android app package) is a snapshot of the current work and allows you to connect to the lobby to chat, and to get information about players and rooms. There have also been a few improvements to existing parts of Hedgeroid. For example, the main menu is a bit prettier, and the initial moving of the game assets to the SD card is now a lot faster. You cannot enter rooms or join games yet - that will be the work for the next weeks, but it is mostly user interface work now.
To install the app, you have to uninstall the Alpha from the market first, and you have to allow installing apps that are not from the market. Select Network Game from the menu, enter your username (and your password if needed) and test away.
You will stay connected if you leave the lobby screen via the home button or switch to a different task (e.g. to read an SMS). To disconnect, either use the back button or the "Disconnect" option from the menu. I plan to add an indicator that will remind you the connection is still running, though it should not eat much battery, and turning your screen off for a while should disconnect you as well.
I'm looking forward to your feedback. Have fun!
It has been a while again since the last blog post, and there has been a lot of progress. Almost everything in the new frontend library works now, and to test the library and how much it will simplify creating a new frontend, I quickly hacked together a "toy" frontend running in the Windows console.
It's not full-featured, but you can chat, join a room, add teams, and then play. You will even see a small ascii-art preview of the generated map. You can't create rooms though.
The frontend is Windows-only at the moment (wine does not seem to like it much, either), and the frontend+library are hardly tested at all. In other words, I take no responsibility if you decide to try it out yourself.
If that does not scare you off, you can download the console frontend here and extract all files it into the "bin" directory of a nightly build. Start the consoleclient.exe and enter your username. You will be connected to the hedgewars server, and the available commands will be explained.
To add a team to a room with the /addteam command, there has to be a file with the name
Due to the (cheap) way this frontend is written, you don't have much time to type your commands. Once you start pressing keys, a prompt with your nickname appears, and the frontend stops reacting to anything but your input until you press enter. The server does not like that though, and if it has to wait too long for a reply it will disconnect you.
It is probably helpful to start the normal frontend as well, so you can see what you are doing, and to create a room to test in.
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.
It has been a while since I introduced my project, and I hear that some people are keen to find out what I have been up to so far. Unfortunately, I was very busy during the community bonding period before the official start of the GSoC this week, finishing my university work and moving out of the shared student apartment. This is now all wrapped up though, and I have started working on netplay for Android.
As the first step, I am working on a change that is completely invisible to the player, but will make it easier to implement netplay for iOS and other platforms.
In order to support netplay, the frontend of Hedgewars needs code to communicate with both the server and the game engine, and to pass messages between the two. This code needs to do the same on any platform, but right now the frontend is developed separately for PC, iOS and Android. So, to avoid duplicate work for every frontend, I am working on a portable library that can handle the low-level networking and parsing of messages for all frontends.
So far, I have discussed options for the implementation of this library, tried to find the best networking library that works on all platforms, and decided to use C/C++ combined with SDL_net unless I hit serious problems with it. The big upsides of SDL_net are that it is easy to use, very portable, and we already use it in the game engine, so it does not add a new depencency. On the downside it does not support IPv6, but I hope that this will be added once IPv6 becomes more widely used.
Next, I will look through the existing source code to understand and document the current protocols used between frontend and engine, and between frontend and server.