pwmarcz / autotable

An online mahjong table
https://pwmarcz.pl/autotable/about.html
Other
70 stars 22 forks source link

Add a couple of crucial missing installation steps in the README.md ;… #5

Closed ApplySci closed 3 years ago

ApplySci commented 4 years ago

… update Makefile to account for the command-line change for Blender 1.0 and enable it to do make build on Windows as well as linux/mac.

I hit a few snags when trying to get things running on my machine. One was the changes to the Blender command-line argument; another was missing dependencies. These changes should help others get started.

pwmarcz commented 4 years ago

Thanks for your interest in the project! I applied some of your changes (see commits attached to this PR), but I'm not sure about other ones.

ApplySci commented 4 years ago

I haven't had any other problems with the Makefile than that one part. The following make targets work ok, after that change: parcel, files, server, test, build.

You're right that make test doesn't need make server, and that applies on windows too. I don't know why it failed the first time I tried it, but I just tried it again and it worked fine without make server.

ApplySci commented 4 years ago

Hi @pwmarcz

I'm planning to make a fork with a few automation features. I completely understand that you don't want those as pull requests, so I won't submit them.

But you know this code thoroughly. If you could give me a couple of pointers on where I should look in the source code (which file, which function, or which objects) for some key things, that will save me a lot of time trying to learn how everything fits together.

I'm planning to add:

  1. a quick discard feature so that the discarded tile always goes into the next available discard slot.
  2. A button to toggle the reveal & hide, of all tiles in people's hands
  3. Removing tiles from the set so that we can play with just pin; or just pin and sou; or just pin, sou, man. So that we can teach using the Tibet Rules method.
  4. A toggle option for a player to have an auto-sorted hand.

Where should I start looking, to do each of these?

pwmarcz commented 4 years ago

Hello!

That's right - these don't sound like they belong in with my vision of the game, but I hope you manage to achieve your goals with the fork.

First, some general advice. Generally the code is structured in layers, so probably you can follow them. For instance, if you add a "quick discard" feature, then the key handling belongs with other keys (game.ts:onKeyDown), then the handler for the action would go with all the other actions in world.ts.

Luckily, your ideas all sound like they can be done without modifying the network layer. You'll be adding some extra tile changes to the existing code. Make sure that the updated state gets sent to server (world.ts:sendUpdate, I think).

For the features specifically:

  1. a quick discard feature so that the discarded tile always goes into the next available discard slot.

Your code will need some understanding of which slot is which, but that doesn't sound too hard - the slots have names, after all.

This sounds easy enough if this is just a "teleport", not an animation - there are no real movement animations in Autotable, just tiles moving along with mouse. So if you want animation, you would have to somehow simulate the tile moving. There is one feature that is kind of similar - a fancy animated multiple tile flip (select multiple tiles in your hand, and press Shift-F to see it). If you need animations, maybe the code for that (onFlip) will give you some ideas.

  1. A button to toggle the reveal & hide, of all tiles in people's hands

I guess you could change all the tiles' rotations to "lying down". Seems pretty similar to the current flip (onFlip), you could probably use that.

  1. Removing tiles from the set so that we can play with just pin; or just pin and sou; or just pin, sou, man. So that we can teach using the Tibet Rules method.

This is already supported in the code (there is a 3-player mode which uses a different set of tiles, etc.) You should be able to define a new set of tiles, then a new set of slots, and a new way of dealing. It will be a bit awkward, sorry. Follow what happens to conditions in the code. Most of that will be in setup*.ts.

  1. A toggle option for a player to have an auto-sorted hand.

I would start by adding a manual "sort" button or key. Then, keeping the hand auto-sorted means calling that function at the right moment to sort the tiles during the movement. Probably after the movement ends, i.e. player drops the tile/tiles to destination.

That part sounds like it needs some testing: what happens if drag move multiple tiles? what if I move tiles inside my hand? what about tiles that are flipped? etc.

Good luck!

ApplySci commented 4 years ago

That's brilliant, @pwmarcz . Thanks so much, that's exactly what I was hoping for!