Uninstantiated groups & unused materials

Questions and answers about the how and why of making maps.
Post Reply
User avatar
StainlessSteelRat
Private First Class
Private First Class
Posts: 20
Joined: Fri Feb 18, 2005 11:34 pm

Uninstantiated groups & unused materials

Post by StainlessSteelRat »

I am in the middle of re-organizing my objects into separate files to "include" in my main map file (and upload to the prefab forum). I have several questions:

1. If I define a group but never instantiate it with the "group" directive, will it affect game play (take up memory on the client, slow fps?)
2. How about if I define a material but never apply it to anything? Will the client even be directed to download it?
3. What about defining a material twice exactly the same way, including the name? Will there be two copies? Will BZFS or the client get confused?
4. How about different materials that use the same large texture? Will they use up twice the memory, or will they share copies of the texture? Or am I getting too worried about nothing?

I want to keep every object in a separate file along with the materials needed for that object (e.g. rectWoodTable.bzw, roundWoodTable.bzw), but I don't want to have multiple copies of the same material included into the main file if it will slow things down. Otherwise I would keep all objects of a certain category in the same file (e.g. woodenTables.bzw) and only instantiate the ones that I need.

Does anyone else use the include directive? It really seems like it could add a bunch of modularity to map making.

-SSR
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

Post by SkillDude »

StainlessSteelRat wrote:1. If I define a group but never instantiate it with the "group" directive, will it affect game play (take up memory on the client, slow fps?)
2. How about if I define a material but never apply it to anything? Will the client even be directed to download it?
3. What about defining a material twice exactly the same way, including the name? Will there be two copies? Will BZFS or the client get confused?
4. How about different materials that use the same large texture? Will they use up twice the memory, or will they share copies of the texture? Or am I getting too worried about nothing?
1. Defining a group but not specifying it in a map will not add to memory in-game. But players will have to download the extra bytes/kb, whatever they need from the map file you provide.

2. Basically the same thing as number 1, it'll just add to the file size.

3. If you define two of the same materials with the same names, bzfs will use the first instance of that material.

4. Basically, whatever the player sees takes up memory, so yes, the more large textures the player "sees", the more memory it takes up. Theoretically, they do share the same texture, but the video memory needs to show both of them separately costing more memory.
User avatar
Spazzy McGee
Sergeant Major
Sergeant Major
Posts: 1405
Joined: Mon Mar 21, 2005 4:59 pm
Location: Planet MoFo, Sheffield Division; United Kingdom

Post by Spazzy McGee »

StainlessSteelRat wrote:1. If I define a group but never instantiate it with the "group" directive, will it affect game play (take up memory on the client, slow fps?)
2. How about if I define a material but never apply it to anything? Will the client even be directed to download it?
3. What about defining a material twice exactly the same way, including the name? Will there be two copies? Will BZFS or the client get confused?
4. How about different materials that use the same large texture? Will they use up twice the memory, or will they share copies of the texture? Or am I getting too worried about nothing?
sigonasr2 wrote: 1. Defining a group but not specifying it in a map will not add to memory in-game. But players will have to download the extra bytes/kb, whatever they need from the map file you provide.

2. Basically the same thing as number 1, it'll just add to the file size.
You know, I'm not sure about number 1 - many people do not realize that downloading a map 'in-game' does not actually download the same copy that was fed into BZFS. What is downloaded is a compressed binary copy.

If the end user does a /saveworld from the map on a server the client re-builds the map into something nicely readable. I'm really not sure that unspecified, yet defined groups will be downloaded... BZFS may simply eradicate them. On the other hand I may be completely bananas.

The best easy way to ensure either way is just to be sure you've removed any unused group definitions.

As for 2, I know for a fact that the client retains all material definitions - but downloaded textures will only be downloaded once, no matter how many materials they are used in. Again, safest just to remove unwanted materials...
"Life is what happens to you while you're busy making other plans." - John Lennon
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

As for question #1, bzflag will get a copy of a defined but not instantiated group. It will be downloaded by the client.

You can test this by creating a map with some defined but not instantiated object. Then save the map in the client and take a look at what you got.

And #2, the client will get the matref even if it is not used, It's like Spazzy said.
User avatar
StainlessSteelRat
Private First Class
Private First Class
Posts: 20
Joined: Fri Feb 18, 2005 11:34 pm

Post by StainlessSteelRat »

Thanks for the info. In that case I plan encapsulate all objects in separate .bzw files along with their materials and then "include" the objects in my main map and instantiate them with "group."

Repeated materials (same name, etc) will be ignored, so including both of my tables, each of which has the same "fwood" material will not actually use any extra resources. In fact, including 20 object files, each with a "fwood" material still wouldn't have any disadvantages, as long as they were all intended to be identical.

Is there a standard header for prefab object files? So far I have been marking mine with:

1. Description
2. Size
3. Directional info (which way the object is pointing)
4. Placement location (where on the object is 0,0,0)
5. Any extra requirements (e.g. server rev)

Along the same lines, should there be another extension for object files, since .bzw implies a fully functioning world. Maybe .bzo?

P.S. Should this thread be moved to the prefab forum?

-SSR
Post Reply