PDA

View Full Version : Exploring Area Modules and their components (Was a Discussion on scripts)


Darkkender
05-08-2006, 05:47 PM
I've been recently playing around with making an underwater module like was in K1 on Manaan. One of the things I'm trying to do is figure out which of the scripts within the module play the bubble animation for the sea floor. The problem comes from the fact that I have a very strong problem with trying to read the pcode/byte code. The problem is I get confused about 5 characters in when trying to use torlacks tutorial on it. To make matters worse is the fact that I can't seem to find my older copy of the JRE that DeNCS worked on. If anybody knows off hand which animation number it is for the sea floor bubbles I might be able to figure out a script of my own to do the same thing.

I'm only 3/4 sure it is script driven as a looping animation but I can't seem to find the right reference in the 2da files or NWNscript.nss. I don't even know if the animation is still around for K2. However I'm hoping it is one of the many things that they didn't clean out and left alone. I've already torn apart the other main module elements including loading the module models into gmax to see if I spotted any bubble models and I couldn't find any. This is why I'm sure it has to be script driven.

stoffe
05-08-2006, 08:10 PM
One of the things I'm trying to do is figure out which of the scripts within the module play the bubble animation for the sea floor.
(snip)
If anybody knows off hand which animation number it is for the sea floor bubbles I might be able to figure out a script of my own to do the same thing.


As far as I can tell that is not a scripted effect, the bubbles are an animation that is part of the area model. The only animations played in the underwater area are of the (non-aggressive) Firaxa sharks that swim around in the distance.

blawk
05-09-2006, 03:06 AM
Hey DK,

I think stoffe is right, but I'm not sure because I've been looking around and as far as I know, areas don't have embedded animations (mainly because it would be useless as the game can't interact with the model itself). The bubble is made from a texture AFAIK (although, it's the area model which provides the background color for water, the texture is transparent except for the edges/borders of the bubble), I found it while digging for some other stuff. Maybe "tracing" usage of the texture helps to find the involved code that shows up the animation.

If I have time I'll post the name later today.

Cheers, and keep up the nice work.

[edit 1]: BTW, any idea on editing area models? Are those "hard coded"/packed inside the game? I'm *quite* interested on this. I know porting isn't Good (TM) but It could be Fun (TM) to get one of the maps of Jedi Knight II inside TSL.

stoffe
05-09-2006, 05:30 AM
I think stoffe is right, but I'm not sure because I've been looking around and as far as I know, areas don't have embedded animations (mainly because it would be useless as the game can't interact with the model itself).

Areas can have embedded animations, both ambient ones that run all the time, and specific sequences of animations that can be triggered with the PlayRoomAnimation() scripting command.

For example, the simpler forms of such animations are like the rotating gears and waterfalls in the Taris sewers in KotOR1. The more advanced ones, triggered by scripts, are like the arrival of the Harbinger at Peragus, or the repair of the Dantooine Academy in Kotor2:TSL.

blawk
05-09-2006, 09:47 AM
Areas can have embedded animations, both ambient ones that run all the time, and specific sequences of animations that can be triggered with the PlayRoomAnimation() scripting command.

For example, the simpler forms of such animations are like the rotating gears and waterfalls in the Taris sewers in KotOR1. The more advanced ones, triggered by scripts, are like the arrival of the Harbinger at Peragus, or the repair of the Dantooine Academy in Kotor2:TSL.

Thanks for the information, my apologies. Although, it's not the model *itself*. They must be using something to act as "layer" between the model (polygons, and "animations". water falls can be hard coded for sure) and the game engine. BTW, I'm not sure if an area could use an existing animation and "place it" in the "background". The Peragus ext. may be structured that way (you can see the interior with Atton in the terminal too).

Cheers.

blawk
05-09-2006, 10:28 AM
OK, dunno if this should be an edit for the previous message but I just found an example of the bubble "texture": PER_bubbles.tpc , also fx_bubble.tpc and fx_kolto_bub.tpc

Waterfalls, for example, use this one: PLC_waterfall.tpc

