10.03.2019 - Round 1 results of our "A Love Letter For FreeBASIC" game dev competition have been published. Please be sure to check the results thread: http://games.freebasic.net/forum/index.php?topic=629.0. Don't forget that the competition is continuing with a round 2, lasting till 29th of April, 300 USD first prize. Stay tuned!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - rdc

Pages: 1 2 [3] 4 5
Work In Progress / Re: Text adventure
« on: March 24, 2011, 05:35:56 AM »
I have written several of these games using just the [verb] [modifier], [object] model. You can create a nice game with just those two or three input commands. All of the early adventure games used a two or three word input until the z-machine came out. The best thing you can do is to make the game completely data driven, i.e., build an engine not a game. The game will be the data files. That way you can create new adventures by just changing the data.

I wouldn't recommend getting more detailed than a verb-object input string since the complexity grows very quickly. If you want to do something complicated, then look at Inform. Inform uses an updated z-code compiler, which is what all the Infocom games used. You can get very detailed with that, much more than you can coding something up.

Game Dev / Re: Let's Build a Roguelike (Draft)
« on: March 14, 2011, 02:09:58 PM »
Oh, the actual game itself it quite weak since to was made just to show the techniques. It is playable, but it has just the bare bones in it, so it probably isn't all that interesting over the long haul. Maybe in the second edition, I can make an interesting game. :)

Game Dev / Re: Let's Build a Roguelike (Draft)
« on: March 14, 2011, 02:07:40 PM »
Happy to do it. I'm taking a little break, but I will get back to it soon. I am going to clean it up, add a few extras (like Developer Notes) and put out a final release.

Game Dev / Let's Build a Roguelike (Draft)
« on: March 12, 2011, 01:35:19 PM »
Let's Build a Roguelike is a step-by-step tutorial in ebook format on creating a roguelike game from conception to finished product. The tutorial covers all the aspects of the game, from creating the title page, dungeon building, inventory items, monster ai, combat, file saving and creating a morgue file. The draft version is now available.

Chapter List, download and screenshots available at:


General Discussion / Re: The world according to Americans
« on: December 08, 2009, 06:38:40 PM »
Ha, ha. I'm done here.

Programming / Re: Unix or Mac OS support?
« on: November 07, 2009, 05:43:00 PM »
I don't think so. There are no active developers on FB right now bringing in new features, just some minor bug fixing. I doubt that the language will evolve much beyond its current state.

Programming / Vector Object
« on: October 26, 2009, 06:37:44 PM »
I developed a 2D vector object for DDD2 so I thought I'd post it in case someone may find it useful. I only added the operators I needed.

Code: [Select]
* Name: vec.bas
* Synopsis: 2D Vector object
* Description: This implements a 2D vector as an object along with useful operators.
* Copyright 2006, Richard D. Clark
*                          The Wide Open License (WOL)
* Permission to use, copy, modify, distribute and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice and this license appear in all source copies.
* ANY KIND. See http://www.dspguru.com/wol.htm for more information.

'2D Vector type.
Type vec
_x As Integer
_y As Integer
Declare Constructor ()
Declare Constructor (x As Integer, y As Integer)
Declare Property vx (x As Integer)
Declare Property vx () As Integer
Declare Property vy (y As Integer)
Declare Property vy () As Integer
Declare Operator Let (rhs As vec)
Declare Operator += (rhs As vec)
Declare Operator += (rhs As Integer)
Declare Operator -= (rhs As vec)
Declare Operator -= (rhs As Integer)
Declare Operator *= (rhs As Double)
Declare Sub ClearVec()
End Type

'Empty constructor. Used when part of another object.
Constructor vec ()
_x = 0
_y = 0
End Constructor

'Initialzed vector.
Constructor vec (x As Integer, y As Integer)
_x = x
_y = y
End Constructor

'Properties to set and return the x and y components.
Property vec.vx (x As Integer)
_x = x
End Property

Property vec.vx () As Integer
Return _x
End Property

Property vec.vy (y As Integer)
_y = y
End Property

Property vec.vy () As Integer
Return _y
End Property

'Assignment operator.
Operator vec.Let (rhs As vec)
_x = rhs.vx
_y = rhs.vy
End Operator

'Translation operators. These operate on both components.
Operator vec.+= (rhs As vec)
_x += rhs.vx
_y += rhs.vy
End Operator

