Jump to content

  • Log In with Google      Sign In   
  • Create Account


greeniekin

Member Since 28 Aug 2011
Offline Last Active Jul 22 2014 07:24 PM
-----

Topics I've Started

multi-player games and physics engines

31 May 2014 - 02:21 PM

So I have looked around for a long time about networking.

 

Something that is said that when a prediction error happens let the server set the state and replay all the commands to get back to the current prediction. Though were this gets confusing as that bullet for instance has to have the entire step forward at the same time. Which means you would have to rewind the entire world and go through everything again. Which seems very annoying, but wouldn't it also be expensive performance wise?

Any information of ideas on this would be greatly appreciated.

 

 

extra notes

when a player becomes dead there is no need to  synchronize the body yet once again rewinding to playback a player physics will muck up the ragdoll.

Only way I can see around this is having to physics worlds running and only rewinding one that has the local player and player owned stuff(guided missile or something). though both worlds would need to be filled with map objects and other player objects.


quake 3's state based delta compression

09 March 2014 - 12:26 AM

So I have done plenty of reading about networking and made something that is similar to what I have read about with simple moving squares and thought I understood everything clearly.

 

Though as I decided to continue developing and wanted to do other things like say shooting I realised there are problems.

 

Now here is the hard part to explain

If I'm sending 20 packets per second and my frames per second is 60 and I am only sending the current state then I am missing 2 states(4 if 100 which some people insist in games like cs)

Which is fine for movement but not for shooting. Adding extra events start to ruin the simple state based system. 

 

The only way I can see this working if you delta compress the last 3 frames which will make the messages 3 times the size.

 

Is this what the quake 3 model does, because I have not seen any article mention this. Or maybe it I just can not remember any article mentioning this.


Serializer add on with game example

21 July 2013 - 12:07 AM

I wanted to be able to load angelscript files when they have been changed while the game is running. My code is heavily based of the angelscript game example.

I stumbled across the serializer add on and thought that might be what I am looking for. Even though it says global values it does have the AddExtraObjectToStore option which I could add the controllers used in the example. There are a few things that have me a little confused.

The compile function used in the documentation is pretty vague.
So I assumed I would just delete the module and use the builder add on after .
Though what I have found is just using the DiscardModule function of the engine without rebuilding or doing anything else. Everything keeps running. I thought it would crash or give strange results. So I checked the return value from DiscardModule which was 0 so it found the module and I even made it call it twice to check if it did anything and the first one return 0 as expected the second time it returned -14  which was expected as it was deleted. Though Everything keeps running fine.

Anyway I added the rest of the code for the serializer and the builder and I receive no errors but it has no effect on the behavior. the builder completes with no errors and I know all build and serialize functions are getting called. It is really confusing .

 

also there is a slight error in the documentation I think. I think modStore is meant to be backup.

// Tell the serializer how the user types should be serialized
  // by adding the implementations of the CUserType interface
  CSerializer backup;
  backup.AddUserType(new CStringType(), "string");
  backup.AddUserType(new CArrayType(), "array");
  // Backup the values of the global variables
  modStore.Store(mod);

I searched online and I seemed to find a few people who said they had the hot loading functionality using angelscript. Unfortunately no where said how.


Detect if function argument is passed by reference

18 July 2013 - 07:05 PM

I know this seems a bit silly but I made a helper class to load scripts and stuff.

I have been able to use the GetParamTypeId from asIScriptFunction to determine the type of parameters and what SetArg function to use. Though I do not know how you can detect if your using a reference like "int &out val" so that I can use SetArgAddress instead.

 

Any help is appreciated.


Difficulty exposing operator << of object to angelscript

15 July 2013 - 09:44 PM

SOLVED. No need to read

 

I have Packet class which I use and I would like to  expose it to angelscript.
It overloads >> and << for a couple different types like bools, int's, floats.

This class is defined like this.

class Packet
{
public :
    Packet& operator <<(Int32               data);
}

I have tried overloading just for the method above as a test. With the following code.

r = engine->RegisterObjectMethod("Packet", "Packet opShl(int data)", asMETHODPR(Packet, operator<<,(Int32),Packet&), asCALL_THISCALL); assert( r >= 0 );

which with the code below causes a crash and printing out the integer value passed into the method is different to the 55 sent in


Packet packet;
int intVal = 55;
packet << intVal ;

 

Now that I am writing this I think it is because i tried to set this up as a angelscript value type. Because packet is actually from the sfml library and I do not really want to be adding reference counting to that class and I was happy with a copy being made when used in scripts. Here is the setup of the type. Though I still can not understand why the function call can output text and print out the passed in integer except incorrectly. I thought that would be the only thing that works and the invalid pointer for the packet or what ever would be the only issue(and probably is the reason it does crash). 
 

	// Register the packet type
	r = engine->RegisterObjectType("Packet", sizeof(Packet), asOBJ_VALUE | asOBJ_APP_CLASS_CDK); assert( r >= 0 );

	// Register the object constructor and destructor
	r = engine->RegisterObjectBehaviour("Packet", asBEHAVE_CONSTRUCT,  "void f()",                    asFUNCTION(ConstructPacket), asCALL_CDECL_OBJLAST); assert( r >= 0 );
	r = engine->RegisterObjectBehaviour("Packet", asBEHAVE_CONSTRUCT,  "void f(const Packet &in)",    asFUNCTION(CopyConstructPacket), asCALL_CDECL_OBJLAST); assert( r >= 0 );
	r = engine->RegisterObjectBehaviour("Packet", asBEHAVE_DESTRUCT,   "void f()",  

Anyway I am really tired and have a huge headache. I am currently all out of ideas and need to sleep.

Any ideas or help is much appreciated.

 

Edit:
So I have had a big sleep and tried a few things and I managed to figure it out. I feel really stupid about this

i had "Packet opShl(int data)" instead of "Packet &opShl(int data)"

Now the thing is I had tried that and still got errors before. Though I clearly must had had added another error somewhere else at the same time. ><

Anyway it is all fixed now. Sorry for the waste of your time
 


PARTNERS