Jump to content


Photo
- - - - -

Using custom static objects in MP missions.


  • Please log in to reply
6 replies to this topic

#1 sittingduck

sittingduck
  • Posts: 613

Posted 20 February 2013 - 00:13

With more static objects in the works, this might be helpful for those wanting to make MP missions using them, and not have to worry about pilots that do not have the objects installed on their computer. Some pilots may think this is way too much work just for static objects in a MP mission, but it’s not as bad as it looks. If you can build missions, you can handle this.

This works in mods on or mods off.

Sorry about the length of the post, just trying to be precise.

And admittedly, this does bring up the discussion of having files other than mission files transferred to pilots joining. New Wings is (or was) transferring a .jpeg, and it did not seem to be an issue, so will go on the assumption that pilots will not object.

Additional load times are almost negligible. I have Vander’s airfield objects, and Difis’ targets both in one mission, and its hard to tell the difference in load times. Granted, this might change if someone is trying to load up a lot of different static objects, but looking at the size of the files to date, does not appear that any new objects will be so large as to cause an issue.

The task becomes a lot easier if the person doing the Mission Building is using one computer for Mission Building, and another for hosting . Otherwise they may have to edit files to do mission building and then change them to host the mission.

Biggest issue here is the fact the static object files have to be in specific directories, like data/graphics/buildings for the objects to be available to the mission builder when making the mission. But in order to transfer files to pilots joining, the file telling what to transfer (the list file), has to point to directories that already exist on the target computer. Data/graphics/buildings does not exist in a stock install. Neither does data/graphics/buildings/textures. If the list file has an entry pointing to a directory that does not exist, the pilot joining gets a file transfer error. The list file can not create a directory, it can only transfer files to a directory that already exists, and is under the data folder.

Using the aimtargets as an example.

Build the mission using the targets. Good idea to make sure its complete before going thru the hassle of making all the necessary edits to use this in a MP mission, because if you reopen and save it, you have to rebuild the list file.

