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 / Need help on 2d dungeon game in DBP

Author
Message
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 28th Sep 2005 01:53
Hi.

I tried the "Huge Dungeons" tutorial for DBP, but I didn't quite understand every part of it so I tried to make a 2d version from scratch instead. Kinda like ADOM for those who remember that game.

What I got so far is: Loading a map from a .bmp file. Player controlls are ok. I'm now working on making the map scroll when the player walks to far up/down/left/right on the screen. I'm not done with that part yet, but I'll figure out something.


My question is: When the game starts, all I want to see is the player and the room he is standing in. The rest of the map should be invisible. And when he opens a door the next room/hallway should appear. How can I do that?

I know it's badly explained but I hope someone can help me with this. You don't have to post any source code, just point me in the right direction.

-Ranietz-
Deep Thought 42
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: New Jersey, USA
Posted: 28th Sep 2005 05:15
(sigh) Please post code with [ code] code here [ /code]. Source code box does not work.
example


"Winners never quit and quitters never win. But those who never win and never quit are idiots."
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 28th Sep 2005 05:55
Sorry about the missing code. I'm new here so I didn't know the source thing didn't work... And I can't edit my post...




-Ranietz-
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 1st Oct 2005 02:26
Can someone help me with this?

-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 1st Oct 2005 17:39
It would help to see what your game looks like. Please attach the media and I will help you.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 1st Oct 2005 19:31 Edited at: 3rd Oct 2005 01:38
Ok. Here is a screenshot of what the main gamescreen look like. I haven't started on the graphic yet so it looks kina boring.

http://home.online.no/~sforfa/screenshot1.jpg



Here is a screenshot of what I want the main gamescreen to look like when I start the game. Only the room with the player is visible:
http://home.online.no/~sforfa/screenshot2.jpg



And when I open a door it should look like this:
http://home.online.no/~sforfa/screenshot3.jpg


I have also updated the source code:




Edit: Those screenshots were getting on my nerve...

-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 1st Oct 2005 21:51
Ok. You could have an array called Visible(mapsize*mapsize) where it would have a one if the tile is visible and a 0 if it isn't. You could simply make every tile within 3 or 4 tiles of the player visible with some code something like this:

and inside the main loop:

If it doesn't work, please attach the pictures - "grey16.bmp","128x128" and the other pictures used in the game so I can test it. That's what I meant when I asked you to attach the media. The screenshots helped alot though.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 1st Oct 2005 23:18
Thanks for the help. I'll try it and see if it works.

I guess I misunderstood the media part of your first post, but here you go.

-Ranietz-

Attachments

Login to view attachments
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 1st Oct 2005 23:43
Ok. I tried it and it didn't work at first but I understood what you were trying to do so I changed it a bit and now it works. Thanks!

Here is the updated code:



There is one thing I want to change though. I don't want the player to see through walls and doors. Any idea on how I can do that?

-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 2nd Oct 2005 01:14 Edited at: 2nd Oct 2005 01:20
I got the game running, but it doesn't seem to work. When I go to new game and press space, this is all I see:
(attached) - ( I tried to attach it and then make the attachment an embedded picture on the post, but it didn't work since I don't have a webpage to put it on )
Anyway, what am I supposed to do to make it look like the screenshots?

Green Bunnies rule!

Attachments

Login to view attachments
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 2nd Oct 2005 01:34
Did you try the newest source code? I have no idea why you got the screenshot that you did. When you go to New Game and press Space you should see something like my second screenshot...

-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 2nd Oct 2005 15:05 Edited at: 9th Oct 2005 20:39
It must be because I am using DBclassic. The dungeon tutorial for dbpro worked fine in dbclassic. I am looking through your code, and what key is keystate 50?


About the visibility thing, I have an idea and have written it down and will test it once I can find what is happening.

I just added my banner to my signature. It works!

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 2nd Oct 2005 18:00 Edited at: 2nd Oct 2005 18:06
I don't have DBC so I haven't tested it there, but that could be the cause of your problems with the game.

And keystate(50) = "m"

Edit: I downloaded the trialversion of DBC and tried it there and I got the same screenshot that you did, so the game won't work in DBC...


-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 2nd Oct 2005 18:48 Edited at: 9th Oct 2005 20:39
Oh well. Here is my idea about how to do the visibility thing.
Here is the player's visibility:

First, it makes these visible and checks if they are a door or wall or anything else you can't see through: ("-" = door/obsticle "." = empty space "*" is not visible yet "o"= visible "P" player"

