Skip to content

Devopment Logs

Lyssa Li edited this page Dec 10, 2024 · 9 revisions

Table of Contents

  1. 11.14.2024
  2. 11.21.2024
  3. 11.26.2024
  4. 12.04.2024
  5. 12.08.2024
  6. 12.10.2024



Devlog Entry - 11.14.2024

Introducing the Team

Tools Lead: Aidan Sterling

Aidan will be in charge of researching new tools and helping other teammembers set up the necessary systems. They will handle the source control and automated deployment

Style Lead: Lyssa Li

Lyssa will be in charge of code style of the project and maintaining good style throughout the game base. They will also set up autoformatting and documentation.

Engine Lead: Jaxon Ruiz

Jaxon will be in charge of researching about the engine and teaching the team how to use it. They will also establish how code will be organized and how systems will be designed.

Design Lead: Lily Chen

Lily will be in charge of setting the creative direction and look of the project. They will be making art samples and code samples to demonstrate how the designs are to be implemented.

Tools and Materials

The chosen engine for this game is Godot and the programming language will be GDScript (that comes with the engine). This is because 3/4 group members have previously worked with the engine and all members on this team are keen on learning the engine for future projects. This engine is relatively light for laptops and has an option for web build. In addition, GDScript also has JSON support.

We are going to use the built in text/code editor in Godot for code. Github will be used for source control. Merge conflicts will be resolved in Github or VSCode. The above tools are picked because the team have used these tools for these purposes before. The art assets will be created on Clip Studio Paint as that is the application our Design Lead uses usually.

For our alternative platform, we are planning to switch from GDScript to C# and swapping to the .NET version of Godot that also compiles C#. We will only be swapping the language and not the platform.

Outlook

We are hoping to create a systemic game with dynamic systems that will create emergent behavior. The current idea that we have is to include a weather system.

The riskiest part will be switching the programming language because we will have to rewrite all the code. If we do not set it up properly it will be very hard to do and a lot of work. Keeping track of scope and not overscoping the project will also be difficult.

We as a team are hoping to better learn how to use the engine Godot. Some of us have used the engine before but none of us are very familiar with it. We also hope to learn how to design good software architecture.


Devlog Entry - 11.21.2024

How we satisfied the software requirements

F0 Requirements:

[F0.a] You control a character moving over a 2D grid.
[F0.b] You advance time manually in the turn-based simulation.
[F0.c] You can reap or sow plants on grid cells only when you are near them.
[F0.d] Grid cells have sun and water levels. The incoming sun and water for each cell is somehow randomly generated each turn. Sun energy cannot be stored in a cell (it is used immediately or lost) while water moisture can be slowly accumulated over several turns.
[F0.e] Each plant on the grid has a distinct type (e.g. one of 3 species) and a growth level (e.g. “level 1”, “level 2”, “level 3”).
[F0.f] Simple spatial rules govern plant growth based on sun, water, and nearby plants (growth is unlocked by satisfying conditions).
[F0.g] A play scenario is completed when some condition is satisfied (e.g. at least X plants at growth level Y or above).
  • F0.A: We have a character that moves across the tilemap which is a 2D grid.
  • F0.B: Each new turn is triggered via the SPACE key. Nothing happens (other than possible player movement) until the next turn is triggered. Sun and water resources are distributed at the start of the turn and plants grow or wilt accordingly.
  • F0.C: The player can only sow or reap the cell that they are standing on. Right click sows the plant, left click reaps the plant.
  • F0.D: There is a weather system that determines the sun and water level per cell using simplex noise. This information is then distributed to the map cell and consequently the plants. Water constantly accumulates in the map cell towards infinity. We currently do not do anything with the accumulation of water.
  • F0.E: We have two types of plants, flowers and wheat, indicated with different tile sprites. There are three stages of growth for each plant indicated by a different tile sprite.
  • F0.F: Plants can get sun, water, and plant data from the map. They know their location, so they have the ability to probe nearby cells. Each plant has a grow() function that takes this data, runs a simple logical operation on it, and changes the current growth level as a result. For example, the wheat grows slowly when sun and water are both less than three and grows faster when it is close to other wheat.
  • F0.G: Each plant on the field gives a plant value depending on their growth rate. The game ends (prints a message) when you hit 25 points.

