HTOTM: FUSION
Original Post
Environment Extension
I'm just putting this out there, because I started working on it, and if people know about it, it may help motivation to finish on my end, and getting pressure on the devs to implement things that a complete version of this will require.

The point is to allow static environments with greater than 16 objects that players can interact with. This is accomplished by parsing an environment file for a model, and loading a flat environment file with dummy objects, and shifting their positions and dimensions around depending on proximity to Toris, and just drawing all of the other objects that should be in the environment.

How to Use:
DEnvironment.lua and monkeyBars.tbm go in your data/scripts folder.
DEnvironment.tbm goes in your data/mod folder

Load the Lua script, and it will set up the environment. Objects you can interact with are red, and others are white (for debugging purposes).

To play with the environment, you can edit your copy of monkeyBars.tbm, or change line 326 in DEnvironment.lua to read a different file. See Issues for limitations.

Issues:
1. enter_frame - This hook needs to fire during replays, or else the replays will be bugged. Making this hook fire during replays should also fix viewing replays for stuff like rocket boots and my wings script, so this is a good thing to lobby for.

2. With this version of the script, the environment just checks proximity from the center of the object to Tori's head, so if you mess with the mod file in the scripts folder, bear in mind that it probably won't work properly with large objects. Also, if you get dismembered, body parts are liable to float through objects that are far away from your head.

3. It currently just gets the four closest objects. This is easy to change. I just wanted to test viability without making an enormous environment.

4. There's only support for boxes at the moment. Spheres would be a trivial addition, but capsules could be annoying. A Lua addition that's necessary for this to work for any sort of complex environment is changing an environment object's shape. Need something like set_object_shape().

5. Static objects only - Without huge changes to the game engine, this is only viable at all for objects that won't be moving at all. As such, joints and things are out as well. However, certain movable objects could be flagged to always persist, at the cost of virtual object count.

6. Environment to read is hard-coded in. Toribash Lua currently doesn't have any way to read a directory listing, so there isn't a particularly good way to select an environment to load. If this goes well enough, though, it may just be worked into the game code. We'll see.

7. The script was developed on a Mac, and something about how Mac clients and Windows clients delimit lines is different. This no longer breaks the script, but output of values on the debug print functions looks weird.

Enjoy.
Attached Files
monkeyBars.tbm (2.4 KB, 79 views)
DEnvironment.tbm (640 Bytes, 76 views)
DEnvironment.lua (8.8 KB, 65 views)
Last edited by Dafe; Mar 22, 2009 at 03:13 PM.
Radioactive torso's description should be, "You have cancer like wow."
Pretty sick stuff.
I want to see an epic castle made with it :P

Also you should add the ability to make objects that are only drawn, as in you could make a big invisible box as a wall but then have some like detail on it that is just drawn, could be like
"#env_obj_draw"
"#sides 1 1 1"
"#pos 1 1 1"
"#rot 0 0 1"
and such
:D
can you post a screenshot of what this script can do?
ICOF Co-Founder/Leader. "Ten soldiers wisely led will beat a hundred without a head." - Euripedes
It's just going to look like an environment with a lot of objects, where 4 of the objects are red.

The red ones are tangible, and which ones are red changes depending on your proximity to them.
Radioactive torso's description should be, "You have cancer like wow."
If you've got error messages from stderror or your console or something, that would help to address the problem.
Radioactive torso's description should be, "You have cancer like wow."
these are the errors:
failed to load texture data/textures//menu
failed to load texture data/textures//menu
failed to load texture data/textures//menu
failed to load texture data/textures//menu
Unable to open mod data/mod/DEnvironment.tbm
Lua script error in file DEnvironment.lua: data/script/DEnvironment.lua:73: bad argument #1 to 'rad' (number expected, got string)
failed to load texture data/textures//menu
Oh right. Newb had this problem when he was helping me test. If will work if you put a space on the end of every line in the monkeyBars.tbm file. I'll add this to issues.
Radioactive torso's description should be, "You have cancer like wow."
couldn't you just cheat and add a space to the end of each line if it doesn't have one before you parse it :3
:D