Investigating Lag on Performance

Featured Article
When: June 16, 2008
Category: Expert Guide

"Lag" is such and imprecise term. What does it mean and how can it be reduced or even eliminated?

  This article was kindly provided to the Chronicles by ScottyDM and is sourced from the Activeworlds Newsgroups.

For more information please see http://www.skunkwks.com/
Quote: Awportals d


I see three areas in which performance can suffer in AW:
  • Download performance
  • Memory performance
  • Frame rate performance

Download performance is easy enough to understand and can be helped by doing stuff like stripping out all comments and excess white space from an RWX file before you zip it, or squeezing your JPGs a bit harder when you encode them, or using midi files instead of MP3s.

Of course some of these things produce distasteful results.

Memory Performance

Memory performance is something most world owners don't seem to understand. Stacee touched on it when she talked of picture and texture intensive areas.

I don't know about today's AW browser, but as of only a couple of years ago (version 3.x) textures were stored in memory in 16-bit BMP format... there is no compression.

=== Resizing Images ===
Plus, when textures were downloaded they were scaled up to the next larger power of 2 that was a square shape.

For example, a 200 x 200 texture would be uncompressed then scaled up to 256 x 256, which takes 128 KB of RAM. The original JPG might be only 4 KB, but what ends up in memory is a lot bigger.

In one instance a friend had a sprite of a chandelier with a texture and 1-bit mask that was something like 350 x 700.

I took that basic texture, cropped off the edges (lots of waste), scaled it down to 256 x 256 (which distorted it), and created a fresh 1-bit mask. When the new texture was applied to that tallish quad, the distortion was stretched away and the chandelier looked good again.

The Experiment

As an experiment we created two sprites, one using the original texture and mask and the other with the new.

I then exited AW, fired up Windows Task Manager, restarted AW and entered friend's world, and noted the memory AW used - then placed the object with the new texture and see that memory blipped upward by 130 K or so.

Then placed the object with the old texture and see that memory blipped upward by more than 2000 K.

AW had uncompressed that 350 x 700 texture then scaled it up to 1024 x 1024, which requires 2 MB of RAM. The interesting thing was, you had to almost get on top of that chandelier to see any difference in quality of the textures.

Image Sizes

Table of Memory Usage
Table of Memory Usage


Why does this matter? Well, if you have 300 textures in one area do you want them to take 2 MB of RAM each or 1/8 MB of RAM each? And remember that pictures placed by the picture command are treated by the rendering engine as textures.

It's pretty easy to go way over 300 textures in some areas. First you fill up your video card's RAM, when that overflows it goes into your PC's RAM that's alloted to aworld.exe, and when that overflows Windows takes over and pages things on and off the hard disk.

The result is that AW seems to freeze for a second or two (sometimes longer). You can't move and can't type.

If you have Windows Task Manager open you'll see "Mem Usage" for aworld.exe is scrolling up and down like mad during these frozen moments. Hold still and once you unfreeze you can chat again and your frame rate looks fine. But if you turn in place AW freezes as all this memory management kicks into gear swapping the textures you now need for textures you don't.

Frame Rate

Frame rate performance is all about the rendering engine.

This is more of a black art as it's highly dependent on the video card and the rev of AW. Remember the old tur_tree set? It used used about 30 clumps or so for each tree (I know of no purpose in having clumps in a static object).

Back in v3.0 days if you put 20 tur_trees in a scene your frame rate would take a noticeable dive. Well, a couple of revs later, and without a hardware upgrade, tur_trees worked much better. AWI programmers fixed something.

Poly count does matter. If you're stuck with the software renderer you'll probably see a linear effect between polys and frame rate--double the polys and you halve the frame rate. Not so with a video card that has hardware T&L support (every 3D card sold today).

The card uses a pipeline and it cannot render the scene faster than the slowest component of the pipeline.

If the texture engine happens to be the choke point, you might double the polys and see no change in frame rate. Also the card and AW both put an upper limit on frame rate. When you're at the limit you can change scene complexity and see no change in frame rate.

Well, if one million-poly model works, what happens when you put it in your world twice? Three times? And what about everything else you put in your world? Also, even when your card's pipe is limited by the T&L engine there are nonlinearities in how it behaves.

If you throw so many polys at it that it cannot hold them all in the card's memory, then frame rate will take a sudden dive.

Also, just because you have the very latest card with a gig of RAM doesn't mean everyone else does too. You did build your objects and world so you could show them off, right?



Polygon Waste

So don't waste polys! But how do you waste polys?

  • When you need a skinny stick you take your modeler's default of a 16-sided "cylinder" when 6, or at most 8, is plenty.
  • When you grab that 1500 poly teapot example model and use it in AW--it's a teapot, it's tiny, nobody will ever see the difference between a 1500 poly teapot or a 200 poly teapot unless they're scaled down to the size of a bug.
  • When you use polys to do what can be more efficiently done with textures, such as modeling the planks on the side of a wooden ship, or rivets on a boiler.

Do you remember Sirroco world? v2.1 AW and it was one of the best looking worlds and would still blow away many worlds today - all done with textures (and low-res textures too).

And whatever you do, don't even think of modeling the insides of a thing when nobody goes inside that thing - and remember those telephone poles with the wires? Each wire was a 16-sided "cylinder", which is a complete waste.