Reflection

We pretty much scrapped the roles given in the first devlog on November 14th because it felt like an odd splitting of tasks. We were very set about the engine and the tools we were using so there was not much exploratory research to do. Instead, we resplit the roles according to the systems that are required. Jaxon worked on the 2d map system, Aidan worked on the plant system, Lily worked on the player system, and Lyssa worked on the weather system. We then all came together on a call to piece the systems together. It was much easier and understandable that way.

Because of the time panic, there was not much thought put into the game rules. Learning Godot has taken longer than expected and certain systems were harder than expected to implement. We may not be able to make it as dynamic and emergent as we had originally hoped it to be. We also may run into issues with possible later requirements when we have to switch languages because we have recently discovered that C# on Godot 4.3 does not have a web-build option, so we were very right to state that the platform change will be the hardest. Just no one expected how hard it was going to be. But we'll see.

There was also a quick issue with using the wrong cases. Half the team was using camel case and the other half snake case. The issue was quickly resolved though.

There were no other notable issues.


Devlog Entry - 11.26.2024

How we satisfied the software requirements

F0 Requirements:

[F0.a] You control a character moving over a 2D grid.
[F0.b] You advance time manually in the turn-based simulation.
[F0.c] You can reap or sow plants on grid cells only when you are near them.
[F0.d] Grid cells have sun and water levels. The incoming sun and water for each cell is somehow randomly generated each turn. Sun energy cannot be stored in a cell (it is used immediately or lost) while water moisture can be slowly accumulated over several turns.
[F0.e] Each plant on the grid has a distinct type (e.g. one of 3 species) and a growth level (e.g. “level 1”, “level 2”, “level 3”).
[F0.f] Simple spatial rules govern plant growth based on sun, water, and nearby plants (growth is unlocked by satisfying conditions).
[F0.g] A play scenario is completed when some condition is satisfied (e.g. at least X plants at growth level Y or above).
  • F0.A: Player is a red square walking on a 10x10 grid of blue squares.
  • F0.B: Time is advanced by pressing the space bar. Plants do not grow or wither if space is never pressed.
  • F0.C: You can only reap or sow on the cell you are standing on. Which you are very near.
  • F0.D: Grid cells save water and sun levels in the data structure. The sun and water levels are generated at seeded random, giving each cell 3-7 sun and 3-7 water. Water levels accumulate in the cell (they still don't do anything) and sun levels are overwritten each turn. We switched off of noise as it was hard to get a noise function import and the previous idea with noise didn't work very well either.
  • F0.E: We have 2 species of plants indicated in colors. One species of of yellow plants and one species of green plants. Their growth levels are indicated via the number inside the grid cell. This number can currently increase infinitely given resources.
  • F0.F: Both plants need 2 waters and 2 suns each turn to grow. They then need different breakpoints to spread with plant 2 (the green one) spreading much faster than plant 2 (they yellow one) as they need less water and less sun to spread).
  • F0.G: The win condition is a bit complicated. You need to balance plant 1 and plant 2 to grow at appropriate levels (levels >= 4) and plant 2 (yellow ones) must take up more space on the grid compared to plant 1 (green ones). You will get a window alert when you win the game.

F1 Requirements:

[F1.a] The important state of your game's grid must be backed by a single contiguous byte array in AoS or SoA format. If your game stores the grid state in multiple format, the byte array format must be the primary format (i.e. other formats are decoded from it as needed).
[F1.b] The player must be able to manually save their progress in the game. This must allow them to load state and continue play another day (i.e. after quitting the game app). The player must be able to manage multiple save files/slots.
[F1.c] The game must implement an implicit auto-save system to support recovery from unexpected quits. (For example, when the game is launched, if an auto-save entry is present, the game might ask the player "do you want to continue where you left off?" The auto-save entry might or might not be visible among the list of manual save entries available for the player to load as part of F1.b.)
[F1.d] The player must be able to undo every major choice (all the way back to the start of play), even from a saved game. They should be able to redo (undo of undo operations) multiple times.
  • F1.A: Map state is stored in AoS format (see picture below). Game state is stored as the byte array + a couple other numbers extraneous data (such as turn number) in a structure.
  • F1.B: We have two save slots with it's respective load buttons. This data is persisted through the use of local storage.
  • F1.C: We have an autosave entry as a button that the player can click at anytime to load the autosave. Autosave triggers after every map update. We do not have the popup but the button is there always.
  • F1.D: The player can undo "next turn", "plant", and "reap" actions. Player movement does not currently do much or count for much so we didn't consider it a major action. Undos and redos are saved with the save slot. We did not set the redo buffer to be a certain max size. Player can redo all their undos if they have not preformed any other action.

