Game Development Community

Dynamic maps - How?

by Carl A Harris · in Torque 3D Professional · 03/12/2011 (1:49 pm) · 16 replies

I'm not sure how to ask this question. Please forgive me.

I have T3D (1.0.1 & 1.1 Beta3), TGEA, & TGE.
How can I make the engine randomly spawn objects around the map? Can I make Torque create a terrain similar to Minecraft, where it dynamically creates a bunch of block for the terrain, then drop some house, rock, trees, etc.

If so, which engine would be the best to use for it?

You'd think after this many year, I'd have learned something. I'm apparently a kind of stupid.

#1
03/12/2011 (6:21 pm)
You are hardly dumb. However, I would strongly recommend you hang out in the IRC chat for GarageGames as there are very many people that could help you learn about things you may have never heard of. As for creating a minecraft style game. Since you can purchase the source code for the engine you could do a system like that. It is not impossible, it will take some blood and sweat.
If you know your terrain is an object that holds attributes and you say in your script. Hey take a random coordiante between these values and spawn this random object there. That could work to do what you are asking about. Are you looking for a torquescript example or?
#2
03/13/2011 (6:37 am)
www.amazon.com/Game-Programmers-Guide-Torque-GarageGames/dp/1568812841
This book will teach you what you need to know for the type of game you are talking about. No blood, no sweat. Torque can make a minecraft style game out of the box. You just need to learn how to script it.
#3
03/13/2011 (7:59 am)
Thanks guys. :)
I'll have to check both out.
#4
03/13/2011 (11:44 am)
Notch just blogged about the terrain generation in Minecraft. It could prove to be useful: http://notch.tumblr.com/post/3746989361/terrain-generation-part-1
#5
03/13/2011 (1:37 pm)
What I'm curious about. Is how could I make the engine place blocks.

I have just ordered the book suggested by Mike, and a couple of others.

I have lots of ideas, and things I want to do. Just no method of accomplishing them.

I like what Notch has done. I've been wondering for years, about how to accomplish it.

After reading that post, I'm pondering a different method of creating terrain. I just don't know how to make the engine place the block. I don't know that much about the engines.

I'm beginning to think I'm too old for this ... stuff. :)
#6
03/14/2011 (5:55 am)
The mission file is nothing more than a TorqueScript file that spawns objects. There's nothing preventing you from spawning objects in the same way from other scripts at dynamically calculated positions.

For Minescraft-style blocks, I suggest you use StaticShapes, using different StaticShapeData datablocks for the different types of blocks. They are faster to spawn than TSStatic objects because they only need to send their datablock ID through the network, while TSStatics need to write the entire path to the shape file they are using. StaticShapes also contain useful properties like damage and offer functions to be "destroyed".
#7
03/14/2011 (1:23 pm)
Maybe it's not really an answer on your question, but i do think these words might be related. We actually succeeded in our team to make a full terraforming something like Minecraft style, but without visible cubes. So right now, we can already make few things ingame and with network support (Read: other players who are online, and another, who has just joined the game will see all the changes):
1) raise/lower Torque terrain
2) flatten and flatten with elevation angle Torque terrain (for futher houses, walls and othe objects placement)
3) aaaaaand make tunnels, undeground rooms, intersections and everything that comes in your mind
4) make everything above in mind with substances (if there is 1 meter of sand on top of 1 meter of rock, after lowering terrain 1 meter down, you will see a rock, actually, same logic within tunnels).

currently (it's pre pre prehistoric alpha stage ATM) it looks like that:
lifeisfeudal.com/screenies/1.png
lifeisfeudal.com/screenies/2.png
lifeisfeudal.com/screenies/3.png
lifeisfeudal.com/screenies/4.png
lifeisfeudal.com/screenies/5.png
lifeisfeudal.com/screenies/6.png

But i'd like to say, that it's alot of work to be done, if you want to implement something like that, so think twice, before entering that river 8) And if you're interested, i can explain you basic mechanism of what we did there.
#8
03/14/2011 (1:45 pm)
wow, very cool,
I'm sure interested in how you did this.
#9
03/14/2011 (1:46 pm)
To me, that is very impressive work. Yes, please explain the basic mechanisms!
#10
03/14/2011 (2:07 pm)
Great job Vlad!
Glad to see you are progressing on this. Well done!
#11
03/14/2011 (2:13 pm)
Wow, had the same idea as you Vlad, but you on the other hand, managed to create it! Very cool!
Quote:Yes, please explain the basic mechanisms!
++;
#12
03/14/2011 (2:20 pm)
Woah, quite fast, hasn't expected, since two my other topics had never been answered at all 8)

Well, we've designed our own .ter2 (and indexing file), that stores data for all different substances, including air. So, when you stay on our game cell (4x4 torque units) on terrain game actually knows, that there is: solid rock from 0 height till 250 with quality(q)=99, soil 250-280 q=50, air 280-284 (it's tunnel there), soil 284-300 beneath you and air till the maximum height above you. So we store 512*512 such columns descriptions per one terrain block (.ter) and one .ter2.
It's 10 ingame centimeters step for lowering/raising ground and 0,5 meters step when you dig downward or upward underground.

So we got a structure, that can hold any data about terrain levels above or underground and substances (for futher mining, digging and so on).

We had to alter terrain class a bit, to be able to shape it in a runtime (the main idea was to copy World editors WYSIWYG into game itself). About tunnels - we generate Convex objects for each cell of a tunnel (1 convex per floor, wall or ceilling) according to height of that cell and height of tunnels in neighboring cells we shape floor and ceilling convexes accordingly (you can see it on some screenshots).
And of course, we paint them with according materials (but that's a problem, since those convex shapes are limited to 512*512 textures for unknown reason).

Changes file is being written during server operation, so that new players joining during game get all new terraforming changes, that was made before they've connected.

P.S. Forgot to mention, that when you raise/lower ground, sloughing appears, if certain height difference with one of neighbouring cells exceeds.

P.P.S. Sorry for my English - not my native language, as you might have figured out.

P.P.P.S Of course our current terraforming got alot of bugs and glitches, especially in convex shaping in some exotic tunnels crossings.
#13
03/14/2011 (4:00 pm)
I would love to be able to use this.
Please let us know when you finish. If affordable, I'd be willing to buy the terrain engine to put into my game ideas.
#14
03/15/2011 (12:12 am)
Ok, i think we will make a pack with that mechanics, but that will be only at pre release stage, which is far far far away ATM 8)
#15
02/24/2012 (6:32 pm)
@Vladimir - Any word on your terrain? :)
#16
02/25/2012 (7:27 am)
I started doing dynamic maps (and will return to them in the future) using a database as a data source. You don't have to, it just makes it convenient for storage. I actually would assemble the entire "map" file and execute the data to create the mission. The trick is understanding the mission entry points and sequence of object creation. If your map is just objects make sure they don't have gravity on them! Or they will fall to nothingness if there is no terrain.