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.

Newcomers DBPro Corner / Tutorial - Using the data command to make levels (DBP only I think)

Author
Message
Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 26th Jan 2007 20:43 Edited at: 26th Jan 2007 20:49
Welcome to the tutorial

I'm here to inform you about the data command and if you are patient enough to read this then I will be able to show you how
to make data and then turn it into something much more exciting.

There's bound to be a lot of people out there that do not own CShodata4 or 3DWS or any other level maker, you may not want it, can't get it or aren't good with it. Or on the topic of 2d you may be looking for a way of making tileset levels but you just can't find a thing... either way making levels is probably a total pain for you (Unless you are great at it and have a great level designer)

There is a way of making media or whatever without actually using any files to load them from. In fact there is a way of making your media entirely from code, you can do this with the data command and in a moment I shall show you a basic way in which it can be used.
Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 26th Jan 2007 20:47 Edited at: 26th Jan 2007 20:47
The data command (Part I)

A basic form of media that can be made with the data command is levels, especially 2d ones... now lets assume you have a super cool
idea for your level (It is attached to this post), it's going to be (in this example) a game with 3d graphics but 2d gameplay.

But oh no, you don't have a level designer and don't want to use one as it will take time... the data command can solve this problem
and your level won't even take udataspace as .x files do!

Lets put your level into number form:

000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000022222222220000000000000000000000000000000
000000000000000000000000011111111110000000000000000000000000000000
000000000000000000000000011111111110000000000000000000000000000000
000000000000000000000000000000000110000000000000000000000000000000
000000000000000000000000000000000110000000000000000000000000000000
000000000000000000000000000000000110000000000000000000000000000000
000000000000001111110000001111000110000000000000000000001111000011
000000000000000000000000001111000110000000000000000000000000000011
000000000000000000001111101111000110000000000000000000000000000011
000000000000000000000000001111000110000000000000000111100000000011
000000000000000011111000001111000000000000000000000000001111000011
000000000000000000000000001111000000000000000000000000000000000011
111111111111111111111111111111111111111111111111111111111111111111

0 is empty space
1 represents the wall/floor
2 is those random spike things in my drawing

Now put the command "data" at the start of each line and also put commas in between the digits. Finally lets give the data a name:

Data1:

data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

The data above is labelled as Data1... The data command is very flexible, it allows a limitless (well, space will still be taken up so
not completely limitless) number of data and there is no limit to the number of rows or columns you can have.

The next topic is to read the data

Attachments

Login to view attachments
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 26th Jan 2007 20:48
The levels ppl make with this i only for 2d or 3d and what kind of games?

Mess with the bests, die like the restes!
Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 26th Jan 2007 20:57
Wow that was a quick reply,

you can make all sorts of stuff with the data command, music, bitmaps, levels etc.

When it comes to making levels with it you can make either 2d or 3d levels, I'm making a 2d level here but 3d levels are possible... they'd just be more complicated.

The games you can make with this varies, platformer games are easy to make with this, for example something like a super mario style game that only requires the construction of things like boxes and cylinders. But you could make other games like arcades etc.

Anyway using data is much better than making your code confusing like this:

Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 26th Jan 2007 21:11 Edited at: 26th Jan 2007 21:31
Reading the data to make a level (Part II)

So far your code should merely be the data commands that are above, now then lets show you how to make a level from that code.
Just for the record the data is 14 lines long and there are 66 digits on each line.

DON'T JUST COPY THIS, YOU WON'T BENEFIT


Because I am kind I have sorted out a basic example for you which includes code as well as several helpful comments for the unsure. Most of the comments are about the commands that read the data, This code reads the numbered (jibberish like) data from above and turns it into that dream level I made up earlier. It manages this by reading off each individual digit.

If you now understand this then you should understand how this works and thus make your own more cool and complex version. Maybe in the future I will post more on the topic.

Enjoy! This code is especially good for 2d style platformers as I said above and collision with this should be nice and easy. But 3d could also be attempted if you are brave.

Data is a good way of making levels because it makes less of a jumble
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 27th Jan 2007 08:53
So far this is a commented code snippet, not a tutorial. Id recommend reading over TDK's "Tutorial on Making Tutorials" and then having a stab at redoing this.


:: Check out the new FPS Tutorial's Progress at http://www.freewebs.com/ruccus
along with code, media, and more.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Jan 2007 09:11
I kind of have to agree with Ruccus. Also, the code should work fine in DBC.

Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 27th Jan 2007 11:26 Edited at: 27th Jan 2007 11:28
Ok then, I guess it doesn't hep having the code all clumped into one snippet... I'll have a look at TDK's tutorial.

Even so, some newcomers could benefit from it (Without copying completely).

Login to post a reply

Server time is: 2024-09-25 17:29:15
Your offset time is: 2024-09-25 17:29:15