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 / DBC classic noob help

Author
Message
Mik3 Burg3ss
20
Years of Service
User Offline
Joined: 16th Mar 2005
Location:
Posted: 9th Jan 2007 22:24
Hi all,

I'm new to darkbasic and programming alike. I know next to nothing (printing text) and would appreciate it if somebody could help me get the fundamentals down. Maybe learn how to import a character and have him walk, accepting input like names, etc. etc.

I'm currently running darkbasic classic, and using milkshape for models. I've run over different concepts for a game, and I know I'm getting ahead of what I can do. I hope I'm not sounding like an idiot for being so horrible.Any help would be nice.

Michael
H4ck1d
19
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 9th Jan 2007 22:38
Don't worry about it, we all have to go through this stage . I'd say a great place to start are the tutorials in the Developer's network:

http://developer.thegamecreators.com/?f=db_tutorials

There are 2 for DB Classic, and they're both great in my opinion. Just follow along and try to figure out what each line does, and you'll learn quickly. Good luck!

-H4ck1d

Mik3 Burg3ss
20
Years of Service
User Offline
Joined: 16th Mar 2005
Location:
Posted: 9th Jan 2007 23:17
Hey, thanks man! I tried looking over the newcomer section but they were all for DBP. I'll look at them and give 'em a go.

Michael
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 10th Jan 2007 00:02
You could also look at the command index in DBC.

Happy Coding!

Mik3 Burg3ss
20
Years of Service
User Offline
Joined: 16th Mar 2005
Location:
Posted: 10th Jan 2007 00:05
Thanks Jordan Stories Games,

I actually tried that a while ago but found that it wasn't very useful. It had a few good examples, but I think I'll stick to on the site/ forum. Thanks!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Jan 2007 15:13
Quote: "I tried looking over the newcomer section but they were all for DBP."


You didn't look very hard then did you?

Most of the time, all I get from my tutorials is complaints because they are only for DBC. You can't win!

They are actually ALL written in and for DBC - dozens of them - and the vast majority of the information contained in them also applies to DBP.

TDK_Man

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 12th Jan 2007 01:38
The examples can help a lot if you really look into them and experiment. I just recently (over the summer) discovered this site. I'd been learning on my own for about 3 years before off of the examples. Anyway, just to give a hint the LOAD OBJECT command loads models in. to make them move, try the MOVE OBJECT command. You will need a loop too. to get simple loading and movement, you'll need these commands. Of course there are other ways to do it, but this is a good starters way:


SYNC ON
SYNC RATE
LOAD OBJECT
MOVE OBJECT
TURN OBJECT RIGHT
TURN OBJECT LEFT
DO
SYNC
LOOP


If you need an example just ask. But there are lots on this site anyway.

TheSquid
21
Years of Service
User Offline
Joined: 29th Sep 2003
Location: Ohio
Posted: 12th Jan 2007 17:20
H4ck1d has it right. The Binary Moon tutorial will tell you just about everything you need to know to get you going. It's an excellent resource, and is even being "borrowed from" on other sites.
Mik3 Burg3ss
20
Years of Service
User Offline
Joined: 16th Mar 2005
Location:
Posted: 12th Jan 2007 21:26
Hey,

Thanks guys. I've been messing around with the code from different tutorials, and it all seems good. But I was wondering, how could you play audio, and then pause it until they hit enter? Thanks
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Jan 2007 03:18 Edited at: 13th Jan 2007 03:19


Simple enough? The SYNC stuff isn't needed right now, but it's a good habit to get into for 3D games.

Image All
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 13th Jan 2007 03:52 Edited at: 13th Jan 2007 04:01
I don't have DBC, so I'll just post the basic guidelines about making a game engine. :P

There are several parts to a game engine:

1) Initialization
2) Loading the required media
3) Setting global variables and declarations
4) The game loop
5) The functions, which play as external parts of the game loop

Initialization
Set up the refresh rate, screen resolution, etc.

Loading the required media
Load the character model, world, enemies, sounds, music, etc.

Setting global variables and declarations
Define variables like floats, bools, etc. to hold information about where things are and what they are doing. Also define custom datatypes*.

The game loop
This is where the game actually becomes a game. The system goes through this loop and repeats everything within it, until the user exits the game or goes into a different loop (like a menu loop). The game loop will take input from the user, perform the required operations, and control enemy movements, item stuff, move the player, etc. etc.. At the end of the loop the screen is refreshed to apply the changes made to the game world by what happened in the game loop.

Functions
These are little pockets of code which can be referenced by the game loop. Functions can be used to calculate collision, control enemies, control projectiles, and basically everything, in seemingly one line of code: the function call. When a function is called upon, the program jumps to the start of the function and executes the code within. When a function has reached its end, the program jumps back to where the function was called and continues on. The functions belong at the bottom of the program and after the game loop.