Locate your data/graphics/buildings folder. This is not a stock folder, it got created when you installed the airtarget mod. There may be other things in here from other mods, but all we want are the aimtarget files. There should be 4 of them: a .col file, a MGM file, a .txt file, and an 01aimtarget.mgm file. If the computer being used to build the missions is the same computer that will be used to host the mission copy (don't move, you need to leave these here for other missions you might want to build), these 4 files to your data/graphics folder. If another computer is doing the serving, copy these files to the data/graphics folder on the server computer. Inside your graphics/building folder there is a textures folder. Copy the aimtarget.tga, and the aimtarget_dmg.tga files to your graphics/textures folder. Again, if there is a separate server computer, copy these files to the graphics/textures folder on the server computer.

What we are doing here is copying the files to places where 1: They are in a directory that can be defined for a file transfer in the list file, and 2: Are still in a location where they will work in the mission.

Now that we have these files in different folders, we have to tell some other files to look for them in the new location.

First is the luascripts/worldobjects/aimtarget.txt file. Luacripts/worldobjects is not a stock folder, it got created when the aimtarget mod was installed. This file only has to be on the server computer, it does not get transferred.

open it in notepad, and save it as oldairtarget.txt

reopen the original airtarget.txt file in notepad, and find these lines.


VisualImage=0,"graphics/Buildings/aimtarget.MGM",true
CollisionBody="graphics/Buildings/aimtarget.col"

change the directories to:

VisualImage=0,"graphics/aimtarget.MGM",true
CollisionBody="graphics/aimtarget.col"

Save it as aimtarget.txt. If there is a server computer, create a folder called worldobjects under data/luascripts, and copy the aimtarget.txt into that folder

Open up the .mission file for the MP mission in notepad. Do a find on aimtarget.mgm. Change all the intances of graphics/buildings/aimtarget.mgm to graphics/aimtarget.mgm. Save the mission file, and delete the msnbin file for the mission.

We have all the files we need to run the mission in directories that are already on everyones computer. Everyone has a graphics folder, and everyone has a graphics/textures folder, so we can transfer files via the list file to these directories
add these lines to the list file for the mission:

filename="graphics/01aimtarget.MGM",""
filename="graphics/aimtarget.MGM",""
filename="graphics/aimtarget.col",""
filename="graphics/aimtarget.txt",""
filename="graphics/textures/aimtarget.tga",""
filename="graphics/textures/aimtarget_dmg.tga",""

save the list file. If you need to make edits to the mission, copy this list file first, and save a copy, because mission edits will remove all those added lines when you resave the mission.

If there is a server computer, upload the .mission, the list and the language files to the server.

Also, if the computer doing the mission edits is the same computer doing the hosting, the aimtarget.txt file in the luascripts/worldobjects may have to be changed back to graphics/buildings if you want to do edits to the mission.

For Vander’s Airfield objects, you would repeat the process for his files. If you extract the airfieldobjects mod into a test folder, and you can see what files he is using. The list file would need these lines.

filename="graphics/01airfieldobj_01.MGM",""
filename="graphics/10airfieldobj_01.MGM",""
filename="graphics/11airfieldobj_01.MGM",""
filename="graphics/airfieldobj_01.col",""
filename="graphics/airfieldobj_01.MGM",""
filename="graphics/airfieldobj_01.txt",""
filename="graphics/textures/airfieldobj.dds",""
filename="graphics/textures/airfieldobj_d1.dds",""


One other point for future static mods. I know for existing objects, like the stock vehicles, the xxxxxx.txt file for the object that is in the graphics/xxxxxx folder is usually an empty file, (ie 0 bytes). The list file cannot transfer a file that is zero in size. So there must be at least something (seems just a space will do) has to be in that file to give it a size.

If the creator of a static mod included a seperare .rar file for a server computer with the files in the right directories for MP, then it would save the mission builder some time moving files, but the .mission file and list file still have to be edited after the mission is built.
  • 0

Old Fokkers Squad


#2 AnKor85

AnKor85
  • Posts: 1002

Posted 20 February 2013 - 06:27

Thanks for the detailed instructions, but I have some comments to add.

But in order to transfer files to pilots joining, the file telling what to transfer (the list file), has to point to directories that already exist on the target compute

You don't have to worry about players not having custom directories. The mission downloader will create them automatically, we already tested it long ago with custom cloud mods (follow this thread to get details Re: weather generator beta 1.4).

Another issue is omitting checksum
filename="graphics/01aimtarget.MGM","" <– checksum should be here
will work but will cause the file to be redownloaded every time player joins the server, even if the file already exists on player's PC.

The trick I use to get around this is to add Media MCU into the mission which references the custom file. It doesn't matter that MCU points to unsupported file format (i.e. non media) and that it is never triggered. The mission editor will add all referenced files into the list. Just don't forget to make sure you use '/' instead of '\' when typing in the path, otherwise mission downloader will fail.
Media MCU has also a benefit that you can save them as a group for each kind of custom object and then just add into every mission which uses that custom object.

First is the luascripts/worldobjects/aimtarget.txt file. Luacripts/worldobjects is not a stock folder, it got created when the aimtarget mod was installed. This file only has to be on the server computer, it does not get transferred.
If I recall my experiments correctly this file doesn't have to be transferred unless you create a linked entity for your custom object.
The problem is that even if you transfer it the game won't pick up this file until restarted. So those players who join the server for the first time and don't have that object will get an error. This means that it is better to avoid creating liked entities for custom objects.
  • 0

#3 sittingduck

sittingduck
  • Posts: 613

Posted 20 February 2013 - 13:51

Thanks.

will go back and try again, but am sure I have never been able to create a directory with a list file.

agree with the checksum. thought it would be simpler to go without, rather than try and explain how to get crc32 checksums for any new mods.

Can you go into more detail on how you use the media mcu? I noticed it adds a line to the list file for the file, but again, as I remember it, that file had to be in a stock directory.

in all my testing, the luascripts/worldobject txt files only had to be on the server. Even with the aimtargets and airfield objects as linked entities, all the pilots joining saw the objects.
  • 0

Old Fokkers Squad


#4 AnKor85

AnKor85
  • Posts: 1002

Posted 20 February 2013 - 15:50

Can you go into more detail on how you use the media mcu? I noticed it adds a line to the list file for the file, but again, as I remember it, that file had to be in a stock directory.
Well, not much details left.
I just add a translator media like this:
Attached File  translator-media.png   21.98KB   767 downloads
And mission editor adds a line into .list file like this:
filename="graphics/blocks/01watertower_v_01.mgm","90c88f41"

Folders will be automatically created on player's PC - it worked on Syndicate with custom clouds and with my multiplayer photo recon button.

The only important thing to note is that you have to use '/' as the directory separator instead of '\' which is normally used in Windows.
  • 0

#5 SYN_Vander

SYN_Vander
  • Tester
  • Posts: 4708

Posted 20 February 2013 - 15:57

In the Media MCU, select type image, then simply type in the full path + file name in the selection box. e.g: graphics/blocks/house_01.mgm

for each line you need in the .list you create one Media MCU.

I experimented with 3d objects in multiplayer missions, but abandoned the idea beacuse if I updated the mission file, the clients would get problems. They would get stuck in the download mission screen. I guess because it wasn't allowed to overwrite the object files or something…
  • 0

#6 AnKor85

AnKor85
  • Posts: 1002

Posted 20 February 2013 - 17:04

Yes, it is too easy to mess up something, with auto downloaded being quite fragile you will soon be scratching your hand guessing what went wrong :(

Then, there was a bug causing downloader to show an error or even crash if some files are updated, and that's why every change in a mission was getting a new version number. I don't even know if the bug was fixed.
  • 0

#7 sittingduck

sittingduck
  • Posts: 613

Posted 21 February 2013 - 01:05

well,,,I know at one time we tried doing something that needed to create folders, and could not, so going to try and save face by assuming they changed all that.

But you are right, you can create folders.

Damn, that could have saved me alot of time.
  • 0

Old Fokkers Squad





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users