and it might look like this

Then, the row on top of that will become visible, except for the one on top of the "-" since you can't see through a wall.

Let's say it looks like this now:

Then the same thing happens, so now it looks like this:

Get it? I will put some code on here and continue in about half an hour because I have to eat lunch right now.

Green Bunnies rule!
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 2nd Oct 2005 19:26 Edited at: 9th Oct 2005 20:39
Okay, I'm back. Here is the code, it probably won't work because I'm awful at syntax, but you will probably get the idea. (this replaces the earlier code that made all the tiles near the player visible)

You can do the same thing with the other sides so you will now have it look something like this: (o-tested if should be visible, *-not tested yet)

OK, now we need to do the corners.
But first, do you think this: (0-added visibility things)

looks better than this:

?
It would look better with a circle around the player and it would be alot easier than doing the whold thing.

Edit: I won't be able to help you on Monday because I have school, but I will be able to help on Tuesday because I don't have school that day. After that, you will have to wait to Friday morning until I can help.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 00:00
It works now. Thanks again! I had to change the code a bit, and I made it as a GOSUB program




The code is not perfect though. When the player walks in a hallway (walking to the left) it looks like this:


But I want it to look like this:


But it's not important. I guess I figure something out. I got to improve the scrolling first. Now it scrolls one grid (16 pixels) at the time instead of one pixel at the time.

Thanks again,

-Ranietz-
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 3rd Oct 2005 00:21
Quote: "The code is not perfect though. When the player walks in a hallway (walking to the left) it looks like this:
"

if i'm understanding this correctly...(the map$(x,y,2) value stores if it's visible or not)

then for the extra visibility you would do something like this...


i might be assuming way too much because i haven't looked at your code very closely at all...

anyway, i really like games like this (have one on my TI 89 Titanium "calc rougue" that looks almost exactly like this except greyscale )

"We make the worst games in the universe."

UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 00:39 Edited at: 9th Oct 2005 20:40
Actually, the Visible array says if it is visible.

Edit: woops, never mind. You are right.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 00:39 Edited at: 3rd Oct 2005 00:44
Thanks Peter_. I had to change the code a bit, but it works. Now the code looks like this:




Still there are some small bugs with the code (the player can see around some corners), but that's not really a problem.

Thanks again Peter_

-Ranietz-
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 00:43
Quote: "Actually, the Visible array says if it is visible"


Actually, Peter_ is right. I have changed the code so I don't use the visble array. I use only the map$ array.

map$(x,y,1) store what kind of image I should use for that x/y coordinate.
map$(x,y,2) store if that coordinate should be visible or not.

-Ranietz-
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 3rd Oct 2005 00:54 Edited at: 3rd Oct 2005 00:55
lol, i'm glad it works!

Quote: "Still there are some small bugs with the code (the player can see around some corners) "

again, maybe i don't know enough about your code but i would think all you would have to do is check and make sure you aren't illuminating a blank space...

like so (or at least i think )


this is shorter but i'm not sure if strings work this way in DB...


anyway, glad i could help

--Peter

"We make the worst games in the universe."

Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 01:07
I'm sorry Peter_, but that just brought back this problem:


But thanks for the suggestion.

-Ranietz-
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 3rd Oct 2005 01:14
lol, yeah, i probably should have looked at your code closer

anyway, could you post a screenshot of the "seeing around corners" problem? (or just a diagram maybe)

"We make the worst games in the universe."

UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 01:23 Edited at: 9th Oct 2005 20:40
Hey, would you mind posting the executable of the program so I can play it? You don't need DBP to run an executable made with DBP.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 01:30
Ok. Here is a picture of the player walking left in a hallway:



When he takes one more step to the left it looks like this:



It just doesn't look quite right...

-Ranietz-
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 01:35
I've attached the .exe file. I think you need to put it in the same folder as the .bmp files that I've attached to an earlier post...

-Ranietz-

Attachments

Login to view attachments
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 01:40 Edited at: 9th Oct 2005 20:40
What do you want it to look like?

Edit: wow! you posted before I could refresh the browser. Thanks, it helps to have the game to play when figuring out how to do stuff.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 01:52
Hehe. I'm not sure yet what I want it to look like.
Maybe when the player walks up to a corner it should look like this:



instead of this:




-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 02:23 Edited at: 9th Oct 2005 20:40
Okay, just a second. I changed the picture files so they aren't just blue or yellow squares. Here they are. A screenshot will be attached to the next post.

Green Bunnies rule!