*
Custom datatypes can be defined by the programmer to create your own type of variable. You could create a variable that contains the whereabouts and current actions of the player, for instance. Custom datatypes (often referred to as "UDT"s for "User Defined Types") come in extraordinarily handy when controlling many objects of the same type; enemies or projectiles, for instance. A user defines a type like so:

A variable may now be created to be of type Enemy:

You may now store information about the enemy in the Guy variable:

This type of variable becomes exceedingly useful when handling multiple enemy objects, stored in an array of type Enemy:

You may now access up to 10 different enemy's information by referring to only one array:


Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 13th Jan 2007 04:04
i made a tutorial
http://forum.thegamecreators.com/?m=forum_view&t=96547&b=7
its designed for DBpro but im sure it will work in DBclassic if not ask me how to solve the problems

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Jan 2007 17:10
Kieran:

How long have you been programming?

There's no nice way of putting this, and at the risk of sounding like the 'bad guy', I suggest that your tutorial needs a fair bit of work doing on it.

The basics are there, but you are advocating the use of very bad programming practices. Hell, you even use GOTO - a programming crime worth hanging someone for in my book!!

People new to programming will believe what they read in a tutorial and take it as gospel. Bad practice at that point becomes a habit difficult to get out of, so it's vitally important that the author of tutorials knows what they are talking about and has lots of programming experience.

I'm sorry, but too many people are writing 'tutorials' at the moment who have little programming experience and don't grasp basic programming concepts. It's not only you.

Rant over!

I think a tutorial on making tutorials post is in order...

TDK_Man

Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 13th Jan 2007 19:49 Edited at: 13th Jan 2007 19:50
i may as well remove it, no1 has used it anyway....

and i see alot of people use GOTO function so i think thats the bad thing in your head, its a good way to go to a certain part of the program

EDIT: but just so i know whats wrong other than your little "GOTO" problem?

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Jan 2007 22:31
I wasn't suggesting your tutorial was the worst I've seen - far from it. It only needs a bit of sorting out, so I've created a guide for anyone who want to create tutorials on the Newcomers board.

Structuring (which in turn removes the need for Goto's) and indenting the code would be the first thing I'd do and fill out a few gaps in the explanations of what the code does.

Basically in a tutorial you are writing a story which educates people. The trick is making it an interesting story.

Quote: "and i see alot of people use GOTO function so i think thats the bad thing in your head, its a good way to go to a certain part of the program"


Well they are just plain wrong using it!

It may well be a good way to go to a certain point in your program, but just how do you get back? And, what keeps track of all the infernal leaping about here there and everywhere?

What's more, what happens when your program doesn't work properly and you have to trace through it? You are wading through spaghetti code jumping from A to B and then to C, whereas I go directly to a procedure which is correctly labelled with the task it does.

Imagine tracking Goto's with a 10,000 line program!

It just makes sense to completely ignore the Goto command and rid yourself of all the future hassles. I stopped using Goto over 20 years ago, so believe me I know what I'm talking about!

TDK_Man

Mik3 Burg3ss
20
Years of Service
User Offline
Joined: 16th Mar 2005
Location:
Posted: 13th Jan 2007 22:41
Hey all,

Thanks for giving me the tutorials on the audio, and just making a game! You guys have made it way easier for me to make my game by providing me with code and support.

I'll leave another message here when I run into my next problem( which I guarantee will be soon)
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 14th Jan 2007 00:15
uhhh okay what do u use then? and could u actually SAY whats wrong not just parts are missing because i dnt know WHICH parts are missing

thx

Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 14th Jan 2007 00:17
hang on a secyour complaining about the goto which all it does is exit the loop and goto the code directly below it, nothing to do with skipping anything

so wheres the problem with that? or do i put a repeat until loop and make sure it exits the loop once the button is clicked

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Jan 2007 11:30
Quote: "hang on a secyour complaining about the goto which all it does is exit the loop and goto the code directly below it, nothing to do with skipping anything"


TDK is totally right... "goto" should never be used. It creates spaghetti code which is really hard to follow the program flow.

http://en.wikipedia.org/wiki/Spaghetti_code

If it was always used like you said why use "goto" at all?

The wrong way:



The right way:


Of course you know that "goto" is never used so cleanly. If you have to use "goto" use "gosub" instead... it's a better replacement because it "return"s back to where it came from.

I did look at your code (in the tutorial) and the worst possible thing you can do is exit a function with a "goto" statement. When you do that you're just begging for a major error.

Login to post a reply

Server time is: 2025-05-26 03:03:30
Your offset time is: 2025-05-26 03:03:30