I think I got together all of the pieces of game-making.
Compilation: From the start, the compiling tool was going to be make, which was simple. (Compiling a Libretro core only needed “make -f Makefile.libretro” or even just “make”!) CMake was too complicated, while Bazel needed the horribly insecure Java. The actual compiler I would use was Clang on top of LLVM. My reason is that LLVM/Clang seems to be compatible with projects that work with GCC, the standard of compilation in C, but brings its own benefits, including keeping closer to the original code in compilation while managing better performance. I am new to makefiles or actually knowing compilers, but I found this tutorial which makes things look actually possible.
Networking: Though Libretro has netplay, there are at least a couple of problems with their current implementation.
- The way Libretro’s netlag-hiding works is that, during netplay, Libretro constantly makes savestates. If the savestates of the players are out-of-sync, Libretro loads the last savestate when they were in sync then continues normal gameplay. Notwithstanding that any core I would make would have to support savestates which themselves require serialization, the savestates have to be a certain size, meaning that even Nintendo 64 and Playstation 1 emulators cannot use netplay.
- Libretro’s netplay seems to be modeled after a home console (multiple players playing on the same system that runs one game) instead of a handheld (multiple players using their own systems that run their own games and connect each other in some way). Driving home this point is the Libretro crew specifically saying that you cannot trade Pokémon through netplay. This is a problem because one of my games Wuu Shyng, is a spiritual successor of Pokémon. Netplay is, therefore, a big concern with me.
While the FAQ list implies that the Libretro crew is going to make a new form of netplay, I decided that the better option would be to not use on Libretro’s netplay at all and instead use an external library, though I would take cues from Libretro’s implementation of netplay in anticipation of compatibility with any future implementation that may work with me. After browsing the Awesome C(++) list for network tools that use TCP (the protocol that Libretro uses), I decided that Mongoose was the best option due to its small size, ease of implementation, and, most importantly, ease of use.
Cutscenes: I decided from the get-go that the files are going to be .ogg files that use Vorbis audio and Theora video, both of them being open-source standards of lossy audio/video. (I could use lossless formats, but I want to keep my games small, especially when you consider that Retroarch has been ported to the PSP and 3DS.) Actually playing those videos is another matter. While I initially looked into using the libraries themselves, their complication combined with my need to implement subtitles (.srt files, by the way, because they are easily written) and the possibility of me needing to add more features led to my decision to just integrate MPlayer in my game. MPlayer has a “slave mode” (ew) that makes this possible. The controls look great; I think that I can have player control the video through their controlers. The one thing that bothers me here is that there is no way of doing a frame-step backward. After looking into how that mode works, I decided to simulate a frame-step in either direction by telling MPlayer to rewind or fast-forward by a fraction of a second, that is, how long does playing a frame take.
|Frames Per Second||Seconds of a Single Frame|
The small, finite numbers, combined with how much less work would manually animating things be, led to my decision to make files at 25 frames per second. That suits me just fine; I actually do think that PAL, the European analog television system and source of the 25 fps standard, is “Peace At Last”!
That being resolved, my only real issue here is how I would get MPlayer to display to either SDL2’s SDL_Surface or Libretro’s video_cb, unless MPlayer already takes care of that. If I resolve that, then I finally have a complete framework from where I can make Libretro games free from Lua.