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.

DarkBASIC Professional Discussion / (DBPRO) Random Dungeon

Author
Message
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Mar 2018 23:54
Hi there
For all those who like the games of secret dungeons and corridors, here I come with an example of a fany dungeon creator. The script works in Time Lapse mode, so we can see the whole process .

Here we go !

I'm not a grumpy grandpa
seppgirty
FPSC Reloaded Backer
8
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 30th Mar 2018 04:08
great code. Thanks for sharing.
gamer, lover, filmmaker
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Mar 2018 10:31
@seppgirty
you are welcome . Enjoy it !
I'm not a grumpy grandpa
seppgirty
FPSC Reloaded Backer
8
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 30th Mar 2018 22:04
Getting an error for your line 111.......................... ink rgb(255,255,0)


Parameter for 'INK' do not match 'Foreground Color,Background Color' at line 116. (I pasted the code so my lined are different than yours.)
gamer, lover, filmmaker
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Mar 2018 23:04
Quote: "I pasted the code so my lined are different than yours."


Well, I did't mention it uses Matrix1 utils plug in

Try
Quote: "ink rgb(255,255,0),1"
I'm not a grumpy grandpa
LBFN
11
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 31st Mar 2018 13:07
Nicely done! I had to set the sync rate at 60 as I was moving at light speed. I like how you did the lighting, it gives you a bit of a creepy feel.



So many games to code.....so little time.
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 31st Mar 2018 14:22 Edited at: 31st Mar 2018 14:23
Quote: " I like how you did the lighting, it gives you a bit of a creepy feel."


Yeah...imagine a couple of scary sounds here and there . About the sync rate...that depends on our PC specs. mine is very old
I'm not a grumpy grandpa
seppgirty
FPSC Reloaded Backer
8
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 31st Mar 2018 14:37
Quote: "Well, I did't mention it uses Matrix1 utils plug in"

O.k. that explains the camera errors also.
gamer, lover, filmmaker
Derek Darkly
6
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 7th Apr 2018 02:01

Just saw this... I love it! Great job as usual man!
Send your parents to noisy sprite demo hell... enter the D-Zone
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Apr 2018 10:21
Quote: "Just saw this... I love it! Great job as usual man!"


Thanks mate ! Just rescuing some old codes from the old trunk .
I'm not a grumpy grandpa
Starshyne Emir
1
Years of Service
User Offline
Joined: 27th Nov 2016
Location: The Darkness Beyond Time
Posted: 3rd May 2018 07:53
Mr. @chafari , such a glorious piece of code you have here!

It was like reading my own codings, you make things following the same mental algorithm I use to make my stuff!

You make stuff from nothing as I do and it is awesome to know that someone else follows the same coding principles as I.

Are you using Matrix1Utils? Well, I use it too, and your code would probably take more benefit from these plugins if you stop using ink commands and using DOT, BOX and other 2D commands from M1U, that come with a color parameter.

So you can use, for example:

dot x,y,rgb(r,g,b)

Instead of

ink rgb(r,g,b)
dot x,y

It'll make your code slightly smaller and leave ink alone. It is better let it exclusively for text commands, to avoid color errors when drawing multiple coloured stuff onto a single screen.

INSTANCE your objects instead of creating a new one every time you need another wall or floor.
Just make a single object for each thing you'll need - the wall object, the floor object, etc, hide them... like this:

make object cube wall,size
texture object wall,wall_img

And every time you need another wall:

INSTANCE OBJECT this_object_number,wall

And voila! You have another object already textured and which shares texture scrolling and scaling - allowing to modify all objects of the same type just changing the source one. And it helps a lot with the framerate!

By the way... Do you know that if you put a RANDOMIZE command before the map generating starts, the seed you put on it can be used to retrieve previously generated maps as if they were stored into memory?

For instance, RANDOMIZE 1 shall produce always the same dungeon.

So, you may use:

global seed as double integer

seed = dungeon_number

RANDOMIZE seed

And now you just need to set up a value for seed and you earn instant access to any map! Double ints allows a few quintillion "slots" for listing randomly made stuff. Nice way to put impossible amounts of data into half dozen lines of code hahaha





