Akavall / GoGamesProject

Trying to make some simple games using golang.
1 stars 1 forks source link

All response data sent from server should be in JSON #32

Closed a-temlyakov closed 9 years ago

a-temlyakov commented 9 years ago

Currently the result of turns (and other data) is passed to client as a very roughly created string: https://github.com/Akavall/GoGamesProject/blob/master/basic_server.go#L204

It would be much better to standardize it and pass back the data as a JSON format.

Go has (or seems to) have really good support for JSON: https://gobyexample.com/json and we can easily parse it with JavaScript on client side.

We probably need to create new structs specifically for this...

Akavall commented 9 years ago

OK, this makes sense.

Akavall commented 9 years ago

We should also make the output a more clear.

For example the only way to know if AI decided to stop is to look at the logs.

And for a while I though the game was broken! It's just I didn't know how to run it, and I only figured it out by looking at the code.

I guess some directions would be helpful.

Akavall commented 9 years ago

I think I can do this one.

a-temlyakov commented 9 years ago

Yeah, I think that's all front-end work once the JSON work is complete. JSON data should carry all relevant information and then once we parse it with JS we can decide how to handle it... e.g. when AI stops the AI button becomes inactive (there are probably better ways to handle AI turns other than spamming a button, too :). Also need a place to display all relevant turn information about score, dices rolled, etc.

a-temlyakov commented 9 years ago

This is done, right?

Akavall commented 9 years ago

Yes, I think so.