DEV Community

Braeden Richards
Braeden Richards

Posted on • Updated on

Forest Defender Devlog 1: Development Setup

Forest Defender Devlog 1: Development Setup

Image by storyset on Freepik

Written on October 25th, 2022

Table of Contents

Preface

The goal of this devlog is to show how I set up my environment for development of this game. Future devlogs will focus on higher level topics, such as game development updates, topics and discussion of the game, etc., instead of lower level topics like this devlog.

That is not to say I won't go into any details / code in future devlogs. If there is an interesting challenge I face or a topic I think is helpful to explain or show, I will certainly add it to the devlog.

What will be used as the development machine?

The development machine chosen to create a game is important as it sets the main target OS for the game build, creates the subset of tools that can be used, and sets the development environment as a whole.

My development machine is a Windows 10 desktop computer. The specifications are as follows:

  • Motherboard: ASUS ROG STRIX Z390-E Gaming
  • Processor: Intel Core i9 9900k
  • RAM: 32GB of CORSAIR 3.0GHz DDR4
  • Storage:
    • Samsung 970 EVO Plus 500GB
    • Samsung 970 EVO Plus 500GB (second one)
    • Western Digital 1TB Hard drive
  • Graphics Card: NVIDIA GeForce RTX 2080 SUPER

This machine is certainly overkill for any development we are doing at this scale, especially since we are working on a 2-D game using Python. The machine also serves as a gaming computer for me, which is why these are its specifications.

Since I am using Windows 10 as my development OS, we are locked into tools that are available on Windows 10. While this does cut off a lot of Linux tools, we are still left with plenty. We are also locked into targeting Windows 10 for the main audience for the game. Python and the libraries we are using are able to run on the three major operating systems (Windows, macOS, Linux), but we will be testing and developing on the above system, so any testing on Linux and macOS will come at the end of development.

Ultimately, this is perfectly fine since most games are released on Windows versus the other operating systems and therefore most gamers use Windows to play games. So our audience is still the biggest 'chunk' of people.

Development Tool Installation / Updating

We won't be needing too many tools to get started with this project. We will install the following:

VS Code will be used as our text editor of choice. This is for planning of the game, project file management, and writing the actual code.

Aseprite will be used to create all the assets for the game, including the animations.

Tiled is our choice for taking those assets created in Aseprite and using them to create levels.

Virtual Environment

We want to keep our environment (module installations, Python version, etc.) separate from the OS wide installations. In order to do so, we need to create a separate container to store the environment. The way we will achieve this during this development run will be with Python's Virtual Environment.

It is extremely easy to setup. Ensure you have some version of Python 3+ installed on your machine, and run the following in the terminal / CMD:

> python -m venv env
Enter fullscreen mode Exit fullscreen mode

In this command, we are telling Python to run the venv command, which creates a virtual environment in the current directory, and call it 'env.'

To enter the virtual environment while in the Windows OS, simply traverse to the directory containing it and enter:

> env/scripts/activate
Enter fullscreen mode Exit fullscreen mode

Installing Libraries

To get started with the game, we don't need too many libraries. For now, we will only be using Pygame.

> pip install pygame
Enter fullscreen mode Exit fullscreen mode

Checking Everything Works!

Now that we have the environment setup, all that is left to do before beginning with development is make sure it all works. We will be checking that the Python environment and Pygame installation were properly done. To accomplish this check, we will run the below Python script which opens a Pygame window:

import pygame

background_color: tuple[int, int, int] = (255, 255, 255)
width: int = 300
height: int = 200
window_title: str = "Window Test"

def main():
    screen = pygame.display.set_mode((width, height))
    pygame.display.set_caption(window_title)
    screen.fill(background_color)

    pygame.display.flip()

    keep_running: bool = True
    while keep_running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                keep_running = False


if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

When the above script is run, the following window appears:

Image of Pygame application window

Resources / Further Reading

Text Editor

Other

Top comments (0)