Monday, July 10, 2023

Day Two

 I finished the day yesterday adding a "Settings" class to handle user defined settings, and in the future key binds. I also added helpers to print logs to the console that includes the file path, time, line, and the message. I recommend making your own console logging method. Friends had suggested libraries, but they keep forgetting I'm not making any type of engine or editor. I'm just making a game, and I don't think I need anything elaborate for debugging. Not to mention I have Visual Studio.


At the moment the settings file looks like:

anisotropy=0
antialias=0
fullscreen=0
height=768
light_quality=1
maxfps=0.000000
terrain_quality=0
texture_detail=1
title=Scavenge
trilinear_filter=0
vsync=0
water_quality=1
width=1024

These settings are not yet applied, but that begins to describe the plans for today.

I should say, a few of these are already implemented as part of the game initialization process, but the rest of the settings need to be applied. Otherwise the application will revert to the default settings even if the user saved custom settings.

That brings me to key binds. I'm not sure how to approach this yet, but I'm brainstorming.

I will write another article at the end of the day to update my progress!


Sunday, July 9, 2023

Critical Error

 My disclaimer was a good call when I had posted that last article. In my rush to post an article about the Scavenge and Game classes (Scavenge will eventually have a class) I forgot to make a destructor for Game, and delete the world, context, and window.

Game::~Game()
{
  delete world;
  delete context;
  delete window;
}

This is called in Scavenge when the game loop is ended (game->Power() == false) and delete game; is executed before exiting. Memory leaks aside I'm ready to go.

Compared to the example code provided by Leadwerks Project Manager there is a "System" static class that includes "AppName", "LoadSettings()", "AppPath", "ParseCommandLine()", "GetProperty()", "SaveSettings()", and "Print()." I will take a look into the API documentation and expand my Game class.

I want to take advantage of settings if Leadwerks already provides a class. I might as well take as much advantage of Leadwerks as possible, and I can also take advantage of "Print()" to do a bit of custom logging.

Back to work I go!


And We Begin

 I began by deleting the files created by the Leadwerks Project Manager. I simply want to start with my files and entry point.

I created "Scavenge.h" and "Scavenge.cpp" which will serve a few purposes in the future, but is also my entry point.


This leads to the "Game" class that you see in the source code.

Essentially similar to the provided "App" class, this is a simple class that creates the window, creates the context, creates the world, and then updates the time, updates the world, renders the world, and updates the context. A simple version of this is provided by the Leadwerks API found here: https://www.leadwerks.com/learn?page=API-Reference_Object_World_Create

I am searching a reliable way to share the "Game" class, so for now, here is a screen-shot of the header:


The "Game" class isn't complicated, and while I was creating it I had another nostalgic moment thinking about older games. Therefore I built the class thinking of a console (Nintendo?) powering on, and off. I may perhaps even add a way to "insert" a class considered to be a "Cartridge." Who knows?

Compiling, no errors, and the window launches. If I click the close button on the window or hit the escape key the program ends without issue. I am ready to continue, but I have some thinking and planning to do, and that may involve something similar to the game "cartridge" idea.



Project

To begin, I need to start a project, and thankfully this part is mostly automated by Leadwerks. Specifically the "Leadwerks Project Manager."
I had decided to use the "Multiplayer Game" Project Template, because more example code is always better at this point. The game name is "Scavenge" and I'm storing everything in a "Leadwerks" directory. I generally do the same for all engines I use either personally or commercially.

The Visual Studio 2017 solution file is in "Projects/Windows" and everything seems ready to go including the solution property settings. I will be going through them in more detail later, but I want to see the results with everything set to default.

The project manager had also created three files within the "Source" directory: "App.h", "App.cpp", and "main.cpp" I will most likely delete these files, but for testing purposes I'm going to launch as-is.
It compiled fine and it ran just fine.
Great!

I guess it's time to read the provided example C++ files, and the example LUA files.

My next article will be officially setting up my own way of starting and working with Leadwerks.

Introduction

 Hello, my name is Paul Thomas, and I'm a programmer. That's probably obvious because of the title of everything involving this blog. It's also obvious that I will be using "Leadwerks" in order to do some sort of "game development."

My history involves using game engines before Leadwerks version 2, and game engines after Leadwerks version 2. There is a large gap between version 2 and the latest version. A lot has changed over the years, too much to discuss here, so I recommend learning more by visiting the Leadwerks website at https://leadwerks.com.

During those times I also created a blog and posted several articles covering my development with the engine. In 2023, extra time lead me to Leadwerks. I purchased the professional license, because I want C++ access, and as I was reading the API I became nostalgic. I wanted to go back in time, create a blog, and write articles about my experience.

I have previous commitments already lined up in my schedule, so development may pause from time to time, but I will get back to the project. It is for that reason I will have to recommend following me on Twitter @3dmasons if you are interested in Leadwerks development, or game development in general.

Another disclaimer is that I am dynamically building this game in Leadwerks, while learning the Leadwerks API, so this all could be hit or miss. I may even make a backup, scratch the whole project, and try again. The future is unknown to me at the time of writing this article, and I don't have anything already written to share like a tutorial.

All of that out of the the way I'm going to get started.


3D Landscape Basic Textures

 I thought I would add a couple textures so it wasn't just white. This is by no means a representation of what the landscape will look l...