[size=+2]Forever and one[/size]
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd May 2018 18:08
@Starshine Emir
Thanks for your comments. This was an old code I made time ago. I love doing every media with code. I agree about the ink... in this piece of code I made the wall texture (nothing special) in order people dont have to load any media...
There's a coding challenges where you can find really good stuff.
Now I spend more time with FreeBasic than Darkbsdic pro....that is like being all the time in a big challenge...creating fake 3D ...raycasting and so on.
About the randomise...I will test it when I go back home in a few days/week. Now I'm out with the f... smartphone...I can't test any code

Cheers
I'm not a grumpy grandpa
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 4th May 2018 15:48
I tried this and thought this is a great idea, the only problem is the textures, it would be nice if the texture would change also every time.
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th May 2018 19:28
Quote: "would be nice if the texture would change also every time."


Not in this little piece of code, but that is posible to achieve just spliting the level into triangles and then texture each one with the texture that you want.

I'm not a grumpy grandpa
Derek Darkly
6
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 5th May 2018 02:32


Quote: "Not in this little piece of code, but that is posible to achieve just spliting the level into triangles and then texture each one with the texture that you want. "


Indeed.. it's the little ideas that give birth to the big ones... the endless experiments that lead to endless possibilities. Such is the artform... such is the wonder... the chance to create what has not been created. That is why Chafari is my favorite Yoda! LoL WOO!!!
Send your parents to noisy sprite demo hell... enter the D-Zone
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th May 2018 09:28
@Derek Darkly
May the Force be with you
I'm not a grumpy grandpa
Starshyne Emir
1
Years of Service
User Offline
Joined: 27th Nov 2016
Location: The Darkness Beyond Time
Posted: 7th May 2018 00:55 Edited at: 10th May 2018 02:41
Talking about random textures, I made this function to produce randomly textured boxes - to use as dungeon walls or item crates.
It is dumbly easy to use: crate(n)
The n parameter is used to define the number of the "crate" object - object number, image number and the bitmap used to generate the image, which is deleted during the function.
After calling the function, you can position or scale the object using n as its number.

EDIT:

I remade the function to allow the user to define the dimensions of the object generated with it and all the 3 colours it will be painted with.

Now, the syntax is the following:

crate(n,w,h,l,c0,c1,c2)

Parameters:

n = The object/texture/bitmap number that will be used in the function.

w = the X lenght of the object - its Width.

h = the Y lenght of the object - its Height.

l = the Z lenght of the object - its Lenght.

c0 = the background color of the generated texture.

c1 = the first foreground color of the generated texture.

c2 = the second foreground color of the generated texture.

It cannot produce composite objects, but the masters of programmin in here are you, I am just a small apprentice, heheheh.




[size=+2]Forever and one[/size]
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 7th May 2018 17:37 Edited at: 11th May 2018 10:03
@Starshyne Emir
Thankz for share it. I will test it on Friday when I get home. Your function goes ok for dungeons made of blocks... but in this example , it is a single mesh and we need to split the object in chunks to use a texture per wall or group of them.
I'm not a grumpy grandpa
Starshyne Emir
1
Years of Service
User Offline
Joined: 27th Nov 2016
Location: The Darkness Beyond Time
Posted: 10th May 2018 02:43
I edited the code snippet to provide a bit of control of the final object.
With this you'll be able to produce different blocks reusing the dimensions or colours, and this will allow you to produce all the different blocks and textures you need without any complicated stuff involved.
[size=+2]Forever and one[/size]
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th May 2018 10:05 Edited at: 11th May 2018 10:06
@Starshyne Emir

Nice one . I will give it a go in future codes.
I'm not a grumpy grandpa
Starshyne Emir
1
Years of Service
User Offline
Joined: 27th Nov 2016
Location: The Darkness Beyond Time
Posted: 11th May 2018 19:24 Edited at: 11th May 2018 19:47
Feel free to use it if you want, and implement it at will.

By the way, this thread shows another part of this project, made with some unused funcions of the source code shared above.

Here's the link:
[link]
https://forum.thegamecreators.com/thread/221930
[/link]
[size=+2]Forever and one[/size]

Login to post a reply

Server time is: 2018-06-24 08:07:58
Your offset time is: 2018-06-24 08:07:58