oldflash
05-09-2006, 10:45 AM
Those are textures. I suspect they may be some sort of emiters (vfx) just like smoke and fireplace effect.

Darkkender
05-09-2006, 12:00 PM
I couldn't find any textures originally that were for bubbles underwater. The only underwater textures I could seem to locate was the grass for seaweed. That's whats frustrating because there is usually some sort of reference in the various files to relate to the extra textures used.

So from what you can tell stoffe all of the scripts in that module are for the firaxa sharks?

As to the area models blawk there has been alot of effort put forth in the community by our tool developers relating to further breaking apart the model format. If I under stood PERL better and could get all of the modules needed installed properly I would have a test change based on an error I was receiving for area models. I was playing with mdlops replacer function with area models and it seems that one set of there coordinates are outside the bounds of what mdlops is setup to handle. I mentioned it to Cchagrin about a month ago but he hasn't gotten back to me about it. I'm sure he is just swamped is why. So if anybody more adept with Perl wants to work with me on testing an upgrade or series of changes and upgrades for mdlops then we might be able to pull off breaking the area models.

mjpb3
05-09-2006, 12:10 PM
I could be wrong, and please forgive me completely if I have no idea what I am talking about here :rolleyes:

But doesn't the watersuit have the bubble animations in the model file?

Like I wrote I could be completely missing what the context of the discussion is, so please forgive me...

Darkkender
05-09-2006, 12:23 PM
The Watersuit is just a reskinned spacesuit. As to the bubbles they are only in specific locations within the module itself. In fact you can run around in the module without the watersuit if you want. Just watch out for the sharks.:p

blawk
05-09-2006, 12:52 PM
As to the area models blawk there has been alot of effort put forth in the community by our tool developers relating to further breaking apart the model format. If I under stood PERL better and could get all of the modules needed installed properly I would have a test change based on an error I was receiving for area models. I was playing with mdlops replacer function with area models and it seems that one set of there coordinates are outside the bounds of what mdlops is setup to handle. I mentioned it to Cchagrin about a month ago but he hasn't gotten back to me about it. I'm sure he is just swamped is why. So if anybody more adept with Perl wants to work with me on testing an upgrade or series of changes and upgrades for mdlops then we might be able to pull off breaking the area models.

I just tried two, one worked, the other failed. Here's the one that worked, rendered without textures. Scale and everything else is perfectly set.

http://blawk.krath.googlepages.com/261tel-render-potato.jpg

edit 1: it's still a real problem that we don't know what textures are used in each mesh. it's all a try-check-discard game until you find the right one.

edit 2: potato power added, plus textures loaded. old image at:
http://blawk.krath.googlepages.com/261tel-render-notextures.png

Darkkender
05-09-2006, 12:56 PM
What did you do? Did you use the Replacer function of mdlops? If so which version of mdlops 0.5 or 0.6a?

Moderator's could you change the title to the following so that the thread is properly titled. --Exploring Area Modules and there components Was a Discussion on scripts.--

Done! ~ ChAiNz.2da :D

mjpb3
05-09-2006, 01:29 PM
The Watersuit is just a reskinned spacesuit. As to the bubbles they are only in specific locations within the module itself. In fact you can run around in the module without the watersuit if you want. Just watch out for the sharks.:p

Yar! Well, as I wrote, I was taking a shot in the dark... :D

blawk
05-09-2006, 02:12 PM
What did you do? Did you use the Replacer function of mdlops? If so which version of mdlops 0.5 or 0.6a?


mdlops 0.5. Did nothing, just looked up the name of the mesh/model used for one of the rooms in 261TEL and converted it to ASCII MDL, then loaded in 3D Studio. I'm re-texturing the scene just for fun, but can't find the texture for the door, seems to be missing (OK, checked again and TEL_hut is there finally. It would be great to have mdlops extract the textures automatically).

Some models *will* fail. I believe it's because mdlops expects to get some data in the MDL file that is unused in area meshes. Dunno.

BTW, it can be resource intensive, and you should try twice. For some reason it didn't work for me the first time. Never give up at the first try :D

