Game Development Community

Real time world manipulation. Someone help

by Andre Zangari · in General Discussion · 06/20/2005 (7:41 pm) · 11 replies

Hi, guys!
I would like to know how to manipulate the game world in real time. Every Torque tutorial I find on the internet explains how to make dif and dts files, but they dont explain how to change them.
For example: to make a level editor for the game, like in warcraft series, I have to divide the map in squares and change theses areas in real time to grass, water, etc... It is also important if I'm going to do a code that creates random software-generated scenarios. This is VERY important in my project. One solution I thought about was to create many small DIF or DTS files and tell the game when it is loaded to join them, making all these parts one big object, but I dont know if it is possible.
Does anyone know the solution to do this? Thanks for the help!

Note: Sorry if my text is not well written. English is not my language and I thing I speak terrible!
Note 2: Changing the texture isnt enough... I need to change the polygons

About the author


#1
06/20/2005 (10:13 pm)
Hit F11 when you have a mission loaded.
#2
06/21/2005 (12:26 am)
Here's a snippet of code that shows how to programmatically create objects in the mission using script:

// pos = position
function createTree(%pos) {
  %tree = new TSStatic() {
    shapeName = "~/data/shapes/trees/tree1.dts";
  };
  MissionCleanup.add(%tree);
  %tree.setTransform(%pos);
  return %tree;
}

// call this function like this:
// make sure %lx, %ly and %lz are valid x, y and z coordinates
%pos = (%lx SPC %ly SPC %lz SPC "0 0 1 0");
createTree(%pos);

Note: I am not sure this is "network safe" - I have not looked into that yet.

Edit: Note added
#3
06/21/2005 (6:37 am)
Matthew: Hitting F11 isnt enough.. I need to manipulate the world by software (like Diablo creates their maps, but in 3D)
Thijs: is this possible for creating a large scenario? There would be TOO many objects (imagine one object for each square in a warcraft series game level editor)


I had the ideia of loading two or more different DTS objects and when loaded, join them, making them one single object.
For example:
two objects that Have the shape of a "Z":
------
|Z|Z|
------
become one object, with the shape of two "Z"s toghether:
-----
|ZZ|
-----

Is that possible? If yes, how??
#4
06/21/2005 (6:50 am)
Andre,
Your english is just fine :]

I'm not sure if I understand exactly, but are you looking to incorporate 3d tilesets?

I haven't messed around with diablo's level editor, but Neverwinter Nights does this. I don't know how to go about incorporating this into torque though. Maybe someone has used 3d tilesets or has an idea how to do so.
#5
06/21/2005 (7:57 am)
Unsung, thanks, I read very much in english, but I hardly talk or write it. If u think my english is good, thank my videogames and PC games that made me train my english to understand them :)

I do not even know if there exists a Diablo level editor, but if u play Diablo ( i recommend, it's a very fun RPG), Every time u play the game, the scenario map will be different. The software has an algorythm to create a random scenario every time u play. I have a project of game that uses something near this concept. And I want to know how to do something like that in Torque. Incorporating 3D tilesets would be a great ideia, so a could incorporate for example many "grass", "tree" and "water" tilesets to make forest....
But I haven't found out how to do it in Torque... I wonder if it is possible..
#6
06/21/2005 (8:12 am)
As a former mapper for many games i think the freedom in the Torque Editor is lovely.
I think the best way to near this should be to make group of trees , building premade woods , towns etc.
Basicly i think people learn faster to make a map in Torque then using a worldeditor like
the one in Diablo or Wc .
The best thing about Torque is that you can runaround in the world while you placing stuff.

Only some thoughts
#7
06/21/2005 (8:33 am)
I want to be able to create missions from an algorithm too.. I've not touched the code yet.. but my idea is basically, modify the level loading script, choose a terrain and add the models for scenery based on some parameters as opposed to running the mission script and adding a pre-fabricated mission... Not entirely sure if this is what you're after.. but it sounds like it.

Sounds to me like you want to make a random maze similar to Diablo.. You'll need a load of buildings which can slot together, then add them to the mission using a procedure in the correct locations. I'm not sure if there will be a performance issue to be considered, lots and lots of DIFs may cause issues, but I don't know enough about that to say for sure and I've never done this myself.

Unless you're talking about dynamically changing the mission while the player is playing... which is a whole different thing I think.

Dynamicly created missions add replayability.. but your level creation engine has to be really good and generate interesting levels or people will get bored quickly.. Diablo's missions got incredibly samey at the lower levels...
#8
06/21/2005 (9:36 am)
Jason, thanks, you got the point :)
It something very near the random mazes that Diablo creates.
So, what's the solution? creating many, many DIFs in my opinion would cause problems...
#9
06/21/2005 (10:11 am)
I imagine a lot of it is in the layout of what you create... if you want a bunch of building peices that can form together randomly, then a lot of DIF's that can slot together seems to be a way to go. You'd have to develop the s ystem to do this, along the lines of a 3D tile system. Have some data structures to hold info on which peices can fit with which peices, then reference the .dif file to it. I don't see why this couldn't be done, just a lot of work, there probably isn't a canned way to do this that would work for everyone, sounds like custom work based on your needs for your game.

If you plan to generate terrian then you can just generate your own heightmap with it as well
#10
06/21/2005 (10:48 am)
I'm gonna second King Tut here. Slap buildings together, create your own heightmaps (possibly from tiles).
#11
06/21/2005 (2:46 pm)
Ok, tihs sound like a solution, but with this solution wouldn't I have too much instances of the difs objects????? It would consume too much memory.. Or there is a way to make them become one?