Skip to content

Commit

Permalink
added --host option
Browse files Browse the repository at this point in the history
fixed up isLocal logic
created scene_client1.csv to test multiple clients
changed test.py to look for substring "Avatar" as parent
  • Loading branch information
danx0r committed Aug 17, 2009
1 parent fdf2164 commit 2241cbd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion cppoh/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ using Transfer::TransferManager;
OptionValue *cdnConfigFile;
OptionValue *floatExcept;
OptionValue *dbFile;
OptionValue *host;
InitializeGlobalOptions main_options("",
// simulationPlugins=new OptionValue("simulationPlugins","ogregraphics",OptionValueType<String>(),"List of plugins that handle simulation."),
cdnConfigFile=new OptionValue("cdnConfig","cdn = ($import=cdn.txt)",OptionValueType<String>(),"CDN configuration."),
floatExcept=new OptionValue("sigfpe","false",OptionValueType<bool>(),"Enable floating point exceptions"),
dbFile=new OptionValue("db","scene.db",OptionValueType<String>(),"Persistence database"),
host=new OptionValue("host","localhost",OptionValueType<String>(),"space address"),
NULL
);

Expand Down Expand Up @@ -185,7 +187,7 @@ int main ( int argc,const char**argv ) {

SpaceID mainSpace(UUID("12345678-1111-1111-1111-DEFA01759ACE",UUID::HumanReadable()));
SpaceIDMap *spaceMap = new SpaceIDMap;
spaceMap->insert(mainSpace, Network::Address("127.0.0.1","5943"));
spaceMap->insert(mainSpace, Network::Address(host->as<String>(),"5943"));

Persistence::ReadWriteHandler *database=Persistence::ReadWriteHandlerFactory::getSingleton()
.getConstructor("sqlite")(String("--databasefile ")+dbFile->as<String>());
Expand Down
16 changes: 12 additions & 4 deletions liboh/plugins/bullet/BulletSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ using std::tr1::placeholders::_1;
static int core_plugin_refcount = 0;

#define DEBUG_OUTPUT2(x) x
#define DEBUG_OUTPUT(x)
#define DEBUG_OUTPUT(x) x

SIRIKATA_PLUGIN_EXPORT_C void init() {
using namespace Sirikata;
Expand Down Expand Up @@ -102,7 +102,7 @@ void BulletObj::meshChanged (const URI &newMesh) {
}

void BulletObj::setPhysical (const PhysicalParameters &pp) {
DEBUG_OUTPUT(cout << "dbm: setPhysical: " << this << " mode=" << pp.mode << " mesh: " << mMeshname << endl);
DEBUG_OUTPUT(cout << "dbm: setPhysical: " << this << " mode=" << pp.mode << " name: " << pp.name << " mesh: " << mMeshname << endl);
mName = pp.name;
mHull = pp.hull;
colMask = pp.colMask;
Expand Down Expand Up @@ -135,6 +135,14 @@ void BulletObj::setPhysical (const PhysicalParameters &pp) {
mShape = ShapeCharacter;
break;
}
if (mMeshptr) {
if (mDynamic && (!mMeshptr->isLocal()) ) { /// for now, physics ignores dynamic objects on other hosts
DEBUG_OUTPUT(cout << " dbm: debug setPhysical: disabling dynamic&non-local" << endl);
mActive = false;
mMeshptr->setLocationAuthority(0);
return;
}
}
if (!(pp.mode==PhysicalParameters::Disabled)) {
DEBUG_OUTPUT(cout << " dbm: debug setPhysical: adding to bullet" << endl);
positionOrientation po;
Expand Down Expand Up @@ -417,7 +425,7 @@ bool BulletSystem::tick() {
delta = now-lasttime;
if (delta.toSeconds() > 0.05) delta = delta.seconds(0.05); /// avoid big time intervals, they are trubble
lasttime = now;
if ((now-mStartTime) > Duration::seconds(10.0)) {
if ((now-mStartTime) > Duration::seconds(20.0)) {
for (unsigned int i=0; i<objects.size(); i++) {
if (objects[i]->mActive) {
if (objects[i]->mMeshptr->getPosition() != objects[i]->getBulletState().p ||
Expand Down Expand Up @@ -695,7 +703,7 @@ BulletSystem::~BulletSystem() {

void BulletSystem::createProxy(ProxyObjectPtr p) {
ProxyMeshObjectPtr meshptr(tr1::dynamic_pointer_cast<ProxyMeshObject>(p));
if (meshptr && meshptr->isLocal()) {
if (meshptr) {
DEBUG_OUTPUT(cout << "dbm: createProxy ptr:" << meshptr << " mesh: " << meshptr->getMesh() << endl;)
objects.push_back(new BulletObj(this)); /// clean up memory!!!
objects.back()->mMeshptr = meshptr;
Expand Down
2 changes: 1 addition & 1 deletion liboh/scripts/ironpython/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def sawAnotherObject(self,persistence,header,retstatus):
nameStruct.ParseFromString(field.data)
myName = nameStruct.value
if DEBUG_OUTPUT: print "PY: Object",uuid,"has name",myName
if myName=="Avatar_01":
if myName[:6]=="Avatar":
rws=pbPer.ReadWriteSet()
se=rws.writes.add()
se.field_name="Parent"
Expand Down
2 changes: 1 addition & 1 deletion libspace/src/Space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Space::Space(const SpaceID&id):mID(id),mIO(Network::IOServiceFactory::makeIOServ
String spaceServicesString;
spaceServices.SerializeToString(&spaceServicesString);
mObjectConnections=new ObjectConnections(Network::StreamListenerFactory::getSingleton().getDefaultConstructor()(mIO),
Network::Address("localhost",port)
Network::Address("0.0.0.0",port)
//spaceServicesString
);
mObjectConnections->forwardMessagesTo(this);
Expand Down

0 comments on commit 2241cbd

Please sign in to comment.