I still doubt about the possibility of adding new areas in-game, they load the textures within the engine, some way I don't know, also I don't know how they set the models for each room, if it's just a resref to the MDL or something more complicated.

At very least, you can use the area scenes for your own CGI cutscenes and movies.

Cheers.

EDIT 1: Maybe I could try to write down a list of area models that *work* right now and can be successfully imported and edited. I'm testing a few right now. Note that this is all "modularized": each room inside an area is an unique model/scene. The game engine connects them with triggers and the like, but they are all independent, which makes me think that advanced (probably hardcore :)) area modification is possible (ex. making a completely new area out of modified room models using existing textures).

The problem I see here is that textures can't be introduced (talking about area related ones, item and NPC models have those assigned via 2da files, which seems not to be the case for area textures), and same happens with models, or maybe I'm wrong and it's something still to be discovered. It's a matter of trying to extract a model, work on it, save it, put on override along a module created from scratch prepared with "rooms" actually using the new models and pray to get it working.

EDIT 2: I think stoffe was partially right on the animations. Although, I haven't found embedded ones yet. I guess those are really rare cases. 261tel animations (the ones of the crashed shuttle), are all either game engine/script based. Model is 100% static.

Darkkender
05-09-2006, 04:54 PM
Are you talking about some models failing decompiling from mdl to ascii-mdl? Because I've never had one fail me there. Every model I've ever wanted converted to ascii has always worked. Now the reverse isn't true when changing the model and trying to replace the original model with the new model.

Pavlos
05-09-2006, 05:02 PM
Textures are assigned to models by their names :). It has something to do with HEX editing and all that icky stuff but nothing that we cannot do. I believe Darth Insidious was HEX editing 262TEL a while ago for a mod he was working on. Also, I doubt, to be honest, that if you did manage to get a new area into the game (Lightmaps and all) that you would be willing to spend the time fiddling with the .are alignment :p. All those numbers would drive even the most dedicated code breaker mad...

Darkkender
05-09-2006, 05:05 PM
Textures are assigned to models by their names :). It has something to do with HEX editing and all that icky stuff but nothing that we cannot do. I believe Darth Insidious was HEX editing 262TEL a while ago for a mod he was working on. Also, I doubt, to be honest, that if you did manage to get a new area into the game (Lightmaps and all) that you would be willing to spend the time fiddling with the .are alignment :p. All those numbers would drive even the most dedicated code breaker mad...

You're not willing to wager money on that are you? I was doing some of that with the deathstar mod that I scraped. My only problem was the walkmesh files.

Darth333
05-09-2006, 05:10 PM
New textures can easily be assigned by HEX editing the models and you can also remove the parts of an area you don't want to use. After this, it's a matter of renaming the proper files to make sure you don't change anything in the existing module.

I don't have much time to post about it right now but it has been briefly (and informally ) discussed here: http://www.lucasforums.com/showpost.php?p=2003140&postcount=55 and here: http://www.lucasforums.com/showpost.php?p=2004517&postcount=77

blawk
05-10-2006, 02:57 AM
New textures can easily be assigned by HEX editing the models and you can also remove the parts of an area you don't want to use. After this, it's a matter of renaming the proper files to make sure you don't change anything in the existing module.


I see, what's the procedure for the room removal? Does the game automatically "close" removed rooms? Let's say, like you are trying to get into a room that existed in the module but it's now removed. If the game doesn't find the model for the room you're trying to access, it would probably crash (or make you fall in the "Oblivion" like in GTA games :D).

Also, any good hex editor for win32 which is free? WinHex is good but it's not free and you need to get a license for editing files >200Kb.

edit 1: found http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm#download

I will remove the crashed shuttle from the model and try to get it to work in the game. Even with Mr. Potato. Just for tinkering a bit. Anyone has done something similar before?

Cheers.

Darth333
05-10-2006, 11:12 AM
I see, what's the procedure for the room removal? Does the game automatically "close" removed rooms? Let's say, like you are trying to get into a room that existed in the module but it's now removed. If the game doesn't find the model for the room you're trying to access, it would probably crash (or make you fall in the "Oblivion" like in GTA games :D).

