https://gitlab.com/larienna/javalib_blackbook
Which consist in making a game in terminal mode. Where you play the game through a series of commands. It allows you to play test the design of a game without all the chrome and user interface. In summary, it's a command line string analyzer that launch runnable classes with the game logic in it.
Now I wondered if I could do the same in C for another game of mine in order to tests a series of game logic functions. The idea would be to make a terminal application like MySql, associate each command to a function pointer and launch the appropriate function with the parameters when the command is typed.
So my first questions: Is there any C library that could help make MySql style terminal program?
Since terminal applications are more common in the C and in the linux ecosystem, I though that such library should be more likely to exist in C than in Java.
-------------------------------------------------------------------------------------------------------------------
Then I though further, maybe I don't need to handle the terminal itself. Maybe I could use a command line system like GIT, where I pass the in game commands in parameter to the program like:
Code: Select all
mygame save.file command param1 param2
Second question: Is there any C library that could help making GIT style command line applications?
--------------------------------------------------------------------------------------------------------------------
Third (it's more a reflection than a question), I am starting to gain interest in Kotlin, and I was not sure if I should convert my project above in Kotlin since functions are handled much more easily than in java. That would prevent the need to encapsulate each game logic routines into a class of it's own. Then I made the discovery that Kotlin can launch C functions using the native compiler. So instead of making 2 projects that does the same thing, I could combine both ideas together allowing to run as plain C program or from Kotlin app.
I am not sure if it's portable on Android, I guess so since android has the NDK (native development kit). I am also not sure how both of them could be fusioned. Since I would do a lot of string operation with SQL in the game logic, it should be better to keep the game logic in kotlin for easier string manipulations. Kotlin can also easily be lauched on terminal with kotlin scripts, so maybe the only thing I need is launching C functions from kotlin to test plain C only game logic. Allowing me to reuse the kotlin terminal application for both java/kotlin and plain C projects.