I've got a project to create a roguelike that in some way abstracts the UI from the engine and the engine from map creation, line-of-site, etc. To narrow the focus, i first want to just get the UI (player's client) and engine working.
My current idea is to make the client basically a program that decides what one character (player, monsters) will do for its turn and waits until it can move again. So each monster has a client, and so does the player. The player's client prints the map, waits for input, sends it to the engine, and tells the player what happened. The monster's client does the same except without printing the map and using AI instead of keyboard input.
Before i go any futher, if this seems somehow an obfuscated way of doing things, my goal is to learn, not write a roguelike. It's the journy, not the destination.
And so i need to choose what form of ipc fits this model best.
- My first attempt used pipes because they're simplest and i wrote a UI for the player and a program to pipe in instructions such as where to put the map and player. While this works, it only allows one client--communicating through stdin and out.
- I've thought about making the engine a daemon that looks in a spool where clients, when started, create unique-per-client temp files to give instructions to the engine and recieve feedback.
- Lastly, i've done a little introductory programing with sockets. They seem like they might be the way to go, and would allow the game to perhaps someday be run over a net. I'd like to, if possible, use a simpler solution, and since i'm unfamiliar with them, it's more error prone.
- I'm always open to suggestions.