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.

2D All the way! / a fresh 2d start!

Author
Message
haXor
20
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 10th Jul 2003 06:08
OK well, i was just thinkin about how cool iot would be to make a 2d game, yah it was kinda random, but im driven by these things, so i tried it. First I tried to draw a dude and it worked out ok, not great, but it will improve. next I tried to figure out how i would make a movent engine, like you take a step, and it moves a block (like pokemon, dont laugh, its good for road trips) but yah so i thought about making a grid and mopving to the corners but then i relied i had to load tiles so i could move o them and then i had to make a level generator, and now im damn confused! feh, that was good to get off my chest. lol

Right, so i came here to ask for some tips and the like. I dont want the code or anything, i want to do that myself, but like what goals should i shoot for and what steps would be advised? thanks for the replys, if i get any
~haXor
Sup Kids
Drum
21
Years of Service
User Offline
Joined: 10th Apr 2003
Location:
Posted: 10th Jul 2003 07:21
Well,
If you are gonna create some 2d levels you will have to make it tile based.. to save you alot! of coding. You dont have to have a level editor/generator thing but if you do it will make making level so much easier. Your best bet is to create a 2d array and from that associate the numbers stored in it to different tile images. creating new columns and rows and deleting them as you walk about your level. It's alot of hard work but don't be discouraged iv'e seen afew code snipps around this board with could be of helpful start.

btw check out the flashkit forum - game making
http://www.flashkit.com/board/forumdisplay.php?s=b607e1859bdaced7dbddb1debbcc6092&forumid=5

I know its Flash but its got a hell of alot of stuff on tile base programs.. check out peoples examples and itll clear things up tonnes!

Hope that helped
nick
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 10th Jul 2003 19:06
I have a very basic example of a 2D tile based world, that I was working on to get used to the DBC commands. Perhaps it will help you. My code is usually easily understandable and well commented. Mind you this isn't optimized in any sense of the word, but it should get you moving in the right direction. I am goin to look it over and post it in a few minutes. You may have to draw some simple tile graphics, and a simple character sprite to see it fully. If you want my media email me at zenassem@hotmail.com.

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 10th Jul 2003 19:20 Edited at: 10th Jul 2003 19:28
[edit] I just re-read your post an realized that you didn't want the code. If you don't mind, I would like to leave it here for anyone else that is sor-of having similar problems but would like to see a simple of example of how it can be done. If you do not want it here under your post, just say so and I will edit it out. I will try to post some helpful suggestions later tonight without the actual code.
Thanks Zenassem

Here is the basic tile engine code. The only thing that you will need to do is create 4 solid color tiles, asnd save them in your projects directory. You can either name them as I have in the "load images" lines, or change the filenames in the code to match your names




This is the code that uses more media, such as animated character and music. To get this to work, you will need to do the above + have a character animation of 12 frames, and a music file. It also contains backdrops for the battle engine, monster encounters, 5 layer world array etc... etc... Again if you want me to send you the media, e-mail me at zenassem@hotmail.com



haXor
20
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 11th Jul 2003 00:40
Now this may seem like a dumb, question, but what exactly is the data at the bottom, and how did u make it?

Sup Kids
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 11th Jul 2003 03:48 Edited at: 11th Jul 2003 04:22
Actually this is a very good question.
First I'll quote the DBC documentation and then I will expand upon it's specific use in this situation.

DATA
This command allows you to create a sequence of data values as part of your program. The values can be integer, real or string values. You may place the data values in any order you wish providing you seperate each one with a comma or place new data values in a seperate DATA statement. Data values can be read from the DATA statement using the READ command, and the point at which the data is read can be reset using the RESTORE command. You can seperate batches of DATA statements using labels in orfer to segement your data for alternative uses

SYNTAX:
DATA datalist

Ok, Now in my example the "data values" (integers) each refer to a specific graphic tile. For example 0=Land tile; 1=Water tile. So, the actual data statements are an integer representation of the game world. So a 10 x 10 world could be represented like this

