# Cutting Trees and Mining Flint to Start a Campfire [Poor Game Dev 2]Cutting Trees and Mining Flint to Start a Campfire [Poor Game Dev 2]

Cutting Trees and Mining Flint to Start a Campfire. Updates of the second week of my game dev journey.

Ben Ho, Blogger

January 13, 2020

Hey, this is Ben and I code your venture free. Welcome back to the second week of my game dev journey. If you haven’t read my previous article, please feel free to check it out beforehand. Anyway, I am very excited to share all the updates this week. So let’s get started.

https://youtu.be/VNNHhwlAWA8

### Resources Harvesting Mechanism

As I mentioned in the last article, I didn’t know which game genre has the best product-market fit. How about let’s start by building a very simple resource harvesting mechanic.

A Harvesting Cycle

Let’s take a TREE as an example. There are several states of harvesting in the gaming cycle :

1. Idle: Waiting for the interactions with the player

2. Harvest: Player harvesting the resources with a tool

3. Successful: Harvest succeeded and resources available

4. Collect: Player collect the harvested resources

5. Regenerate: Resource generate on the game map again after harvesting, back to the state 1

For each of the states above, there will be different animations and interacting s respectively. But the key to this game mechanic is the resource allocation on the game map.

First and foremost, it’s all about the density of the resources—trees cannot be too packed or too close. It will be less fun if the player can harvest the resources without moving around. Therefore, I develop a simple function to ensure the regenerated tree will not get too close to the character (player) each time. By comparing the (x,y) coordinates of the character and the regenerated position on the map, the function guaranteed the new tree will not generate within 100 units range of the character. As a result, after successfully harvesting one tree, the player will have to go back and forth in order to harvest another one.

Secondly, the time of regeneration and randomness is also very important. Randomness is a very large topic of game design. If time is allowed, I will film another video to talk about this. For this time, I just simply use the operating system time as the seed to ensure the tree generation mechanism can achieve a truly random state. I also restrain the maximum total number of trees in the game to 5. Once a tree is being harvested, another one will pop up in 1 second on the game map base on the distance calculation that I mentioned above.

With these two key mechanics, I think it is good enough to build a foundation for a clicker game to keep the player fun and busy.

A Resources Magnetic Field

Inspired by the Dead Cells and Nuclear Throne, I also develop a resource magnetic feature. The player can carry a resource magnet (which can be upgraded later on) which can produce a magnetic field to pull and collect the harvested resources. The magnetic field will automatically initiate once it is close enough and collides with the resources.

Same as mining flint and many more

To start a campfire, you also need a flint. Therefore, with the two pillars above, the same game mechanics can be applied to the flint harvesting and many more.

However, it does not make any sense to mine flint with an ax. Therefore, I draw a pickaxe and build a simple tool switching mechanism.

### Crafting Mechanism

With both wood and flint in hand, you are good enough to start a campfire. So, it’s time to build a crafting mechanism.

Firstly, I would like to solve the problem of overlapping. There are many game objects in the world, say the resources, it is always good to avoid the crafting object collides with each other in the game. I don’t allow the player to craft stuff on top of another game object.

Once a player wanna craft a campfire, the game will enter a crafting mode to check whether the crafting position will overlap with other game objects. If it does, the crafting position will turn red. At the same time, if the crafting position is a green light, then you are good to go and resources will be deducted.

Also, every crafting object has its life. I mean nothing is permanent in the game and things will be deteriorated from time to time. After 12 seconds, a basic campfire will burnout and you will have to start another one again.

You can maintain the campfire by consuming wood or flint. I will develop this game mechanic later on.

### Graphic User Interface

Finally, I also developed a basic graphical user interface before the end of this week. One of the interesting design is to mimic the mac keyboard as I am an Apple fanboy.

More useful information and user menus will be developed later on, say showing the HP of the character and the crafting/bag menu.

### Next Week Goal

So, that’s the wrap up of this week game dev. Thanks for reading the article. Next week, I am going to improve the graphical user interface, polish the game a little bit more and publish the very alpha version of this game to different platforms. Stay tuned.