You have to edit the .are and the .lyt files. Check the links I posted above:
I hex edited the model file to point at the new textures. In fact, I'm only using room 262telu for this mod (renamed to 263telu). I got rid of the rest of the other rooms in the area as they didn't fit the location of the tomb. I had to rename and edit the .lyt file too and delete references to other rooms in the 262tel area or it would crash when loading from a savegame (but it loaded when entering the module for the first time).

I tested and retested and no crashing problems so far :)

Pavlos
05-10-2006, 11:21 AM
You just delete the model reference in the walkmesh file. That will cause the model to dissapear from your module. What you will see is an empty space where the model once was with no walkmesh and probably just the skybox shoing through (Unless there is something behind the model).

You cannot simply remove the shuttle from 261TEL by this method as to my knowledge there are only two models involved in this module: the skybox and the plateau. You would have to go about actually editing the model... which could well cause it to become unusable. But it is always worth a try :). If people didn't try then we wouldn't be where we are with KotOR Modding!

Darth InSidious
05-10-2006, 02:49 PM
Textures are assigned to models by their names :). It has something to do with HEX editing and all that icky stuff but nothing that we cannot do. I believe Darth Insidious was HEX editing 262TEL a while ago for a mod he was working on. Also, I doubt, to be honest, that if you did manage to get a new area into the game (Lightmaps and all) that you would be willing to spend the time fiddling with the .are alignment :p. All those numbers would drive even the most dedicated code breaker mad...

Yes, I am still doing it...It's possible, but the slightest mistake and all your efforts can be utterly in vain.

RE: Layout changing. Yes, it's possible, but putting different models from different areas together is not. I tried time and again, but it wouldn't work...

blawk
05-12-2006, 05:35 PM
You just delete the model reference in the walkmesh file. That will cause the model to dissapear from your module. What you will see is an empty space where the model once was with no walkmesh and probably just the skybox shoing through (Unless there is something behind the model).

You cannot simply remove the shuttle from 261TEL by this method as to my knowledge there are only two models involved in this module: the skybox and the plateau. You would have to go about actually editing the model... which could well cause it to become unusable. But it is always worth a try :). If people didn't try then we wouldn't be where we are with KotOR Modding!

Well, I just removed the shuttle and the snow planes around it, added a patch snow plane and it looks well for testing. Now what should I do to export it to mdl? I'm using 3d studio max 8 with the MDL plugin and nothing else. Or I'm just wrong and there's no way to actually export edited models?

[edit 1] I've been able to introduce the modified model in-game, without the shuttle. Although, it's not exporting my new plane which fills the space left by the shuttle placement. Although, I believe it's something related to the textures as I can walk on it (it's just that I can see the skybox below). I'll post an screenshot tomorrow. Maybe we are just a step before being able to perform further changes on area models. I guess others will be easier than this one (my apologies of not choosing the most easy one for testing).

The problem of the plateau is that there's virtually nothing below the plateau and the skybox, just a specially modified plane and nothing more. thus, any gap left there is more evident.

Cheers.

