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.

Author
Message
Camronas
16
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 3rd Jul 2010 04:58
Ok Iv done some programming before in C++ and Actionscript but never before in basic. I know the theroies I want to use but Im not sure how to imploment it into Darkbasic.
I want to make a basic RTS, just unit selection, building (includes units and buildings), resoure manage ment, and path finding.

The big one at the moment is pathfinding, I want to use a 2D array and use dijkstra \"iv used it before\" but I dont know if Darkbasic can do 2d arrays, any and all help is appreciated.
Coldfire
17
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 3rd Jul 2010 07:36 Edited at: 3rd Jul 2010 07:37
Yep, they can do 2d arrays, or as many dimensions as you'd like. For a 2d array you can just do something like:



You can also make arrays of multiple datatypes as well like float, boolean, and string. Hope it helps and good luck.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 3rd Jul 2010 09:58
If the issue is basic-specific and not that of the right algorithm or whatever to implement, check out the help files

help->principles

You should know how to implement the following in DBPro
user defined types
arrays
dynamic arrays (Every array in DBPro is dynamic, just use "array insert at bottom" and like commands)
2d arrays
basic 3d construction and camera commands
functions
subroutines

And then there's a lot of specific commands you can use, found in the command list. I would suggest you take a look at the following
sprites - (For transparent 2d images)
sound/music - (for... sound and music)
file commands - (loading and saving files/images/sounds/save games)
display commands - (screen resolution, fullscreen mode, that stuff.)
and of course, select "core commands" (all the useful stuff like sqrt(),exp(),cos(),sin(),wrapvalue(),array count() etc.)

If you're good with all of the above, then you would have almost no issue with the language barrier , but you don't actually need to go trying to look and read through every single section at the same time. Just keep in mind that the information is there, and follow through tutorials, and most importantly - write your own 100% original code every once in a while; Following through a tutorial, it might seem like it makes sense, but odds are it'll be forgotten fast, or found confusing later.


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd Jul 2010 13:29
Types quite straightforward in DBPro, I mean say you wanted a 2D array with 256x256 elements, typed with a few variables.

Type maptype
Mode as integer
Tile as integer
Flag as integer
AvgHeight as float
command$ as string
Endtype

Dim map(256,256) as maptype

Then you can reference it like this:

If map(x,y).flag = 10

For instance. DBPro lends itself well to game programming I think, there is also DarkGDK, which is basically the DBPro engine but for C++, you might be more comfortable and productive in that if you already know C++.


Health, Ammo, and bacon and eggs!
Camronas
16
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 4th Jul 2010 07:04
Hmm DarkGDK sounds interesting, Im guessing it makes darkbasic Object oriantated. Ill look into it anyway, thanks. Any more words of wisdom?

Login to post a reply

Server time is: 2026-07-25 09:40:32
Your offset time is: 2026-07-25 09:40:32