The point isn't that one model will break the budget, but that when you put it in a world with hundreds of other objects and they've all got these excesses, then you have problems. It's sloppy and it's careless and it's stupid.

That said, there are times when you need verts in the middle of a flat model - for example a floor that you want to interact with spotlights. If you need it, you need it, but don't waste polys.

Light Sampling

If at all possible, use lightsampling vertex rather than lightsampling facet.

On my previous 3D card I ran a test with a million-poly object (the only object in the world for that test) that showed about a 30% improvement in frame rate with lightsampling vertex.

Now if you're making a gem and you need the facets to show up, then you have to use lightsampling facet.

Also lightsampling vertex will make curved shapes look smooth and may make it possible to eliminate a lot of polys (to the tune of a factor of 4 or higher).

Plus the way models are stored in Open GL (don't know about Direct X, but I've heard it's similar) lightsampling vertex will make the model take slightly less memory.

Other Issues

Use single sided polys. The rendering engine will sort through and throw out all the polys that face away from the viewer, which will nearly double your potential frame rate.

Don't use wireframe unless you have to have it. In testing I saw about a 5x drop in frame rate. Looks cool tho.

I suspect that 1-bit masks render faster than gray-scale masks, but I have no tests to back it up.

Extensive testing leads me to believe that protos do not impact frame rate, but I suspect that clumps still have some effect (despite AW's improvements). I suspect that during the conversion process a model with protos is "flattened" while clumps must remain separate.

That's about all I can think of at the moment.

Conclusion

In conclusion, if you make your models more efficient they will probably be simpler and therefore render faster, take less memory, and download quicker.

If you do it right, they'll look at least as good as before.

If you make your textures smaller they will take less memory and download quicker (and probably put less drag on the texture engine and therefore render faster).

Again, if you do it right they'll look at least as good as before.

It's worth a shot.

Link to this Article
BBCode: [url=http://www.awportals.com/chronicles/article.php?a=257]Investigating Lag on Performance[/url]
 
Digg:
Comments
 There are no comments.
Related
- Investigating Lag on Performance 26% relevance
- Aggression grows over AWI staff 19% relevance
- AWI Announces Students Winners 2000 19% relevance
- Site News: New Services Available 17% relevance
- 3.0 Beta Announced 16% relevance

Chronicles

 Front Page
 Sitemap (Chronicles)

Categories

 Events
 Worlds
 Technology
 Business
 People
 Community
 Universe
 Websites
 News
 SW City
 New Arklay
 Expert Guide

Buying a World?

Check out our great deals on hosting when you purchase your worlds through Awportals.com.

See our rates card for our comprehensive options for purchasing your world today and earn up to a 30% discount on hosting and other services.

Latest News

Maple Valley in Full Bloom
When: Jun 29, 2008
World: Yellow
Category: Worlds
   
A new and unique building area in Yellow World.

Click here to read in full

AWMyths 1st Anniversary Contest
When: Jun 29, 2008
World: AWMyths
Category: Events
   
A contest to create your own quest in AWMyths world by July 15th.

Click here to read in full

'Ashianae’s Journey' Galaxy Opens for Alpha Testing
When: Jun 27, 2008
Category: Technology
   
Poseidon seeks alpha-testers for game in development.

Click here to read in full

AWTeen to Hold Pioneer CAV Contest
When: Jun 25, 2008
World: AWTeen
Category: Events
   
Details concerning a custom avatar contest this weekend in AWTeen.

Click here to read in full

Forums Integrate Social Networking Infrastructure
When: Jun 21, 2008
Category: Websites
   
AWForums updated to support user groups, mutual friendships, photo albums and retooled user profiles.

Click here to read in full

Babylon Building Competition Finishes Up
When: Jun 20, 2008
World: AWTeen
Category: Events
   
Details concerning the Babylon Building Contest and how to vote for your favorite.

Click here to read in full

On The Way To The Forums...
When: Jun 19, 2008
Category: Community
   
An opinion essay by Absolute Monarch concerning the social division on the AWForums.

Click here to read in full

AWFX Restored to Original State
When: Jun 18, 2008
World: AWFX
Category: Worlds
   
AWFX World restored after extended downtime and presenting a new sharing format.

Click here to read in full

Winter World Open For Viewing
When: Jun 18, 2008
World: Winter
Category: Worlds
   
After several months of development, Winter opened today for public viewing.

Click here to read in full

AW Press Corps Launched
When: Jun 17, 2008
Category: Community
   
Press release from the Activeworlds Press Corps.

Click here to read in full

Registration Benefits

Being a registered member of Awportals has great advantages such as:

* Being able to do unlimited queries on any of our public object search paths.

* Linking your citizenships and editing your citizen profile - including earning reward badges to show your achievements.

* Access members-only features such as the seedbot and command generators.

Newsgroup Archives

The newsgroups may be gone but you can still access them through our new archives section.

Currently we have community and bots sections archived.
Copyright (c) Mark Randall 2005-2008. All rights reserved.
Awportals.com is an recognised distributor of worlds within the Activeworlds universe. Activeworlds is a legal trademark of Activeworlds Incorporated.