Pavlos
05-12-2006, 05:51 PM
This is not my area but this (http://www.lucasforums.com/showthread.php?t=143293) might help you, or any of the stickied tutorials. The problem is that even if you did manage to successfully edit the model of the module... you still wouldn't have walkmesh where the shuttle used to be. Fred Tetra made progress with the creation of walkmesh a while ago so I recommend you have a search of the forums for the information regarding that.

blawk
05-12-2006, 06:44 PM
Got a screenshot, I'll try to fix this tomorrow if there's a way to get around it (I guess it's about making the plane being a child trimesh of 261teld, as every other trimesh does in the scene):

http://blawk.krath.googlepages.com/261tel-firstedit-noshuttle.jpg

Cheers.

edit 2: I've been able to work out the issue (partially):
I've linked the plane mesh to the grund mesh and then exported and compiled the model with mdlops:

http://blawk.krath.googlepages.com/261tel-mdl-compile-newplane.png

So, as I commented in a earlier post, it's the reason why the skybox was showing up instead of the plane. But, for some reason, it's not liking the texture loading :(:

http://blawk.krath.googlepages.com/261tel-mdl-newplane-notexture.png

I wouldn't like to be alone on this one, please, someone with experience on modeling AND using NWNMax send me a PM. I can provide the mdl/mdx files at request. I'm sure other rooms are easier to edit but it's better to go the hard way and get to know the stuff before messing with other models.

Cheers.

Pavlos
05-13-2006, 07:56 AM
[edit 1] I've been able to introduce the modified model in-game, without the shuttle. Although, it's not exporting my new plane which fills the space left by the shuttle placement. Although, I believe it's something related to the textures as I can walk on it (it's just that I can see the skybox below). I'll post an screenshot tomorrow. Maybe we are just a step before being able to perform further changes on area models. I guess others will be easier than this one (my apologies of not choosing the most easy one for testing).

You can walk on the empty space? You are doing well then :). Erm... a way you could cover up that empty hole is by creating a placeable that is just a flat object with the same texture as the ground around it.

blawk
05-13-2006, 08:14 AM
You can walk on the empty space? You are doing well then :). Erm... a way you could cover up that empty hole is by creating a placeable that is just a flat object with the same texture as the ground around it.

Haven't edited the walkmesh but I can walk over it except just one edge (apparently it's just an edge) that stops me from walking sometimes. I just can get around it.

BTW, a plane mesh is a flat object :) that's what I did exactly as mentioned in the message. I could try to spawn a re-skinned shuttle there. Although, I'm now trying to ge a working Mr. Potato there (I use that mesh when testing, no specific reason for the potato powah). Will bring a Millenium Falcon mesh probably, but that's going to require a few hours. It's the best solution to avoid messing with the plane anymore.

Cheers.

blawk
05-14-2006, 06:53 AM
OK, I finally got myself where I wanted to be since I started messing around with the model.

http://blawk.krath.googlepages.com/261tel-mdl-newplane-works-1.jpg

Some facts on area editing:


Sometimes it's a matter of having good luck. Errors come when compiling probably (no, it won't stop compiling, but the model won't behave as expected)
Removal of (tri)meshes is OK and will always work. Just make sure it's not merged down with another object or alike.
You can't use overloaded meshes. Keep it simple.
For adding new meshes, keep in mind that they need to be linked to another Aurora object in the model (eg. AuroraBase, AuroraTrimesh). This seems to solve most of the woes. Apparently, they also must override mat values (ambient color, etc).
Adding new lights works!


More to come, I just need to catch up and find out WT* is making some objects to keep out of getting their textures loaded.

Cheers.

Pavlos
05-14-2006, 06:56 AM
Adding new lights works!

How?! I was under the impression that this was the thing that was stopping area creation... please tell us how this works!

stoffe
05-14-2006, 09:35 AM
More to come, I just need to catch up and find out WT* is making some objects to keep out of getting their textures loaded.


I don't know if it applies to your situation, but I have a vague memory of the game engine being a bit touchy about loading textures from override that aren't already present in the texturepacks, for some types of objects. If all else fails you could try adding your new textures to the Texturepack ERF file and see if that makes a difference.

Darkkender
05-14-2006, 06:18 PM
Hey Blawk I am really eager to hear more about your results. Does this mean you can remove some model objects from a scene with some limited success? Such as removing crates and barrels that are not placeable files but directly inserted into a module? I would really love to hear more on that Voodoo magic.

blawk
05-14-2006, 06:33 PM
Hey Blawk I am really eager to hear more about your results. Does this mean you can remove some model objects from a scene with some limited success? Such as removing crates and barrels that are not placeable files but directly inserted into a module? I would really love to hear more on that Voodoo magic.

You can actually remove any (tri)mesh and it won't be a problem unless it conflicts with something else (like a linked mesh). For example, it's OK to remove a crate but it's stupid to try to remove a ground plane because objects right on it will be linked (except emitters, but I'm unsure if this applies for every case).

