Sign in to follow this  
mrguyman

notepad to make 3d maps?

Recommended Posts

mrguyman    100
Hi all. I'm wondering, how can I make 3D maps from text? For example:

11111
10001
10001
10001
11111

0=empty
1=wall

This is a simple example, but you get the point. Is there any way to turn text/number strings like that into simple 3d maps? If any software is needed, I need it to be free, as I don't have money for software :P

Thanks!

Share this post


Link to post
Share on other sites
xytor    136
If you have some programming experience with loading 3d graphics, you could do something like this:


//read the text file into an 2d array named level
...
///
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){
if(level[i][j] == 1){
createWallAt(j*WALL_WIDTH,i*WALL_DEPTH);
}
}
}

Share this post


Link to post
Share on other sites
mrguyman    100
Mind explaining that code? I'm not too great at programming. I know that what I asking for is probably advanced, so if there's a free software that can do it, I'll be grateful. Also, I'm not great at 3D graphics either, so if it's a software, I guess it'll have to load it's own models. Again, thanks for anyone who has the patience to help me with this :)

Share this post


Link to post
Share on other sites
smr    2468
Essentially your map will just be a grid of cubes. Per your example, a "0" would indicate nothing is drawn at the position. A "1" would indicate a cube is drawn at the position. All that's left to do is determine how large a cell in that grid will be, then how to draw a cube with the those dimensions.


void drawMap(Map map) {
for (var r = 0; r < map.NumberOfRows; ++r) {
for (var c = 0; c < map.NumberOfColumns; ++c) {
if (map.GetCell(c, r) == "1") {
var x = c * WIDTH_OF_MAP_CELL;
var y = 0; // Assuming you're drawing map cells at 0 Y;
var z = r * LENGTH_OF_MAP_CELL;

drawCube(x, y, z, WIDTH_OF_MAP_CELL, HEIGHT_OF_MAP_CELL, LENGTH_OF_MAP_CELL);
}
}
}





If you need help with a 3D API such as OpenGL or Direct3D, there are plenty of places to begin learning them. Search for OpenGL or Direct3D tutorials on Google or in the NeHe section of the website.

Share this post


Link to post
Share on other sites
Palidine    1315
Quote:
Original post by smr
If you need help with a 3D API such as OpenGL or Direct3D, there are plenty of places to begin learning them. Search for OpenGL or Direct3D tutorials on Google or in the NeHe section of the website.


But I would suggest that if you can't understand smr's code, that you probably need to study programming for a bit longer before getting into 3D programming or even graphics in general. Those are both fairly advanced topics in computer science.

Another alternative would be that if you don't really want to be programming and just want to be making games, you should start playing around with engines that already come with good tools: Unreal's UDK, Source, Starcraft 2, etc. There are also other tools like Game Maker and the like.

-me

Share this post


Link to post
Share on other sites
mrguyman    100
Heh, I know I must sound like a noob, but I only get the gist of that (which I assume is C++?) I'm not sure what I want, actually. I guess I'm lazy and want a program that you just load an ASCII file with the layout, and the program automatically makes a simple 3D map based on that, where I can insert perimeters that decide how large it is. Again, I'm sorry if I come off as annoying or "noobish", but I want to do this for some reason which I don't quite understand :P I guess I wanted to do this since I read a video game book that briefly mentions someone who created a way to make quake levels in notepad (but I may not have read right.) As I don't have quake, I wanted to do something similar [making 3d levels in notepad]. So again, I thank anyone who has the patience to put up with me :P

Share this post


Link to post
Share on other sites
Palidine    1315
Quote:
Original post by mrguyman
Heh, I know I must sound like a noob, but I only get the gist of that (which I assume is C++?) I'm not sure what I want, actually. I guess I'm lazy and want a program that you just load an ASCII file with the layout, and the program automatically makes a simple 3D map based on that, where I can insert perimeters that decide how large it is. Again, I'm sorry if I come off as annoying or "noobish", but I want to do this for some reason which I don't quite understand :P I guess I wanted to do this since I read a video game book that briefly mentions someone who created a way to make quake levels in notepad (but I may not have read right.) As I don't have quake, I wanted to do something similar [making 3d levels in notepad]. So again, I thank anyone who has the patience to put up with me :P


heh. yeah sorry don't get me wrong. I have no problem with noobishness. [smile]. I'm just suggesting that if you really want to be programming then there is a long path of learning/practice before you're probably creating what you want to create. I just suggested an alternative in case you just want to be making games instead of necessarily programming games.

If you really want to be programming I'd suggest the common "learn to program games" path: text adventure -> pong -> tetris -> then maybe you're ready for a 2D isometric RPG like what it sounds like you're talking about.

But again, if you just want to make this game, then seriously consider looking at moddable engines with good toolsets.

-me

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this