I'm looking for advice on the best way to create a new bundle -- to support a play by mail game. There are a number of similar games like this, like Starweb (Flying Buffalo) and RSWGame. They send out reports on the worlds and fleets you own. Players decide want to do, and send in their orders. Repeat until someone wins.
I already have a bunch of tools to help me manage my resources, but I was wondering if I could tie them into a bundle to make the the process even easier.
So far, I've been thinking of treating the text file I'm editing as a kind of database. It lists all of my resources. As I issue orders, the changes could be reflected in the text. Any really sane implementation would use an outside database, but I like the idea/challenge of trying to maintain everything with the single text file. Unless you tell me it's really super crazy.
A report for a world looks something like this: World 5 [TERRAN] (Metal=5, Mines=5, Population=10) Fleet 3 [TERRAN]=10 (Moved) Fleet 17 [TERRAN]=0 (Captured)
Here I'm the player TERRAN, and I own World 5 and Fleets 3 and 17. But Fleet 17 has no ships, so I would transfer a ship from Fleet 3. Something like: Fleet 3 transfer 1 Fleet 17
Some keystroke later, this order would be applied to the text, and the report would look like: World 5 [TERRAN] (Metal=5, Mines=5, Population=10) Fleet 3 [TERRAN]=9 (Moved) Fleet 17 [TERRAN]=1 (Captured) ++ Fleet 3 transfer 1 Fleet 17
The order would stay in the file (for later submission to the game), but be marked as completed.
Each time orders are applied, I'd have to parse the whole file, apply new orders, and change numbers and text here and there to reflect the new reality. The files are relatively short (maybe 5 pages max), so I doubt performace would be a problem.
Am I overloading the concept of text editing too much? Too much to do? Or just abusing the tool a bit? Thanks for your ideas!
slothbear wrote:
The order would stay in the file (for later submission to the game), but be marked as completed.
Each time orders are applied, I'd have to parse the whole file, apply new orders, and change numbers and text here and there to reflect the new reality. The files are relatively short (maybe 5 pages max), so I doubt performace would be a problem.
Am I overloading the concept of text editing too much? Too much to do? Or just abusing the tool a bit? Thanks for your ideas!
No reason why you couldn't do it. Since TM commands can execute arbitrary external programs, you could make the processing as complex as you need. Feed the entire document to an external command and replace it with the command's output. Personally I'd use some structured form of text such as CSV or XML, but that's just me.
The only real question is that if you're going to be hand-editing the text (and why else would you want to do this in an editor?) your processing commands are going to have to be good about malformed input. It'd be bad to have one typo wipe out your entire space fleet! I'd also use a version control system to save a history of every move made in case you need to roll back at some point.