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 / Help with modifying a User-Generated matrix in a Level Editor...No idea where to begin!

Author
Message
Yodaman Jer
User Banned
Posted: 13th Jan 2011 21:27
Hey everyone,

I've been thinking lately about ways to make my levels more diverse for my game, and it occurred to me that a way to create an RPG-meets platformer game would be to combine matrices and objects.

Right now, I've only been working on the level editor for the game, and I've gotten pretty far with it. There's several things that need re-coded, but I've got the basic mechanics down and can do pretty much anything with it, except create landscapes. I want to add the ability to generate a matrix inside of the level and edit it just like a regular 3D model; i.e., a "brush" tool could be clicked by the user to raise the vertices the brush tool is in contact with, thus resulting in hill-like anomalies, and depending on the value of the tool, it could also create valleys. This would be PERFECT for my editor and game. There's just one, little problem...

I've never really messed with matrices and I certainly don't know how I can "select" which tiles to raise/lower depending on where the brush tool is. I also have no idea how I could texture each square in the matrix individually. I don't even know where to begin!

If anyone remembers it from years ago, a forumer named TDK created a program that did just that; he called it MatEdit. I kind of want similar functionality to that program, if it's at all possible.

So can anybody help me out? Give me some pseudo-code to study and ideas to chew on? I would GREATLY appreciate the help!

-CoffeeCoder

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Jan 2011 00:36
You could make a grayscale heightmap and then apply your matrix the image to bring up mountains and valleys. There are a lot of ways to get that.

Cheers.

I'm not a grumpy grandpa
Yodaman Jer
User Banned
Posted: 14th Jan 2011 06:41
That's a good idea, but that's not what I'm after.

I'm after a way to select a tile from a matrix and either raise/lower it or texture it (similar to MatEdit's functionality). From there, I think I can figure out how to save the information to file and load it back in-game, as it shouldn't be much different than saving object's positions. I think...

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 14th Jan 2011 09:54
With matrices, I would just make a dummy cube, hide it, then position it at each vertex (each tiles top left corner). Then by storing the X and Y value when you click on one of those corners, you can have the height adjust based on vertical mouse movement. That's what I did with OIE, along with some smoothing functions, and allowing number key height setting. For example, I would have the '1' key, set the current matrix node height to -100, '2' would be 0, '3' would be 100, '4' would be 200 etc etc. This makes it pretty quick to work with. Rather than adjusting each and every height of all those nodes, I'd zip through, setting heights with the number key, drawing little rivers etc - then smooth the whole thing out.

In the actual game, I made memblock meshes instead of using a matrix, which allowed colouring, manual lighting and better performance.

One neat option is to draw all the nodes, but also keep track of the node closest to the mouse pointer - then you have an even quicker matrix editor, because your not having to select nodes or check for ranges.

Health, Ammo, and bacon and eggs!
Yodaman Jer
User Banned
Posted: 18th Jan 2011 02:16
Thanks for the response Van B! I like the idea of using a dummy cube.

I think I understand what you're saying for the most part, but would it be possible to see some code from your old project, just to get an idea of what I should aim for (in terms of efficiency)?

I've never messed with memblocks...it's something I want to look into soon once I finish my level editor project.

Login to post a reply

Server time is: 2026-07-18 02:08:07
Your offset time is: 2026-07-18 02:08:07