So i was working (on/and off) for quite a while on getting multiplayer to df. Now i have semi-working framework for that, so i want to share with potential programmers that want to help. So here goes:
branch of dfhack General architecture
Idea is to develop various ways of multiplayer. Some could even work in parallel. What i mean by that? Well server would broadcast what "modules" are supported, then if client has that module it could use it's functionality. To give more concrete example: server can allow to "look" at world, i.e. client can request a region of df (x1,x2,y1,y2,z). How this functionality is used is up to the client. Client can make a simple observer program or combined with e.g. module that allows to control individual dwarf, maybe some dwarf possesion thing.
Modules
So far there is only one working module. And can be improved. It's called "mod_control_view". It allows client to ask for general window into df.
Few other ideas of modules:
- Inspect: gives info about <X> where it can be a position (tile type+ items+units in tile) or unit (by id, and then returns some info about it)
- UnitControl: some way of controling unit. This needs research- what can we do to units from lua side? what works, what does not? and so on
- DesignationControl: a way of marking dig/chop tree, etc... designations. Could include building designations
I started working on "UnitControl" module.
Server
Server is actually very self contained and if nobody wants to make gui or needs many features it can be left as it is (though i'll probably add a way for modules to receive ticks)
Client
A client is two part: base and view. Base is network stuff and bare minimum for client to connect + module logic. View is a gui with logic to use those modules. Other types of clients will have other guis and views.
So what are your ideas and thoughts? I'm hoping to do some more work over the weekend and maybe releasing a client (server needs full dfhack rebuild) to play around. I'll post updates here, maybe a tutorial how to create a module.
Edit: some more links:
Most of code is in lua some of it is in
offscreen module that allows to draw stuff that is not on game screen. There is also my (crappy) socket implementation in
lua and
a syntax nice-ifyer