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 / [DBP] Create Level from Bitmap

Author
Message
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 16th Apr 2009 08:36
This will create a level from a small bitmap graphic. IanM's Matrix1 plugin is required.

The attached contains some example bitmaps.

Attachments

Login to view attachments
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 17th Apr 2009 08:24
This fixes a couple of bugs in the first posted version. First version was flipping on x (D'Oh!) and was incorrectly creating walls near bitmap borders due to an incorrect variable intialization.

Attachments

Login to view attachments
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 23rd Apr 2009 07:07 Edited at: 24th Apr 2009 08:58
The attached is an example which implements this procedure as part of a random level generator. The example requires the Matrix1 and Sparky collisions plugins. It contains a shader by Evolved.

Here's a code update, fixing some things I discovered while working on the example file.

Attachments

Login to view attachments
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 24th Apr 2009 04:24
Wow, that is very cool.

<---Spell casting battle game!
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 24th Apr 2009 09:14 Edited at: 24th Apr 2009 09:14
Thanks, Sixty Squares. Happily, I didn't even pull out all of my hair, trying to get it to work. LOL Some, but not all.

I've replaced the attachment in the post above with one which has a better tracking system. The large image used to generate the level is now cropped, allowing it to be enlarged further and placed more effectively on the screen. I was going blind trying to follow the little black dot. This edit also creates a larger, more chaotic level.
Monk
15
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 26th Apr 2009 19:29
That is a very cool piece of code. Youve implemented a lot of things well so congrats ! =)

Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 27th Apr 2009 07:40
Thank you, Monk! Hopefully I've learned a thing or two in the process. Hopefully. Hmm.

The attached is an update of the random level example. It now splits the generated objects into limbs by floor, walls, or ceiling. The settings now allow randomization of most of the random level generator settings, for a broader range of possible results. It can be re-started in-game, for a new level, by pressing "L". I've added some culling too, since some results can give more than 300 objects, with resulting slowdown. I'm still testing the culling settings, so if anyone tries it and it culls when it shouldn't, let me know. It's hard to derive decent rules when the size, shape, and position of the culled objects can vary so much. Hmm.

Attachments

Login to view attachments
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 29th Apr 2009 08:22
Here's a different example. Here, I've adapted the method to read from text files. I've used resources from one of my pre-existing 2d game projects to apply the method to create in 3D the levels from the old Atari 2600 game, Adventure. It's bare bones, right now. You can just wander from room to room. But it's kind of neat.

I really should have titled this thread, "Matrix1.dll extruder" or something. That's basically what it does: extrude a 3d shape from 2d data. Hmm.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-03 08:54:11
Your offset time is: 2024-05-03 08:54:11