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.

Code Snippets / Map-Maker

Author
Message
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 7th Jul 2005 18:57
This is a map maker program. I was making an fps with txt-maps and i was gettin tired of all those numbers in notepad
Well, I solved that problem...

Here's the code:



Oh, the menu is on the right, and to zoom , press up/downkey.

Immunity and Annihalation makes Immunihalation...
Ianhfar
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: UK
Posted: 7th Jul 2005 20:22
Nice idea with the hidden menu, once you have saved the map, the map size returns to default, is this by design?
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 7th Jul 2005 20:26
Yes, this is normal, if you like, i can change that.

The program is still in an early stage. So any suggestions are welcome

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 7th Jul 2005 20:31
Here is the code:



The map will not be cleared when saving and you have now the abilty to start a new map.

Immunity and Annihalation makes Immunihalation...
Ianhfar
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: UK
Posted: 7th Jul 2005 22:40
Sven B

Some suggestions,

1.Enable a rectangle of the same tile, instead of drawing the rectangle block by block... so either a rectangle or a fill command.

2.A line command

3.Perhaps a load map command to load a previous map.

IanF
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 8th Jul 2005 19:00
I'm back! I read your suggestions Ianhfar, and I should be able to do the load and the rectangle command. But the line could give me a headache :-s

Anyway, here's the code with the load-command:



And thank you for the suggestions!

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 8th Jul 2005 20:17
Here's the program again, with the rectangle function.
Because I had not enough space to add it to the menu on the right, I made a new menu on the bottom.



Immunity and Annihalation makes Immunihalation...
SAnTA
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location:
Posted: 8th Jul 2005 23:04
nice. My sugestions are to edit your rectangle function so that you can draw a box in any direction like in paint instead of having to drag to the right of your first click.

I would also have it so the menu can list sprites and draw sprites onto the grid.

Here is my function to grab sprites



http://www.atnasonline.com/
Tutorials : Minesweeper
Source Code : Tetris | Tron | Columns | 3d Pong | Circular Tron | Lego Slide
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Jul 2005 02:33
Well, I only had the intension of making a program that exported txt-files. But feel free to edit it. About the rect tool: I could do that

Update:
The rectangle tool didn't start at the right right spot. Fixed.



Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Jul 2005 02:40
Another update:

SAnTA's suggestion (rectangle tool in all ways) is added:



Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Jul 2005 02:41
Sorry guys, That was my old code.

Here's the right code:



Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 12th Jul 2005 21:40
Here's an update:



Added features:
- Right mouseclick to copy tile.
- Controlkey and move mouse to change the position of your map.

Immunity and Annihalation makes Immunihalation...
Ianhfar
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: UK
Posted: 12th Jul 2005 22:25
Sven

Its looking good, keep it up

Ian
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 12th Jul 2005 23:19
Thanks Ian, I'm glad someone likes my program...

Well, I'm working on the line tool now... It's not gonna be simple

Immunity and Annihalation makes Immunihalation...
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 13th Jul 2005 19:04
Looking very nice. Great work.

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.dbspot.com
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 13th Jul 2005 21:14
Here is a new update.
I found it kinda stupid that there were only 10 tiles to choose from. So I added characters (A -> Z). This means 36 different tiles now. If anyone can find a bug, please tell me...



Have fun.

Immunity and Annihalation makes Immunihalation...
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 14th Jul 2005 03:45
wow! very cool!
one suggestion is when your picking your tile(on the right side) you should be able to go to set 4 from one and set 1 from 4 . is that clear?

i love the hide menus. they would work great in maybe a rts or any level editor!

Over And Out.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 14th Jul 2005 17:00
Here you go.



I've decided i'll leave the line. Maybe I'll try again later... If you want to draw a straight line, you can allways draw a box with 1 heigh or 1 width...

Any other requests?

Immunity and Annihalation makes Immunihalation...
EvMaster
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Australia
Posted: 14th Jul 2005 22:12
Looks great!

-Ev

AMD939 3500+, Gigabyte PCI-E X800XL 256mb, 1024mb RAM
Logitech Z680 5.1 Speakers
Ianhfar
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: UK
Posted: 14th Jul 2005 22:38
Sven,

I've added a line command, I was having difficulty with the mousekey toggling, so I changed the line to work as such,
Mousekey 1 starts line, mousekey 2 ends line.



