commit 71c968db64af2dd14645e49e379456ef777fac4b
parent fd9ed4ef6137324859cab7d47924572d5825a060
Author: FIGBERT <figbert@figbert.com>
Date: Fri, 5 Feb 2021 20:21:49 -0800
Add daily log org file
Diffstat:
A | log.org | | | 134 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 134 insertions(+), 0 deletions(-)
diff --git a/log.org b/log.org
@@ -0,0 +1,134 @@
+* Ruleset
+** Game Setup
+*** Each player receives a set amount of gelt
+Initially this is set to 10, but in the final game players will choose between
+a number of options.
+*** The pot starts with 5 gelt
+** Each Spin
+*** The spin order is the order clients joined the lobby
+*** Each player takes/gives gelt to the pot based on spin
+**** Gimel - take all
+**** Hey - take half (floored)
+**** Nun - take nothing
+**** Shin - put one in
+*** If the pot has less than two pieces of gelt, everyone puts in one piece
+**** If a player cannot put in a piece, they are out
+** Win Condition
+*** A winner is determined once everybody else is out
+
+* Multiplayer Documentation
+** Networking
+1. [[https://docs.godotengine.org/en/stable/tutorials/networking/high_level_multiplayer.html][High-Level Multiplayer]]
+2. [[https://docs.godotengine.org/en/stable/tutorials/networking/http_request_class.html][Making HTTP Requests]]
+3. [[https://docs.godotengine.org/en/stable/tutorials/networking/ssl_certificates.html][SSL Certificates]]
+** Server Exports
+1. [[https://docs.godotengine.org/en/stable/getting_started/workflow/export/exporting_for_dedicated_servers.html][Exporting for Dedicated Servers]]
+2. [[https://docs.godotengine.org/en/stable/development/compiling/compiling_for_osx.html#compiling-a-headless-server-build][Compiling a Server Build for macOS]]
+3. [[https://docs.godotengine.org/en/stable/development/compiling/compiling_for_x11.html#compiling-a-headless-server-build][Compiling a Server build for Linux]]
+** GDScript
+1. [[https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_styleguide.html][GDScript Style Guide]]
+
+* Daily Journaling
+** <2021-01-30 Sat>
+Today I took the time to read through the Godot multiplayer documentation and
+implement the basic lobby structure. Each client initializes itself, checking
+whether or not it's a server or client, and connect to a hard-coded IP address
+~SERVER_IP~ currently pointing to my laptop on the local network. It probably
+isn't considered a security issue to have that in a public repo, but I'm not
+sure.
+
+The code is a little rough right now, but it's supposed to be. The current
+version is just there to do the basics (literally text-based) and then I
+can spend as much time as I want refining and adding graphics and such.
+
+At the end of the day today, the game can:
+- Run as a headless server
+- Connect to the server, and alert the user of a successfull or failed connection
+- Alert the user when another client joins or leaves the lobby, and output their
+ ~id~.
+
+Tommorrow I am going to work on:
+- Defining a dreidel rule set
+- Outlining how the data is passed around over the network
+ + How is the game data structured?
+ + Does the client take actions and the server validate them, or does the
+ server request actions from the client?
+- Starting the game when the lobby is full
+** <2021-01-31 Sun>
+I spent the first part of today's work writing a ruleset for dreidel, outlined
+above. It's based on the rules found on Wikipedia, Chabad.org, and my personal
+experience. It also should be fairly easy to implement!
+
+I also butted heads with the multiplayer code a bit - it's hard to make a game -
+but I've got a bit of a general strategy defined now. The client should do as
+little thinking of its own as possible: it's primary function should be to
+respond to calls from the server. Additionally, the code for client and server
+should be kept as separate as possible. I considered having functions for each
+section always begin with a prefix of some sort (i.e. ~client_*~ or ~server_*~).
+I have passed on this for now, but may change that decision later if I can make
+certain that all names retain their clarity.
+
+Tomorrow, I have to start implementing the actual game - working on the lobby
+code is not the goal of this project! Mastering ~rpc~ calls will be difficult,
+but I am confident that I can get a strong start on the gameplay if I focus.
+** <2021-02-01 Mon>
+This project is moving at the speed of light. Today, I basically finished the
+backend code. Players now take turns spinning the dreidel, gaining and losing
+gelt, and everything works flawlessly. It's really exciting.
+
+The main change I implemented today was inserting a step between roll decection
+(~client_spun~) and moving on to the next player (~_iterate_turn~) which chooses
+a random side of the dreidel and performs actions on the pot and players' gelt
+(~_spin_dreidel~).
+
+One of the more interesting problems I encountered in making this functions was
+how to implement the randomness. At first, I defined it as such:
+#+BEGIN_SRC gdscript
+round(rand_range(0, 3))
+#+END_SRC
+This block generates a random float (decimal) between 0 and 3 and rounds it to
+the nearest integer, which I use to select a dreidel face from an array. Do you
+see the problem? The problem lies in the function I used - ~round~. The numbers
+at the end of the range have only have the change of getting selected as those in
+the middle! With that implementation, 0 would only be selected if the number
+generated was between 0 and 0.5. The same applies for 3: it would only be
+selected if the number generated was between 2.5 and 3. These both are less than
+the chance of getting a 1 or a 2, which have a range of 1 each - double the range
+of 0 and 3!
+
+So how did I fix it? Like this:
+#+BEGIN_SRC gdscript
+floor(rand_range(0, 4))
+#+END_SRC
+This new version ensure that each number has an equal change of being selected,
+instead of being biased toward the center.
+
+Tomorrow, I'm going to focus on polishing the text output. The operations on
+the pot need to be more clear, and I am considering splitting the processes
+of spinning and anteing up. Most importantly, however, I must add a win
+condition!
+** <2021-02-02 Tue>
+Well, three cheers for unexpected challenges. Adding a win/lose system was
+incredibly difficult. I expected it to be a breeze. I actually had to implement
+it twice, because my first attempt was unsalvagable. The second time around, I
+walked through the whole codebase piece by piece with my dad, and we worked it
+out together. The most interesting thing he suggested was a cool trick in
+boolean math: to figure out if there is only one true value in an array of
+booleans, convert them all to binary, and if the sum is 1 then there's only one
+~true~. Pretty useful.
+
+With that final system implemented, it's time to polish off the textual
+interface before moving on to add some real graphics. By Friday, I need to:
++ Increase the font size
++ Get running on Android
++ Split and request the ante
+ - It's currently lumped in with the rest of the spin, which makes
+ the math a little confusing.
++ Add usernames
+ - Judah
+ - Yochanan
+ - Shimon
+ - Elazar
+ - Yonatan
++ Add auditory or haptic feedback to dreidel spins
++ Increase lobby max size and add start/restart mechanisms