MDL requires you to have everything linked. From (top) parent (AuroraBase) to each AuroraTrimesh. Unlinked objects aren't exported.

I'm still getting sick of the texture loading problem, I have no issues when adding new objects but it sometimes work (ie. loads an existing texture) and sometimes doesn't.

BTW, you need to de-activate sanity checks when exporting the model via NWNmax. It sometimes shows up stuff which isn't actually broken. Then use mdlops to compile the ascii mdl.

No need to use the replacer or similar stuff. That's good for skins and the like, but way too out of place for area models.

I may be able to get time for describing the process with more detail, but it's unlikely I'll get it soon. I'm too busy right now :(

Anyways, it's not that complicated. If you have minimal knowledge on the tools, it's just a matter of tinkering for a while.

Cheers.

Darkkender
05-14-2006, 06:54 PM
I didn't know mdlops had a compile feature. I've always tried using the replacer feature and always had failures. If you could screenshot the compile method It would be really apreciated.

blawk
05-14-2006, 07:33 PM
I didn't know mdlops had a compile feature. I've always tried using the replacer feature and always had failures. If you could screenshot the compile method It would be really apreciated.

Select the file of the ascii MDL exported by NWNmax. Click "Read & Write model" button. You're done for testing.

It's documented in the README.

Cheers.

blawk
05-14-2006, 07:37 PM
I don't know if it applies to your situation, but I have a vague memory of the game engine being a bit touchy about loading textures from override that aren't already present in the texturepacks, for some types of objects. If all else fails you could try adding your new textures to the Texturepack ERF file and see if that makes a difference.

How can I do that actually?

I'm just done with the model and got everything working except the texture for the oil tanks.

Many thanks in advance.

Cheers!

Pavlos
05-15-2006, 03:04 AM
Extract the entire ERF with KotOR Tool. Add your new file to them and then recompile with the same name and put it in "texturepacks" (I think that is it's name).

blawk
05-15-2006, 06:36 AM
Extract the entire ERF with KotOR Tool. Add your new file to them and then recompile with the same name and put it in "texturepacks" (I think that is it's name).

Oh, yep. But I was thinking on a method which is not that overkill. I think there's a tool around that allows you to append files to an existing erf. Any idea on that?

I'll try the way you mentioned, but it would be good to have some other one. I don't know how one could solve the problem of distributing modified ERF files, as each one is around 400MB. That's just so hardcore that I would give up and use basic stuff which doesn't require me to touch the ERF files.

Thanks again!
Cheers.

edit 1: Didn't work. Yikes, I extracted everything, then added my file and it doesn't show up in the module. The texture isn't loaded :(. Any idea on other reasons that could cause this malfunction? TGA file properties?

blawk
05-15-2006, 07:21 AM
Those are textures. I suspect they may be some sort of emiters (vfx) just like smoke and fireplace effect.

Yes, OmniEmitters are placed in the area (room) models. For example, in the Polar Plateau (261tel), right in the middle of the crashed shuttle trimesh (for smoke vfx). Actually, you can play with them (just clone one and place it wherever you want).

stoffe
05-15-2006, 03:11 PM
Yikes, I extracted everything, then added my file and it doesn't show up in the module. The texture isn't loaded :(. Any idea on other reasons that could cause this malfunction? TGA file properties?

Some more random ideas that come to mind, keep in mind that modeling isn't my area of expertise so take what I say with a grain of salt. Anyway, the game is fairly touchy with texture properties in some places. For example I've had trouble getting portraits to show unless they are 24 Bit, while clothing textured had to be 32 bit (with an alpha cannel).

If you haven't already, make sure the textures are 32 bit with a blank alpha channel (unless you use it for something of course).

Also, the dimensions of textures matter... Don't know if there's a fancy name for it in english, but it has to follow the scale 16, 32, 64, 128, 256, 512 etc, or it may cause trouble.

Finally, check that the names of your textures aren't too long or contain fancy characters. Resrefs (filename without extension) can be at most 16 characters long and only contain lowercase alphanumerical characters and no spaces.