Expanding and utilizing the engine via C++.

Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
I gave a try to the free DoorClass from http://www.richardsgamestudio.com/ and I couldn't get it to work. I tried to debug it and I notice that the Door::advanceThreads(F32 dt) function is not called and it contain important code to deal with the opened/closed state. I tried different things but got no success to get the advanceThreads call. I have been able to make it work by using the onSequenceEnd callback and hidding the ColMeshes with the script but I'd prefer to use the code..

Anyone have an idea about what's is happening? Something have changed in this area recently?

The parent ShapeBase::advanceThreads(F32 dt) get called, shouldn't the Door function be called before since it's a child? The function is public and from previous experience, it should be called...right? I think the code setup is made so that only the Door::advanceThreads(F32 dt) get called, what you think is missing?

You can grab the DoorClass files from there: http://www.richardsgamestudio.com/downloadDoorPack.html

RichardM
Posts: 32
Joined: Tue Feb 10, 2015 10:23 pm

Sorry for the late response, but I was occupied with other things. I will take a look at it.

SqHd
Posts: 55
Joined: Tue Apr 14, 2015 5:02 am
Great! It would be awesome having this in the current version! Thanks!

paulmm123
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
Add it to door class on file doors.cpp:

{
}

Now will be called, but still not working...

after advanceTime change, isGhost() ways true and mShapeInstance->getTriggerState not get some index...

paulmm123
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
I'm not sure, there is a small bug in Door::packUpdate and Door::unpackUpdate that dont update door property islocked on editor
The commented lines make work...

U32 Door::packUpdate(NetConnection *connection, U32 mask, BitStream *stream){	Con::errorf(ConsoleLogEntry::General, "Door::packUpdate");	U32 retMask = Parent::packUpdate(connection, mask, stream);	stream->writeFlag(mBlockCheckEnable);	//if (stream->writeFlag(mask & OpenMask))<--------if enabled, dont update door property islocked on editor 		stream->writeFlag(mIsOpen);	//if (stream->writeFlag(mask & LockMask))<--------if enabled, dont update door property islocked on editor 		stream->writeFlag(mIsLocked);	if (stream->writeFlag(key))		stream->writeRangedU32(key->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);//...rest of code}

why only stream->writeFlag(mask & LockMask) dont work however only stream->writeFlag(mIsLocked); work ?

void Door::unpackUpdate(NetConnection *connection, BitStream *stream){	Con::errorf(ConsoleLogEntry::General, "Door::unpackUpdate");	Parent::unpackUpdate(connection, stream);	mBlockCheckEnable = stream->readFlag();	Con::errorf(ConsoleLogEntry::General, "mBlockCheckEnable %d",mBlockCheckEnable);	//if (stream->readFlag())   <-------if enabled, dont update door property islocked on editor 	{		mIsOpen = stream->readFlag();		Con::errorf(ConsoleLogEntry::General, "mIsOpen %d",mIsOpen);	}	//if (stream->readFlag()) <--------if enabled, dont update door property islocked on editor 	{		mIsLocked = stream->readFlag();		Con::errorf(ConsoleLogEntry::General, "mIsLocked %d",mIsLocked);	}//...rest of code}

if I am not mistaken, both BitStream::writeFlag() and BitStream::readFlag() foward the bit mask from bitNum , if i call two times subsequently I would not take the wrong bit ?

Thanks for any help!

paulmm123
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
I can conclude that for boolean types, is not necessary pre check of bits as :

stream->writeFlag(mMyBool );

So instead I write and read directly the boolean...
pack:
stream->writeFlag(mMyBool );

unpack:

This is what I've seen in others codes as player.cpp ...

paulmm123
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
is working perfectly, i tested both client and server with sounds too.
I tried to keep orginal code the maximum that.
Thanks RichardM by code.

JackStone
Posts: 67
Joined: Fri Oct 02, 2015 1:03 am
Hi all,

I was going to make my own topic for this, but since this post is so recent, I will add my question to this post, hopefully it will get seen.

I am also having issues with this resource. I have the code compiling with no difficulties, and I have created the example door provided with the resource in my level.

With the door closed, I cannot pass through it, which is expected.
I can then call %obj.opendoor(), which plays the open animation, provided the player isn't blocking the door, this is expected.

However, even with the door open, I still can't pass through, it seems there is an issue with the collision. This is the same issue I had with doors, which is why I downloaded this pack.
I also cannot play the closedoor() animation at all, it returns 0, even when the player is not blocking the door.

I tried this with and without the code changes given in this thread.

I think we really need a good door resource working and included in the engine, it is a standard feature with any game project. If I can't get the working, I will have to resort to my usual method of creating doors, which is to create a door object with no collision, then create another invisible object with collision, and move the invisible object as the door opens using .settransform().

This works, but it's not ideal, I'm sure we can do better!

marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
I have a door working with collisions and all using the basic shape base datablocks and two triggers so you know which way the person is at the door so it always swings away from the player, u don't need an extra resource to do this lik

#### Who is online

Users browsing this forum: No registered users and 3 guests