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.
Last edited by Dafe; Mar 22, 2009 at 03:13 PM.