AoS structure: Structures were made of two unit16s for sun and water level and 2 unit8s for plant type and plant level

Reflection

We were talking with another group working in Godot about upcoming software requirements. Because there is a requirement for "mobile play" and Godot 4.3 C# cannot compile into web build, our original plan to switch from GDScript to C# for platform switch did not work anymore. Instead, we switched to Typescript/HTML5 for F1 because the entire team was familiar with it so we can work quickly and catch up with the wasted time.

Later, we plan on switching again from HTML5 to Svelte for our platform switch in F2. Since the clues were released with F0, we should have looked closer and done C# to GDscript if we intended to stay on Godot.

There was a lot of UI problems with our previous version as none of the information is ever displayed on the screen for the player to understand how to play the game and even the win is only logged in console. This time, we made some minimal UI to at least explain what was going on for the game and a window alert to tell the player that they have won the game. We did not go very deep into the UI because the rendering platform will be changed in the next assignment. Also our artist did not have time to make UI assets yet.

On a side note: the Professor released an announcement for the having a Production Lead to ensure things are turned in on time. It has been me (hello it's Lyssa :D) being the Production Lead since I have beein compiling our experiences into these Devlogs so far and scheduling meetings.

Here is a list of other issues we ran into and took a while to fix (but did fix):

  • structuring data for save files
  • stringifying and parsing array buffers for save and load
  • deno not liking document.cookie
  • deno not liking an attempt to import a noise library
  • a bit of accidentally breaking code after refactoring
  • error with using space bar for next turn after clicking any button because of button focusing

Devlog Entry - 12.04.2024

How we satisfied the software requirements

F0.A-F to F1.A-D no change in fulfilling the requirements. Refer to older devlogs for more information.

  • F0.G: We have changed the win condition to be score based. Plant type and growth value will be given a certain point value. The sum of all point values on the grid is the current player score.
  • We have also changed how water is accumulated with "chance of rain" (see external DSL notes below)
  • We have edited the plant types to have more plant types and increased range of behaviors (plants can now die)

F2 Requirements:

[F2.a] External DSL for scenario designs
[F2.b] Internal DSL for plant types and growth conditions
[F2.c] Switch to an alternate platform

External DSL for Scenario Design

We have an external DSL in as a YAML file that gets parsed into an object and used for the rest of the typescript files. Currently, the scenarios that can be edited includes a one time event of rain chance and repeating event of rain chance. This decides how likely a cell gets a random water value that around. Rain chance is defaulted to zero if not set in external DSL. The number of pointed needed for our new win condition is also stored here. Editing the external DSL and reloading the game will instantly apply changes.

Here is our sample structure:

events:
  one_time_event:
    - turn: 5
    - chance_of_rain: 0.9
  repeating_event:
    - starting_turn: 6
    - every: 2
    - chance_of_rain: 0.5
win_conditions:
  point_requirement: 100

One time events happen once on the specified turn. Repeating events start a specific turn and repeats depending on the value in "every". Chance of rain is a float between 0.0 and 1.0 inclusive. Point requirement for win condition can be any integer number.

Internal DSL for Plants and Growth Conditions

Plants are defined in an internal DSL TypeScript object. It contains base attributes for the plant including max level, water consumption, and expand level. It also contains conditions for the plants to grow, decay, and expand, based on cell water and sun levels, ideal friendly neighbor ranges, max number of hostile neighbors (tolerance). The internal DSL also provided a place to define friendly and hostile neighbors used for consideration of these conditions. It also stores a color value the view component can use to place the plant, as well as a placeholder for eventual image asset paths.

We used the power of types in TypeScript to have strict control over the format of the internal DSL. For examples, plant conditions use interfaces with expected behaviors. We also have the power of comments that normal JSON files would not give.

Here is a sample for one of our plants:

{
	// grow fast, expand fast, weak to other plants
	name: "Flower",
	imgUrl: "",
	maxLevel: 5,
	expandLevel: 3,
	waterConsumption: 1,
	scoreMultiplier: 2,
	expandConditions: {
		water: 4,
		sun: 6,
		chance: 0.9,
		tolerance: 3,
	},
	growConditions: {
		water: 4,
		sun: 5,
		chance: 0.8,
	},
	decayConditions: {
		water: 2,
		chance: 1,
		sun: 3,
		tolerance: 1,
	},
	friendlyNeighbors: [0, 1],
	enemyNeighbors: [0, 2, 3],
	color: "rgb(229, 162, 56)",
},

Our types are stored in index.d.ts to be accessable across the project without having to import in every file. Here is our type for plant conditions that is used for expand, grow, and decay conditions:

interface PlantConditions {
  water?: number;
  sun?: number;
  chance: number;
  minNeighbors?: number;
  maxNeighbors?: number;
  tolerance?: number; // how many opponent plants can be tolerated
}

Switch to Alternate Platform

We had a panic platform switch during the swap between F0 and F1 so we completely scrapped the original idea of swapping from GDScript to C# for our platform switch. Because we switched to HTML5/TS in F1, we needed another platform switch for F2. We ultimately went with Svelte because it mostly changed our views (the project was formatted in MVC since F1).

We have swapped the platform over from HTML5 to Svelte. The integration at first was relatively simple, then we did more edits to make the Svelte files more "Svelte-like" by taking out our old observer pattern that refreshed the display on player interaction and used Svelte states instead.

Because of the use of Svelte states, some objects had to be changed to be "writable" so Svelte can keep track of it. Other than that, only the files taking care of views had to change. Controllers and models were pretty much untouched (other than type Writable changes).

Reflection

We had a lot of issues with getting Deno to work with YAML parsing. Ultimately we had to go to Professor Adam for help on that.

Later when switching to Svelte, there were huge issues with "no default export", which caused us to change from Deno to Nodejs. However, it turned out to be an issue with Svelte Intellisense on VSCode turning itself off.

Overall, F2 was not difficult but the journey was definitely rocky. We had a lot of points where one person would get completely stuck and the group would come together to try and help them but nobody could figure it out. Then there was a couple days of sitting around and researching before any progress could get made.


Devlog Entry - 12.08.2024

How we satisfied the software requirements

F0+F1+F2

F0-F2 no notable changes.

F3 Requirements:

[F3.a] internationalization
[F3.b] localization
[F3.c] mobile installation and mobile play
[F3.d] offline mobile play

Internationalization

The game is internationalized by integrating the svelte-i18n module, which allows the integration of multiple languages via a JSON file for each provided language. Strings presented to the player are accessed by their tokens so that relevant translations can be slotted in (the token "title" can have the value "Plant Game" for english or "Juego de Plantas" for spanish). Incomplete translation packs will default to the english translation for any tokens not translated.

These JSONs can be accessed, edited, and added to in the locales directory, by creating a new JSON file. The languages can then be made available for the game in i18n.ts by importing the language pack and using the addMessages() function provided by svelte-i18n. Languages are automatically set to the user's location through getLocaleFromNavigator() but can be manually set as well.

Localization

Currently, our game supports the provided languages: English, Spanish, Chinese Mandarin (logographic), and Arabic (right to left). This can be changed in the source code (as of right now we did not implement a way to change it in the client side) and will show on reload. All translations from English was done through Brace by simply asking to translate English text line by line. On download, the whichever language is selected by the user in the source code will be the language of the downloaded app.

Most of our right to left localization problems was taken care of by having things being center aligned. We have yet to implement right to left language localization in UI placement.

Mobile Installation

The game allows for mobile installation using Progressive Web App. This makes it installable on pretty much any device when the user opens the website on the mobile device (the link to our website can be found under the About section on the Github Code page). The main issue with getting this working was that Vite changed the file system between what it is in the editor, what it is while locally hosted, and what it is in GitHub pages. The specific problem with this was that the images and manifest files were different on GitHub, so Aidan had to figure out what they were changed to and update the filenames in the code. Aidan wasn't quite sure if the way the file names changed was consistent across devices, so we handled it more elegantly for F3.D. We also had to meet a bunch of requirements for it to be installable. It had to have images of certain sizes, a name, and a start URL.

Mobile Play (Offline)

To enable offline play, Aidan added a service worker to install, activate, and fetch the game data. He faced the same challenges with Vite for implementing this (see previous section), but it was worse. The service worker doesn't even appear if the wrong name is set because it's dynamically added during runtime. The final name was also not visible in the inspector. To solve this, Aidan completely overrode the settings in vite.config.js to not change the names of the files at all. After this, it went pretty smoothly. This also made the way the code was handling the manifest for the mobile app more elegant.

Reflection

Our team took a really big gamble and essentially put the brunt of F3 onto two people: Aidan and Jaxon. In the meantime, Lily and Lyssa worked on bettering the UI for the final presentation (we are not done yet, we will write an additional devlog when we do finish). We are still splitting the group by task and going off of there.

Aidan started working on F3 while the rest of us were still finishing F2 and did the mobile installation and mobile play. Jaxon worked on internationalization and localization. As of right now, Lily has gotten all the plant and field assets in along with the player and some of the UI overlay. Lyssa is moreso working to integrate the assets into svelte.

Because of the Thanksgiving break last week and the looming pressure of finals, we did not have as much time to work this week and did our work completely asynchornously. By the power of discord, we were still able to coordinate, despite not having our weekly to bi-weekly check in meeting.

Our game has definitely evovled to be more game-like instead of purely following the instructions and the instructions only (case and point, UI). We hope do be able to finish a bit more (including mobile friendly UI redesign) before the presenation on the coming Tuesday.


Devlog Entry - 12.10.2024

Hello hello. A bit of a short one this time. This is an additional devlog to finish up our Mobile UI portion of the game. There are no changes to the how F0-F3 is implemented, just how it is represented.

Mobile UI Updates

The game is now fully playable on mobile with it's own mobile UI, however, due to the limitations of time, it only works well for phones that have a taller aspect ratio as the layers would start stacking on top of each other when the phone screen is short.

Assets

All in-game assets are done by Lily Chen, using Clip Studio Paint for references and designs and pixel studio for all the in-game pixel assets. Assets are scaled 16:1 for better resolution.

UI Implementation

UI implementation was all done in Svelte, mostly by Lyssa Li. It now fully uses Svelte's conditional rendering to create changes. There is a cool thing Lyssa did with the player animation using transforms on a character sprite sheet to only showcase part of the character. Here is a gif showcasing the logic. The red outline shows where the player character will be displayed. All spites outside the red outline is hidden in the final version.

character animation logic

Nodes for Future Updates

There a couple of bugs with sizing and dimensions on the mobile version (we mostly used did the mobile testing on Firefox's responsive design mode and that did not transfer very well over to the actual mobile version).

As of right now, the game state is store in-optimally so the accessing and conditional rendering in Svelte is a bit messy, but it does work for the size of game we have now. This most likely would not get fixed in the near or far future unless someone has a lot of time and reworks a good 60-70% of the models and controllers code.

Reflection

Honestly, to be very very honest, the amount of crunch done in the past 3 days to get a fully functional and hand-made mobile UI design for the final presentation (today, 12.10.2024 at 16:00) was not exactly worth it. However, it sets a good a base-line for the project if it were to be continued past the end of this class. Mutliple members of this group do showcase interest in doing so but it will be wholly up to time constraints throughout the rest of the schoolyear and past that.

For now, the project will go onto hiatus, it was a good journey here. o7

- Lyssa (who wrote all the devlogs)