Ian
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 15th Jul 2005 12:25
i hate to ask this but i used to have a code snippet to load this kind of thing but how do i do it? if you dont want to give me code then explain please?

thx alot and great program!

Over And Out.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Jul 2005 22:21
here is the loading part:



If it still isn't clear I'll write a quick tutorial for you...

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Jul 2005 22:29
Oh thx IanF. I'm gonna do some research to your code, and then try to import a line tool myself...

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Jul 2005 23:20
Sorry IanF, I couldn't decifer your code. So I searched my math books. I used functions of a line.(y = mx + q)



At least it's almost what i want...

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Jul 2005 23:42
Yay, I did it... Thx IanF! (Come to think about it, you're code was very helpful to me...)

Here's the full code WITH line tool!!!!!



Man I'm so happy...

Immunity and Annihalation makes Immunihalation...
Ianhfar
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: UK
Posted: 15th Jul 2005 23:55
Sven

Its an implemetation of Bresenham's line algorithm, it caters for draw a line in all quadrants. I admit it did seem like overkill.

IanF
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Jul 2005 00:14
I didn't know anyone else wrote an algorithm like that

Well, the main thing is that it works.

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Jul 2005 21:31
Update:

Rightclick on the color wich you want to change.



I'll try to implement tiles from images... hope it'll work

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Jul 2005 03:47
People, a big update!

I added the option to display tiles from images. Just use the load button and load a jpg, bmp or png to load the image, give the tiles and it will give you a map with tiles.

It has a limit though. Because there are only 36 characters, the maximum tiles are 36 (6 x 6 or 5 x 7).



oh yea, and use the "toggle tiles" button in the bottom menu to toggle tiles on/off. (standard = on)

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Jul 2005 20:49
Another update.
This time, you can choose between !70! tiles. Wich means you can use images and tile them with a max of 7*10.

here is the code:


Any requests?

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Jul 2005 04:52
People, if noone is interested in this, I will quit updating my progress. Why publishing it when there isn't anyone that's interested?

Immunity and Annihalation makes Immunihalation...
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 20th Jul 2005 07:39
Hey i think this is really superb but i don't know how to read the data in dbpro in order to make something 3d?anyhelp?keep going on this !

Over And Out.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Jul 2005 18:26
Allright, i'll make a tutorial on loading map data..

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Jul 2005 18:55
- 1 - Open files

Ofcourse, when a file is saved, we have to open it. To open a file to read the data from it, we use the command open to read filenr,filename$ and to close it, we use close file filenr.

An example:



- 2 - Extract data

Between these commands, we can read the data that was stored in the file with the following commands:
- read byte filenr, variable
- read file filenr, variable
- read dirblock filenr, variable
- read fileblock filenr, variable
- read float filenr, variable
- read long filenr, variable
- read memblock
- read string
- read word

Note that these commands will read from the beginning of a document, to the end. You cannot chose wich line that will be read.

- 3 - Load a map

First of all, we have to open a file to read. We'll name the file "world1.txt"



When created a map, we have to know 2 things: width and height.
for example:
width = 40 and height = 30

So we have to read 40 characters in 1 row, and 30 rows.




Now we have to read the file. We're going to read 30 strings with 40 characters each. This means we will load the 30 strings:



And get all 40 characters from that string:



The loading is done...
Now you can use the map_data$ to do something when the character is for example a "1" , "2" or an "A".



Now you can read all data from your saved map.

- 4 - What if we don't know width and height?

Well, this isn't so difficult as it first seems.
The width is the nr of characters of each string.
width = len(strmap$)

And to get the height of the map, we have to detect if the file ended. So we're not using the for ... next anymore, but the repeat ... until and the file end() commands



Immunity and Annihalation makes Immunihalation...
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 21st Jul 2005 03:07
hey thanks so much. i'll try to use this

Over And Out.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 21st Jul 2005 20:27
No prob

Immunity and Annihalation makes Immunihalation...
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 28th Aug 2005 12:46
What are the minimum specs of this thing???

it gave my computer a heart attack!
(2 FPS according to fraps)

...maybe one day I'll finish a project
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Aug 2005 20:18
I thought this thread was dead...

I don't know what the minimum specs are. And I cant even find my own specs so...

I just stick to coding. But I think its the nesting with "for ... to ..." that slows down the program. I'll dig up my program again and I'll try to speed it up a litl bit.

Immunity and Annihalation makes Immunihalation...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Aug 2005 20:29


Not much to clean up actually...

My frame rate: 94

Immunity and Annihalation makes Immunihalation...
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 28th Aug 2005 20:36
Hmm.. I don't have much time 'cause I've to go back to the barrack in less than one houre, but from all I saw, it's a good prog
I wish you all the best with that prog ^^

The sleeper must awaken !
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 29th Aug 2005 08:37 Edited at: 29th Aug 2005 08:38
It probably doesn't require high specs at all...

only parts of my machine that have been upgraded in 3 years are OS and graphics card

so my specs are pretty low - but still capable of playing most games:
CPU: AMD AthlonXP 2000+ (1666Mhz)
512MB RAM (Was very expensive in 2002)
80GB Hard disk (running quite low on space, about 10GB left, if that)
128MB DDR GeForce FX 5200
On-board AC 97 sounds
2 10/100Mbps Linksys network cards
Windows 2000 Professional (SP4)
DirectX 9.0C

That's my stuff, does that look in need of an upgrade - or badly in need of an upgrade?

...maybe one day I'll finish a project
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 29th Aug 2005 16:00 Edited at: 29th Aug 2005 16:00
I did some research about my pc and I found:

Intel Pentium IV 3.20 GHz
512MB RAM
120GB Hard disk (about 90GB left)
NVIDIA GeForce FX 5700LE
Windows XP Home edition
DirectX 9.0(c?)

I think that's the main thing...

Immunity and Annihalation makes Immunihalation...
Jedi Lord
20
Years of Service
User Offline
Joined: 11th Jun 2004
Location: Jedi Temple
Posted: 25th Sep 2005 08:32
What the use for this program? If I export it to txt then it will be useless for real program. Tell me: is it useful or useless and tell me a reason. NO OFFENSE!!!
Looking good program.
I think your the expert.

Let's go to school! yay... hello... HELLOOOOO......
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Sep 2005 11:25
Well:

For example, you want to creat a maze:
You could either write 100 lines of code to make a maze

OR

Use my program and load multiple maps in 20 lines of code!



And this isn't the only thing that can be done with it. For example: matrix tiles, collision purposes or even enemy formations!

Well, it explained a bit...

Cheers,

Sven

Immunity and Annihalation makes Immunihalation...
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 25th Sep 2005 17:54
What did you write it in (DBC or DBP)?
it runs funny on classic.

Our aim is to keep the loo's clean, your aim can help.
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 27th Sep 2005 04:38
Quote: "If I export it to txt then it will be useless for real program."


Sigh.

Sven, good code, nice job

Blog is death. How? NO idea. But is murder. REVENGE!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 1st Oct 2005 10:00
I wrote it in DBP.

It runs on DBC? Should be a low frame rate then. nesting for-next in classic is really slow in DBC.

Thanks for the comments...

Immunity and Annihalation makes Immunihalation...
x1b
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location:
Posted: 1st Oct 2005 18:24
very, very cool Sven. Keep developing this, please. disregard the confused,lacking and nay sayers.

- This message is made of 100% recycled bits and bytes
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 5th Oct 2005 18:14
Okay!
I originally stopped the project since the thread was practically dead. But okay.

New features:
- You can use as many tiles as you want actually. Just change "tiles = 100" somewhere in the beginning of the code to adjust the number of tiles used.
- The sync rate rose a little. 94 -> 98 (not too much, but it does)
- You can export not only a txt file, but a bmp file too.
- you can adjust the tile's color AND ascii character.
- ... Well, I could've forgot something, but you'll find out.



Immunity and Annihalation makes Immunihalation...
Advancement Games
19
Years of Service
User Offline
Joined: 6th Jan 2005
Location:
Posted: 8th Oct 2005 17:03
Excelent work! Now I did not run this yet in DBP, but can you place entities in your map editor? Just wondering, but I will find out soon enough. Also, you may be interested in BlueGUI. I just bought it, and it may help you out with some of the menus and graphics.

C. Nom De Plum

Login to post a reply

Server time is: 2024-11-23 13:18:57
Your offset time is: 2024-11-23 13:18:57