pydt/web

Update Turn Order Support

Closed this issue · 10 comments

Hi Mike
I just tried to run the PYDT Web part on my machine and it looks promising, but how do you handle the auth stuff & API with local development? When I start the application it says this:

There wasn't anything in ../api-dev-url.txt, using prod api url...

My first guess would be to host the API as well on my machine, but how do I handle and configure the steam login?

My goal was/is to sent you a PR for the drag'n'drop player sorting, but it seems I need to clone the complete backend as well.

I definitely need a better story for others to do local development. You can run npm run debug in the API to start it, but it will still require some AWS credentials and want to create tables out in dynamodb. I think there's a serverless plugin that will run against the dynamodb emulator, hopefully I can get that set up eventually.

I think the best idea right now is to create that api-dev-url.txt file it's looking for, and put https://api-dev.playyourdamnturn.com in there. That's an alternate dev deployment of the API that I use for testing, and it should redirect you back to localhost after authentication instead of the prod URL.

If you want to create a game out there for testing I can join it, and I can also add a couple extra users into the game for you. Just let me know what you need - thanks so much for joining the patreon, BTW!

Maybe I can work on the API endpoint to be able to change the player sorting, and you can do the front end work?

Sure - I'm a noob in Angular development and on a business trip the next 2 weeks - so don't hurry ;)

BTW: You saved Civ6 for me - the AI is super awful and I really enjoy the "slow paced" multiplayer game, so - thank you!

I've pushed code to the API develop branch (which deploys to api-dev) with a new updateTurnOrder endpoint, and I've pushed code to the develop branch of web with updated swagger proxies. Let me know if you need anything else, no rush.

I'd recommend using this for the drag and drop, it should be pretty straight forward, and I've used it before on other projects: https://valor-software.com/ng2-dragula/

Hi Mike

So - I found some time to setup my dev environment and it seems to work :)

Now just to be sure I don't implement stuff that is not desired.

The plan is that the game host can rearrange the other players, right? Basically that the host can swap the other players/AI before the game starts, correct?

image

But the game host can't change is own position because he or she needs to start the game, right?

Oh: Another quesiton: Do you have a API description available (e.g. swagger / Open API stuff enabled on the dev endpoint?)

That's a good point, yeah, don't let the host change their order for now, it might be possible but it would way overcomplicate things. :)

The swagger schema is here: https://api-dev.playyourdamnturn.com/swagger.json.

Another question regarding the API:

The "updateTurnOrder" API need a list of steamIds for in the correct "updated" order, right?

e.g. I have a game with 6 players with steamIds like that:

A,B,C,D,E,F
and I will update the order I need to send the list like this:

A,F,B,C,D,E (in this case I have moved F to the second position)

Another question: Do AI players have "steamIds" as well? Lets say I have a 8 player game with 4 humans and 4 AIs and I want to rearrange them, what do I need to POST to the updateTurnOrder API?

I hope my questions are making sense to you ;)

That's correct in how you want to use the updateTurnOrder API. Good question about the AI - AI players don't have steam IDs, and I don't think we'll easily be able to reorder the AI players or have humans after AI players because there's an assumption currently made that AI players fill in the remaining spots after the game starts.

So, I think only players with Steam IDs after the first should be draggable. I think you can probably create a new div to wrap the resortable players and dragula will only let you rearrange within that div. Thanks!

Hopefully you didn't get too far on this, I had some time this weekend and went ahead and implemented it.

Implemented in 438245a.

Ha! No problem - I starting to feel guilty. My progress was 0%, so glad you took it 👍