Operator vec.+= (rhs As Integer)
_x += rhs
_y += rhs
End Operator

Operator vec.-= (rhs As vec)
_x -= rhs.vx
_y -= rhs.vy
End Operator

Operator vec.-= (rhs As Integer)
_x -= rhs
_y -= rhs
End Operator

'Scaling operator.
Operator vec.*= (rhs As Double)
_x *= rhs
_y *= rhs
End Operator

'Translation operators.
Operator + (lhs As vec, rhs As vec) As vec
Dim tmp As vec

tmp.vx = lhs.vx + rhs.vx
tmp.vy = lhs.vy + rhs.vy

Return tmp
End Operator

Operator - (lhs As vec, rhs As vec) As vec
Dim tmp As vec

tmp.vx = lhs.vx - rhs.vx
tmp.vy = lhs.vy - rhs.vy

Return tmp
End Operator

'Scale operator.
Operator * (lhs As vec, rhs As Double) As vec
Dim tmp As vec

tmp.vx = lhs.vx * rhs
tmp.vy = lhs.vy * rhs

Return tmp
End Operator

'Sets vector to 0.
Sub vec.Clearvec ()
_x = 0
_y = 0
End Sub


'Test program.

Dim v1 As vec
Dim v2 As vec = vec(10, 10)
Dim v3 As vec

'Show initial values.
Print "Inital Values"
Print "Vector 1 x: " & v1.vx & " y: " & v1.vy
Print "Vector 2 x: " & v2.vx & " y: " & v2.vy

'Translate vec1 by 1.
v1 += 1
v2 += 1
Print "Translate +1"
Print "Vector 1 x: " & v1.vx & " y: " & v1.vy
Print "Vector 2 x: " & v2.vx & " y: " & v2.vy

'Translate by -1.
v2 -= 1
Print "Translate -1"
Print "Vector 2 x: " & v2.vx & " y: " & v2.vy

'Scale by .5
v2 *= .5
Print "Scale .5"
Print "Vector 2 x: " & v2.vx & " y: " & v2.vy

'Translate operators
v1 += v2
Print "Translate by Vector (+=)"
Print "Vector 1 x: " & v1.vx & " y: " & v1.vy

v1 -= v2
Print "Translate by Vector (-=)"
Print "Vector 1 x: " & v1.vx & " y: " & v1.vy

v3 = v1 + v2
Print "Translate by Vector (+)"
Print "Vector 3 x: " & v3.vx & " y: " & v3.vy

v3 = v1 - v2
Print "Translate by Vector (-)"
Print "Vector 3 x: " & v3.vx & " y: " & v3.vy

v2 += 1
v3 = v2 * .5
Print "Scale by Vector (*)"
Print "Vector 3 x: " & v3.vx & " y: " & v3.vy

Print "Clear Vector"
Print "Vector 3 x: " & v3.vx & " y: " & v3.vy


Work In Progress / Re: DDD2
« on: October 20, 2009, 07:05:59 PM »
Thanks, I missed that one.

Work In Progress / Re: DDD2
« on: October 20, 2009, 04:07:06 PM »
I have added some info on the game mechanics to the DDD2 page which you might find interesting.


All of this (when in a final form) will go into the game manual, so I thought I would start jotting down the notes now as I work on them.

Work In Progress / Re: DDD2
« on: October 18, 2009, 01:58:43 PM »
Yeah. This will be a tile-based roguelike.

Work In Progress / DDD2
« on: October 18, 2009, 09:48:20 AM »
DDD2 is a complete rewrite of my first major roguelike game, Deep Deadly Dungeons. In DDD2 you must find the Crown of Alegare, along with the seven Stones of Power to claim the throne and kingdom.

DDD2 will feature different player races, different player classes each with a set of unique skills. Explore 24 massive randomly generated dungeons, fight against 52 different classes of monster, with each monster uniquely generated so no two monsters are ever the same, and a large set of armor, weapons, potions, spells and other items.

DDD2 will also feature an alchemy and crafting system so that you can upgrade weapons and armor, and create new items by combining traits of existing items.

The homepage for DDD2 is here. I have a couple dev screen shots there now, but not much else.

Programming / Re: Evolutionary AI
« on: September 03, 2009, 07:20:24 PM »
What you are looking for here is a classifier system (CS) which is a combination of a genetic algorithm (GA) and selection method. A GA is a search algorithm, a way to select a set of genes through a fitness function. The CS reads the data from the environment, adjusts the GA parameters so that the selection process generates genes that matches the current environmental conditions. It may sound a bit complicated, but it is actually quite straight-forward. The difficulty is in the creation of the DNA code and assigning a fitness function.

