On Thu, Mar 31, 2011 at 01:27:44PM -0400, Henry Cipolla wrote:
> I think that if we agree on a JSON format that contains all the data the
> player can know and we make it completely client agnostic then it will be
> a lot easier to do things such as make an Android client or a web client
> or even bots. Or make viewing games interactive, so watchers can look at
> inventory, explored levels, etc. To that end, I think even putting code
> in show_map() is too specific.
>
> What I propose we do is:
> 1) Define a very strict format to describe game state
It's already there: map_knowledge, mon_info. These just need to be turned
into JSON, which, save for enums, is pretty straightforward. You'd need
some data relevant to the player as well -- basically anything that is
provided by the clua interface.
> 2) When the game state is changed (near the end of world_reacts() possibly?)
> query all the different state objects to fill out that JSON blob and send it
> over
It would be easy to send only the difference between the old blob and the
new one. It's a tree-based structure, they can be compared quite
efficiently.
> 3) Build an extremely light parser for that which can pass the data back to
> the gui client or a website.
That's why there should be 1-1 equivalence between map_knowledge and the JSON
blob, so you can put it back in. And parsing JSON is not exactly rocket
surgery.
--
1KB // Microsoft corollary to Hanlon's razor:
// Never attribute to stupidity what can be
// adequately explained by malice.
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Crawl-ref-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss