I usually don’t (in fact I think this is my first time!) repost stuff from other blogs but I find this particularly interesting: Disable Your Antivirus Software.
This is a compilation of all my posts about using procedural content generation to create a random 2d RPG world.
The first step is to create a heightmap. This randomly generated bitmap will serve as the basis of the world map. Then we can convert this heightmap to our world map. Finally we can generate some random names for our map (world name, city names, etc.)
Create the heightmap
Create the 2d world map
I had used an open source implementation of the A* algorithm to add roads between cities. Sadly, I have never written about it. But here is a link to the relevant code:
Generating random names
Finally here is a link to a Github repository where I had implemented these algorithms:
// TODO: filter employees by role
The best use for TODO comments is when you are actively working on a change set, adding TODOs that will be replaced with actual code as you work. These TODOs will be removed before you commit to source control.
In this case you add a TODO, signifying an intention to return later on to complete the code.
Before committing code to source control, it’s always a good practice to review all your changes with a diff tool. This is the perfect time to scan for leftover TODOs in the code and implement them.
Another case for TODOs is for something that will truly be implemented in a later commit. Before leaving those kinds of TODOs in the code ask yourself if you shouldn’t rather create an issue in your issue tracker. Otherwise this second kind of TODOs tend to accumulate and pollute the source code. They experience the same kind of code rot as old commented out code does.
TODOs that you leave after a commit should be for changes that are small, implementable in the foreseeable future and relating to source code rather than business processes.
Before leaving those kinds of TODOs in the code ask yourself if you shouldn’t rather create an issue in your issue tracker.
On larger projects you tend to see TODO comments which are several years old. Just today I found one that source control indicated was 3 years old. The person responsible for the comment may not even be working here anymore. While reading this specific comment could give me a general idea of what should be accomplished it does not do so clearly enough that I can go do it. Or why for that matters it needs to be done. You tend to see these often enough.
This is similar to commented out code, where nobody knows why the code was commented out in the first place and thus leave it as it is thinking it may be important. As time goes by there is less and less chance of someone actually knowing why the code was commented out. So it stays there until someone is brave enough to just delete the useless comment (how can it be useful if no one knows why it’s commented out). Keeping track of old code is the source control’s job anyway.
I have decided to start a new project, it’s purpose is two-fold:
- do something I am really interested in (random world generation)
- be an excuse to use some tech that I want to use and to learn some new ones I am interested in learning
For this project I will specifically make it a point to use :
- VS Code
- .Net Core and ASP.Net Core
- ASP.Net Web API
If I see something that doesn’t work or that I don’t like along the way (say I want to replace VS Code with Atom or Angular with React), I won’t bat an eyelid and just make the switch.
The project itself will be a website that allows visitors to create and display a procedurally generated world. I am naming it after the Genesis device from Star Trek III.
I have already created the GitHub repo. My time is severely limited so I don’t know how much time I will be able to invest in this but I don’t mind going with a slow and sporadic approach since this is a personal interest project.