Devs divided on scripted vehicles

Last week, our readers told Hypergrid Business that what they most wanted to see in OpenSim was vehicle physics.

Of course, vehicle physics. Everyone — or at least 52 percent of everyone — wants vehicle physics.

All I hear about everywhere I go is vehicle physics. Vehicle physics. Vehicle physics. Vehicle physics.

Then I noticed that everyone seems to have vehicles — there are vehicles on OSGrid, on InWorldz, on Island Oasis. I’ve got a little moving train up on a region on Kitely (thanks, Linda Kellie, for the free boardwalk OAR!).

And we clearly have physics. You step off a building and down you go. You set an object to “physical” and it topples over.

So what exactly do they mean by “vehicle physics” and why do we need it? How are “physics vehicles” different from “scripted vehicles”?

I asked a few experts on the subject — and the opinions came back divided.

All vehicles need scripts

When I asked Justin Clark-Casey about it — he’s a core OpenSim developer and president and founder of the Overte Foundation that oversees OpenSim — he said the term “scripted vehicle” was new to him.

Justin Clark-Casey

He suggested that physics-based vehicles might have a hard time at region border crossings.

But one thing that everyone agrees on is that vehicles need scripts — both in Second Life and in OpenSim. They just need slightly different scripts, since some Second Life vehicle commands work in OpenSim, and other don’t.

“All vehicles, including physical vehicles, are scripted,” said Karl Dreyer, CIO and co-founder of the Island Oasis grid. “After all, it’s the scripts that make them work.”

The big difference is that scripts in OpenSim do all the work of moving vehicles around, however, while the scripts in Second Life can off-load some of the work to the physics engine.

That means, in OpenSim, vehicles might not move with the terrain or be affected by gravity, he said. “Whereas physical vehicles do take on physical attributes when in use.”

There is also a third category of vehicles — wearables.

“These are just objects that you can wear that contain a pose animation and prims to resemble a car or plane, and give the appearance of a physical vehicle,” said Dreyer. “We have both kinds of vehicles in Island Oasis.”

One major advantage of the latter is that the wearable vehicles can cross borders between regions. Regular vehicles can only go between regions if they are all part of a single larger mega-region, he said.

Incompatible with Second Life

One thing that everyone agrees on is that you can’t bring a Second Life vehicle script to OpenSim.

David Daeschler

But if OpenSim had a compatible physics engine, you could, said InWorldz co-founder and software architect David Daeschler.

And that would make it easier for everyone.

“Physics-based vehicles are the vehicle standard in Second Life, so having compatible calls makes it easier to port scripts from there,” added Daeschler.

Plus, those scripts are easier to write, he added.

“Vehicles using physics-based movement put less of a burden on the scripter to understand physical movement and the math that is involved,” he said. “The scripter simply says, ‘This is a plane, and here are some properties of the plane,’ and the simulator and physics engine takes care of making the movement realistic.”

So you can still have vehicles in OpenSim — you’ll just have to update your scripts to do some of this extra math.

“The vehicle scripts in Second Life are not compatible in the OpenSim environment as they run two totally different physics engines,” agreed Dreyer. “A Second Life vehicle script will behave erratically in OpenSim. We have run into several situations where people have brought vehicle scripts from Second Life and on more than one occasion, have crashed the sim and required a restart.”

Computing power

The experts were divided as to whether “physical” or “scripted” vehicles were easier on servers.

“I have found that physical vehicles actually require more CPU power and the scripts can be quite complex,” said Dreyer.

But InWorldz’s Daeschler said that the opposite is in fact the case — physics-based vehicles are easier on the server.

“Under many circumstances they allow movement of a vehicle that uses less CPU power than would simulated physics movement being completed by a script,” he said. “Since a physics engine is heavily optimized for these types of calculations it burdens the simulator less.”

A race car on Island Oasis. That's me in the driver's seat trying to figure out where the brakes are.

For us non-techies, less burden on the simulator means less lag for visitors.

Who’s right? Clearly, we need to have some comparative testing by folks with no skin in the game. Unfortunately, I can’t think of anybody who fits that description.

And Bullet physics is no silver bullet, either. According to Daeschler, a lot of work remains to be done on that physics engine. To start with, it still makes avatars go sliding off of sims, he said. Then there’s a lot of work to be done to make it comparable to the currently-used ODE engine — and that’s even before they start on vehicle physics.

Meanwhile, I’d love to see more sample working vehicle scripts being distributed to the OpenSim community for people to play with, and to use to build their own vehicles.

The result would be a richer experience for all of us and instead of worrying so much about vehicle physics, we can go on to worry about things that matter more. Such as where to get really nice shoes.

Nebadon's racer kit.

Fortunately, one guy has already started things off. OSGrid president Michael Emory Cerquoni — also known as Nebadon Izumi in world — has shared some of his racing vehicles, distributed under a convenient Creative Commons license.

There are also some vehicle scripts shared on the OSGrid forums, including:

In fact, the OSGrid forums are a great place to go to for general OpenSim scripting information.

You can also pick up working vehicles at OSGrid’s Wright Plaza region — hypergrid-enabled, so you can take them home — or download vehicle bodies at OpenSim Creations.

Maria Korolov