GAs are quite easy to code (I have done a few over the years).

First you need to define the gene code. For example, suppose that you are creating an agent that can eat, move and reproduce. These are the actions that the CS would control within the environment based on the current environmental conditions. However, they don't define the genetic makeup of the agent, so you have define the basic genes that generate the behaviors. Some possible genes could be energy level generated from eating, reproduction level based on energy level and age, age of the agent in generations, and movement speed that would also be based on energy level or some other factor.

You could also approach the problem based on characteristics. For example, you could define a mouth that allows the agent to eat a certain amount, the number of legs that would determine the speed of the agent, the sex of the agent so that it could only mate with certain other agents, and so on. The gene structure depends on how you want to express the behaviors of the agent.

Once you define the gene code, you need to define a fitness function for the agent. What is the criteria for successful agents? For biological systems, success means reproduction, so the fitness function for something like an simulated agent would simply be surviving until it can reproduce. If you introduce a crowding factor into the simulation, that is more agents mean less food so the system is self limiting, you don't really need to define an external fitness function, since the crowding factor will act as a fitness function eliminating under-performing agents.

For the first generation, you simply generate x number of agents using randomly selected values for the genes. After that, you can use existing agents to generate new agents through reproduction, and occasionally introduce a random factor into the mix through mutation or spontaneous (random) generation.

The next thing to look at is the reproduction method. If reproduction is asexual, then you swap genes within the agent with a chance of mutation. In order for this to work, all of the gene criteria need to have the same meaning. For example, suppose you have a gene code of: energy | max age | speed. The values of each range from 1 to 100. These would represent percentages rather than actual numbers so that you are working with genes that relate to each other in a meaningful way. The actual numbers of the gene values could be anything, and different from one another, but making them percentage amounts within the gene definition enables you to manipulate the genes without worrying about range issues you might have with actual values.

So, to generate a new agent, you cut the gene randomly at a boundary.  Say you randomly select the energy-max age boundary. This leaves you with energy and max age | speed. You then swap the genes, resulting in max age | speed | energy. These are then mapped into the new agent gene code so that energy < max age, max age < speed, speed < energy. This is why the gene code needs to be consistent since you are mapping the values of the old gene to the new gene.

Once the gene is mapped, you can see if a mutation occurs, a very small chance, and then adjust a characteristic by a small amount. This helps keep the gene pool from stagnating.

For sexual reproduction, you randomly swap genes from two agents to produce the new agent. In this case, the gene values do not have to be consistent, since you are working from two different genes and the transfer is from one characteristic to another characteristic, without crossing over. You could introduce crossover is you want, but again, the genes need to be consistent.

The CS would then take all the agents and perform the different defined behaviors for a cycle based on the gene values. These could be different for each agent or the same for all agents. They could be another set of genes in addition to the characteristics. The behaviors might be: die due to old age or starvation, eat, look for food, move to food, avoid predator and reproduce. The cycle would then repeat.

Showcase / Re: Operation Flytrap (Tower Defense)
« on: May 03, 2009, 11:54:36 AM »
Cool. I have been wanting to do a TD game for a while now. Maybe I'll do a RL one.

Work In Progress / Re: Revisiting an FB Roguelike
« on: March 29, 2009, 03:30:40 AM »
I like the concept of this. One idea that comes to mind is being able to purchase real estate that you would mine with the funds collected. You could create an over-world (see my island generator on the FB forums) where each point on the map represents an area you could potentially mine. You purchase an area from the Land Company and start digging. You could also purchase an array of machinery and tools to help you mine areas (instead of shields and swords). The end game could be a certain dollar amount, say a million dollars, Euros, credits, whatever.

I think this would work well as a multiplayer game because you could sneak over to a competing mine, beat up the owner and take it over. So you would always have to be aware of building defenses of some sort, maybe sentry bots, cameras--stuff like that. If you lost a mine, you'd lose your investment, but could just simply start over with whatever funds you had available.

Work In Progress / Re: 7dRL: Escape from Lab 42
« on: March 17, 2009, 07:43:59 PM »
I have a Linux version of 0.2 is up thanks to E.K. All the files can be found here:


Pages: 1 2 [3] 4 5