Other > Game Development

Shrugger! Unity!

(1/71) > >>

Shrugging Khan:
So now that I've more or less survived my first few months of computer science, I thought I'd make a little game to motivate me for the coming second term.

"Let's make a sandbox exploration game", thought me, and realised that I didn't have the tech savvy to make it playable.
"How about a physics-based RTS?", suggested another part of my brain. Yeah, physics, that's complicated stuff.
"An FPS about natural selection and tactics?" - Dear Lord, no, we'd need really good AI to make it worth it.
"A space 4x with realistic scale!", was a thought. "Wait, mathematics and such? Relativistic physics? Ha ha ha!", was another.

And after a few weeks, yet another idea cropped up.

"A 3D roguelike?", I asked myself, and failed to think of any reason why that'd be too hard. So I fired up unity, imported some standard assets, and immediately started bludgeoning my desk in fury.

"Y u no multidimensional arrays, javascript!?", I raged. "You there, GameObject! How hard can it be to have a simple color instead of shaders and textures and god knows what?", I interrogated Unity. "WHY HAVE YOU STOPPED WORKING, SCRIPT!?", shouted I, my hands searching in vain for a throat to strangle - all I had done was rearrange a few folders.

In short, I am a complete and utter idiot. And I have many questions.
The first shall be this:

1. Issue One: Multidimensional Arrays, or alternatives thereto

I want to create a three-dimensional level to play in, using simple cubes. I thought it'd be fun to write an algorithm to plan the level, with multiple floors, rooms, staircases, corridors and whatnot. The plan was to store the layout in a matrix; or perhaps rather to have the matrix represent the level, with three dimensions denoting coordinates, and each element containing information regarding block type, structural integrity, temperature or whatnot.

Alas, my meagre coding experience did not suffice. I didn't even manage to make the bloody matrix happen! So, how can I create a simple array with three or five or eight or perhaps a dozen dimensions to store my level map in? How can store further arrays within this array?

Or is there a simpler, perhaps a simply better way to do it?
My guess is there's some object-oriented solution I'm not thinking of, or some other way of making such a map happen. Not that I'd actually know - as mentioned above, I am an idiot.

So, if anyone can make sense of all this, and perhaps provide some insight...I'd be much obliged!

x4000:
First suggestion: use C#. Everything is more vague in JavaScript, I feel like. Speaking as one who used js moderately heavily for 8 years in a web environment.

In c# you can do multidimensional arrays with new object[][]. In JavaScript the only way I know to do it is something like new Array( new Array() ). Etc.  In c# you can also do new object[,]. Those are all two dimensional arrays, but for three it's the same.

I can't help you much with gameobjects or 3d in unity, though, because we use drawmesh and drawmeshnow (pro features) along with custom textured quads out of vertex arrays. We obviously do use shaders, but nothing all that complex and we mostly use them by setting the current material directly or by using materialpropertyblocks (or whatever those are called, it's been a while since all that is long-since wrappers a by our own code.

We only even use a single script, very short, attached to the camera. Everything else is custom class-based code elsewhere in the codebase that the script invokes once per frame.

Anyway, so we're of limited help on traditional unity things, just to warn you.

Draco18s:
This rant may provide if not insight, then sympathy.

That said, Unity is really difficult to work with in some ways, but really awesome in other ways.

What version are you working with, 3.5, 4?

One thing to avoid: OnGUI.  Do not use the built-in GUI tools, it will only end poorly.  Either spend the money on a gui package (like iGUI*) or use an orthogonal camera and 2D planes and mesh-text.

Shaders: you can probably get away with the various supplied shaders and freely available shaders out there if you're doing something like a dungeon crawling roguelike.  You aren't doing anything that would require rim lightning or translucency or subsurface scattering.  You need rocks.

*Note: I don't like iGUI much, but it's still better than native and not that expensive.

x4000:
The only thing that I use OnGUI for is for textboxes/textareas.  If anyone knows of a third party solution that provides sprite-based support for those, I'll be all over it because that's the last piece that we have not been able to ditch.

Draco18s:

--- Quote from: x4000 on July 28, 2013, 07:43:15 pm ---The only thing that I use OnGUI for is for textboxes/textareas.  If anyone knows of a third party solution that provides sprite-based support for those, I'll be all over it because that's the last piece that we have not been able to ditch.

--- End quote ---

How's $10 sound? ;D

Navigation

[0] Message Index

[#] Next page

Go to full version