Friday, March 22, 2019

Active Elements

So far my plan for dynamically creating random elements is working. I have an endless game universe. It is still buggy though. I'm only rendering the elements in view bug there's a problem with that logic, it seems the active area is moving faster than the current x/y somehow. I think once I get that worked out I can test that I am only creating new elements when the player is in a new location in the game.

I'm currently doing that by looking at the min/max x and y of the existing elements, if the view is beyond either I can generate more.

I ran into an issue when adding elements while I'm reading them so I added a boolean I can set to true while I'm reading them. I don't spawn anything while that's happening. So far that has resolved it while still giving me windows of creation opportunities.

I just need to debug the active element check.

Thursday, March 21, 2019

New Endless World Approach

I'm changing my approach. I've tried building and endless game world of random items using panels, related to each other and with their own coordinate systems. This has resulted in stuttering and glitchy positioning and lag. My new approach uses the idea of an exploration history. If the player goes into new territory, by about half the display width/height, random checks are made and possibly new elements spawned.

I'm not yet certain of how long a player can explore before the element count is too much for the game, resulting in lag. That will be one of my first tests. But surely I can mitigate this much easier than trying to make the panel techniques work.

My next steps are to store the created elements for restarting and saving games. I also need to code the starfield and planet surfaces, which will be tiled images. That will also be a challenge, I will have to store surface features like craters etc so the planets look the same when restarting or returning to them. It should be similar to tracking any other element type though.

Wednesday, March 20, 2019

Is It Time

I recently watched a video on a script someone authored to generate their personal blog. The script will stub in new articles etc. It was a pretty interesting idea. It got me thinking, maybe it's about time I move my blogs out of Blogger to a site I put together myself. I've hosted my own blogs in the past  maybe it's time to be better about maintaining my online presence, if nothing else, for career related work.

As I've mentioned before, I really need to get up to speed in web development anyway. It has been a long time. I've mainly been working with back end code recently. Lots of Oracle, some C# console apps, some shell scripts etc.

I would like to build something from scratch, even though the idea of using WordPress or similar is VERY tempting. I love having the ability to add functionality just by installing a plugin or two. I usually grab a basic WP theme, and rebuild the GUI completely. However I would like to build the backend as well.

So even though it may lack the power of WordPress or similar frameworks, I may have to give it a go.

Tuesday, March 12, 2019

Not Jumping Ahead

I am re-re-re-starting the space mining arcade style game. This time I want to start simple. I want to set up a grid of nine world panels and ensure they are arranged properly. THEN I will worry about populating them etc. In the past I got ahead of myself and tried to build everything out AND get them arranged correctly. This time out I want to get them arranged and moving correctly, and creating new panels as the player approaches them. Once that is working properly THEN I will populate and or load them from files.

Tuesday, February 12, 2019

My Java Project Structure

I do all of my Java coding 'by hand'. I don't use an IDE and I don't use build/packaging/deployment tools. I like to get my hands dirty and I like to know everything that is in my project, I don't want any black boxes. Of course if a project were to become so complex, or powerful, or huge as to require additional tools I will use them. But I would be sad that I had to.

I use little shell scripts I wrote to do the compiling of code and packing of .jars. I use VIM to write all the Java code. I have a common structure that I use for all of my projects and I will share that with you here.

ROOT
Each project is a self contained unit. It lives within the project root directory. In this article I will use WorldWeaver (My IntFiction engine) as our example. All of the client code, classes, and output, and anything else for the project lives in:

~/worldweaver/

At this root level I have any shell scripts I use for compiling and running etc.

CODE
The code directory contains all of my source code (.java). I follow title case for all of my classes. - However, I'm bad, I use title case for my methods as well. And I use title case for my public variable methods, camel case for my private variables etc. I think this is a habit from my .NET days.

COMPILED
The compiled directory is where I have my .class files built. This directory also contains my manifest file.

RELEASE
The release directory is where my jar file is compiled. It contains any files that are to be distributed with the app, including data files, config files, and databases etc.

The full structure is:

ROOT
  |__ CODE
  |__ COMPILED
  |__ RELEASE

I use javac with parameters for all of my building, copying and calls to java -jar in my shell scripts for launching, although I could also chmod the jar as executable and double click it like in Windows or Mac OS.

Monday, February 11, 2019

Regex, TDD Style

I've not done a ton of Test Driven Development (TDD) but from my understanding of it I like the idea. It's like checking your work in math, only backward. It forces you to check your work. You can't say: I would have checked my work but I ran out of time. At least that is my layman's perspective.

But I think the benefits of TDD may actually stretch into the core problem solving of programming. We know you have to think differently when taking a TDD approach, but I think that it could actually make the problem solving easier, and actually make learning new languages or syntax easier too.

What am I talking about? I just watched a video that walks the viewer through building regex expressions and the host did so by taking a TDD approach. He started with a valid value, and wrote a simple regex that would pass anything. Then he began to harden up the expression until it properly found only the desired values. I went away from the video with a far greater understanding of regex than I had before (I typically hamfist my way through regex use, scouring regexlib and using their tester tool to make sure what I find will work for me. Now I actually understand the syntax and rules of basic regex expressions - AND I saw a great way to actually author my own instead of copying/pasting existing expressions.

All through the use of TDD style regex expression writing.

Friday, February 8, 2019

Utopia Flip

My Tomorrowland-inspired IntFiction game is going well. I've tested the logic that randomly flips the player from a retrofuturistic wonderland to a deadly, dark dystopia. Now I'm working through some puzzles and clues in the utopian commercial district.
As I go I'm making some minor - and not so minor tweaks to the game engine. I've updated the logic block elements so that Eval blocks can be defined within the Logicset blocks, instead of requiring Logic elements to house the Evals. So it is possible to do:

{logicset
  [@eval
    ...
  ]
}

As well as:

{logicset
  {logic
    [@eval
      ...
    ]
  }
}

This will save some work when defining more basic logic checks. I may do some other time-saving updates as well. We'll see.

Best GUI / TUI

 Let's talk about my favorite GUI and TUI libraries... so far. Dear IMGUI I've used this library in a couple of projects (using the ...