rem [note it is important to use labels so that you can restore to rem the beginning of the worldata at anytime.

worldata:

rem 0 1 2 3 4 5 6 7 8 9

data 1,1,1,1,1,1,1,1,1,1 rem 0
data 1,1,1,1,1,1,1,1,1,1 rem 1
data 1,1,0,0,0,0,0,0,1,1 rem 2
data 1,1,0,0,0,0,0,0,1,1 rem 3
data 1,1,0,0,0,0,0,0,1,1 rem 4
data 1,1,0,0,0,0,0,0,1,1 rem 5
data 1,1,0,0,0,0,0,0,1,1 rem 6
data 1,1,0,0,0,0,0,0,1,1 rem 7
data 1,1,1,1,1,1,1,1,1,1 rem 8
data 1,1,1,1,1,1,1,1,1,1 rem 9

[in keeping with my example. this map would be of an island surrounded by water]

Now, These values will be read one by one into the World array. Later they will be read from the World array by the Tile Plotter routine to decide what tile needs to be drawn.

The integers in the data statements corolate to the imgage# of the tile graphic.

Now to create maps you edit the data statements by hand (hard-coded). By changing the values, you hence change what the map look likes. Obviously this method is ok for testing but not very practical for an entire game. For this you will eventually create a map maker that essentially reverses this whole process. But rather than write the values as data statements you usually write the integers out to a comma delimited file.

And rather than read in from the data statements, you would open and read in from the data file (normally just a simple .txt file)

The Data statement than just lets you basically have a text commas delimited file right in your source code. It is easier to setup to use for testing, rather than dealing with external files.

[Note for a 3 layer map (layers 0-2) the data statements would look like this]
[for this example I am using 0 to represent a null/transparent tile]
[0=transparent; 1=water; 2=land; 3=item]
[Also of note the charcter collides with things on layer 1 so water which is not walkable is on layer 1 as well as items]
worldata:

rem 0 1 2 3 4 5 6 7 8 9
rem layer 0
data 0,0,0,0,0,0,0,0,0,0 rem 0
data 0,0,0,0,0,0,0,0,0,0 rem 1
data 0,0,2,2,2,2,2,2,0,0 rem 2
data 0,0,2,2,2,2,2,2,0,0 rem 3
data 0,0,2,2,2,2,2,2,0,0 rem 4
data 0,0,2,2,2,2,2,2,0,0 rem 5
data 0,0,2,2,2,2,2,2,0,0 rem 6
data 0,0,2,2,2,2,2,2,0,0 rem 7
data 0,0,0,0,0,0,0,0,0,0 rem 8
data 0,0,0,0,0,0,0,0,0,0 rem 9

rem layer 1
rem 0 1 2 3 4 5 6 7 8 9

data 1,1,1,1,1,1,1,1,1,1 rem 0
data 1,1,1,1,1,1,1,1,1,1 rem 1
data 1,1,0,0,0,0,0,0,1,1 rem 2
data 1,1,0,0,0,0,0,0,1,1 rem 3
data 1,1,0,0,3,0,0,0,1,1 rem 4
data 1,1,0,0,0,0,0,0,1,1 rem 5
data 1,1,0,0,0,0,3,0,1,1 rem 6
data 1,1,0,0,0,0,0,0,1,1 rem 7
data 1,1,1,1,1,1,1,1,1,1 rem 8
data 1,1,1,1,1,1,1,1,1,1 rem 9

rem layer 2
rem 0 1 2 3 4 5 6 7 8 9

data 0,0,0,0,0,0,0,0,0,0 rem 0
data 0,0,0,0,0,0,0,0,0,0 rem 1
data 0,0,0,0,0,0,0,0,0,0 rem 2
data 0,0,0,0,0,0,0,0,0,0 rem 3
data 0,0,0,0,0,0,0,0,0,0 rem 4
data 0,0,0,0,0,0,0,0,0,0 rem 5
data 0,0,0,0,0,0,0,0,0,0 rem 6
data 0,0,0,0,0,0,0,0,0,0 rem 7
data 0,0,0,0,0,0,0,0,0,0 rem 8
data 0,0,0,0,0,0,0,0,0,0 rem 9

Some things to note; You could potentionaly put all the data values on a single data line (depending on the limit which is lower in dbc), and it would work just the same. I break it up, so that the data staments essenstially look like the actual world they represent. It makes it much easier to modify them by hand that way. In this example tiles that the character should walk under would be on layer 2. For a decent rpg you will probably use 5 layers.

Well, I'll let you digest all of this, before goin further.

[edit] note that your collision detection is built into the layers. so when reading an array value on layer 1 if it is anything but 0 your player would not be able to walk over it. This is very easy to code, and it will work for any tile. the layering also gives you the capability of making secrest paths; for instance, if you put water tiles on layer 0, the character would actually be able to walk on them. Of course the player would have to discover this as the map would look exactly the same as if the water tiles were on layer 1. Remember these layer are like transparancies laid atop one another.

Login to post a reply

Server time is: 2024-04-23 20:25:12
Your offset time is: 2024-04-23 20:25:12