Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Need Some Help With A Text-Based Prototype

Author
Message
MonchoMeecho
9
Years of Service
User Offline
Joined: 10th Aug 2010
Location:
Posted: 28th Jun 2011 12:53 Edited at: 28th Jun 2011 14:03
Hey guys, just looking for some assistance.

I have very limited knowledge with DarkBasic as I haven't used it for a very long time.

Basically I'm looking to set up text-only system that simulates battles between two or more characters and outputs the most likely outcome based on statistics I input (like attack, defence rate of fire etc).

So during fights I could factor in things like speed and a probability added to that to calculate how likely one character is to dodge an attack. I'd like it to run multiple tests and basically show results on deaths, survivals and draws for each character.

Thanks in advance for any help you guys can provide, some code examples will be greatly appreciated.
Libervurto
13
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Jul 2011 20:48
Nice to meet you MonchoMeechu!

First of all I'm going to assume there are many characters in your game, maybe a hero and several monsters. So if we're going to make lots of entities that use similar data, its a good idea to store them all in one array. This array will act as a kind of database for the program, we'll simply reference the data we need, as we need it.

Now we've decided how we'll store the data, let's think about what kind of attributes we want and how they will be used. We want a range of fighters, ones that are big and strong but slow, and ones that are small and fast but weak, and others in between the two extremes. Strength, speed and hit-points would be good attributes.
Let's write the array.

There are only four characters at the moment, but all characters would be stored in this array including the player character.
We're missing one important piece of data! The names! We can't store them in the same array because the array is of integer type and so can only store integers. We must make a separate string array to store the names.

Notice how although we need two arrays to store the data, the data command can hold data of any type! DATA is a great way to hold pre-defined data in your programs, the trouble is that the data they hold must be read sequentially and you have to reset the pointer to get to previous data. That's why we transfer the data to arrays, because we can access any element of data by referencing its index number/s, also arrays are writeable during run time whereas data lines are not.

I'm dozing off here, need a nap... I will come back and finish this later.

MonchoMeecho
9
Years of Service
User Offline
Joined: 10th Aug 2010
Location:
Posted: 2nd Jul 2011 11:03
Thank you very much for your help so far
MonchoMeecho
9
Years of Service
User Offline
Joined: 10th Aug 2010
Location:
Posted: 4th Jul 2011 01:40
Sorry I posted this in the wrong forum (was meant for the DBPro forum), how different is it from classic?

Either way, I reposted the thread into the correct forum which hopefully won't cause any issues.

Login to post a reply

Server time is: 2019-08-23 23:46:17
Your offset time is: 2019-08-23 23:46:17