Attachments

Login to view attachments
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 02:26 Edited at: 9th Oct 2005 20:40
Here is the screenshot.

Edit: Oh, black is transparent. You should change the white in the smiley to black so it would look better in the part that says what tile is what.

Green Bunnies rule!

Attachments

Login to view attachments
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 02:35 Edited at: 9th Oct 2005 20:41
Okay, I get what you mean. The hallway tile that is to the left of the opening should be there though because you can look diagonally. I will try to help on Tuesday because my parents are making me stop right now (7:30 pm in my time zone). I will be able to help Monday evening (about 2 hours earlier than now) a little, but I will be able to help alot on Tuesday since I don't have school.

Great game. It is the begining of a great dungeon RPG!!! I think I will convert it to Qbasic, so It could work on the computer in my room which is 15 years old .

Edit: Sorry about the triple post

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 02:42
Hehe. The new tiles look cool. I'm thinking about making the tiles 32x32 instead of 16x16 so I could get some better graphics in the game (everything looks so small now).

I'll look into the visibility problem a bit later. Thanks for the help again and take care.

-Ranietz-
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 3rd Oct 2005 17:04
hehe, if you used 32*32 tiles you could use some tiles from my "Dungeon" game (the game isn't anything like your game...just share the same title )

if i have time today i'll try to help you out with that corner problem...but i have classes today (2 college classes + my normal homeschooled stuff) so i might not have time

"We make the worst games in the universe."

UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 3rd Oct 2005 21:35 Edited at: 9th Oct 2005 20:41
Ranietz, If you ever need more help on the dungeon game, just post the questions here. I will check this thread when I can.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 3rd Oct 2005 23:16
Thanks Green Bunny and Peter_. I've put the "visibility" thing on hold for a while and try to consentrate on other parts of the game. I've made some changes to the game and I've attached a screenshot of what it looks like now...

-Ranietz-

Attachments

Login to view attachments
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 4th Oct 2005 00:49 Edited at: 9th Oct 2005 20:41
Really, I don't mind helping people. It makes me kind of happy that I got to help someone before TDK man or Me! could.

The graphics are really good, but of course the doors need changed to something else.

I'm looking forward to when it is finished. Once you get the engine finished, you should add monsters and stuff. Also, you could let the player choose what image to use as their character.

Also, do you have any idea about the visibility thing, why the blank space 2 tiles above the player on the screen shot was visible? There is a wall between the player and the blank space that was made visible. You don't have to worry about this yet, but if you want the visibility fixed later, this is what we would need to figure out.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 4th Oct 2005 01:09
I'm working on some more graphics right now, and I'll look into the visibility thing later...

-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 4th Oct 2005 01:24 Edited at: 9th Oct 2005 20:41
About the map editor, all you have to do is make it run the dungeon creator program from the tutorial.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 4th Oct 2005 01:50
Yeah, maybe, but I want to make my own map from scratch. The test map I'm using now was made with the dungeon creator, but I had to make some changes to the map to make it work...

-Ranietz-
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 4th Oct 2005 02:04 Edited at: 9th Oct 2005 20:41
I mean for the map editor option on the menu. If you are thinking about making a map editor, it wouldn't be that hard, but it would take forever for someone to be able to make a map big enough to be worth playing. If you want to make an option in there to make a random dungeon, it would be really hard to program it to make dead ends and stuff instead of a bunch of random walls and doors everywhere.

Green Bunnies rule!
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 4th Oct 2005 02:31
I understand. I haven't thought much about the map editor yet. I'm still not sure if I should have any (It's a lot of work ). I'll see what I'll come up with...

-Ranietz-
Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 4th Oct 2005 05:15
One new screenshot for thoose who are intersted...

Now I'm off to bed...

-Ranietz-

Attachments

Login to view attachments
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 4th Oct 2005 16:07
a random dungeon creator would be a interesting thing to program

the hardest part would be positioning the doors intelligently...

"We make the worst games in the universe."

Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 4th Oct 2005 22:32
It would be interesting to program a random dungeon creator, but I'm thinking about make some changes to the key/locked door system. Instead of having only one kind of key that can open any locked door I want to have one red key that unlocks the red door, one green key that unlocks the green door and so on... I guess making a random dungeon creator with this system is a lot harder...
But then again, it's a lot I'll have to do before I can start on the dungeon creator...

-Ranietz-

Login to post a reply

Server time is: 2024-11-13 21:18:42
Your offset time is: 2024-11-13 21:18:42