Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

153 Neutral

About greeniekin

  • Rank
  1. greeniekin

    multi-player games and physics engines

    hplus0603, that makes a lot of sense. It was just in my mind all those methods seemed excessive for moving one object. Though like you said physics is not the most expensive part of a game engine and corrections should be infrequent.   I had a suspicion that was what cascading correction was. I suppose it might be worth rewinding other objects as well if you are stepping through for everything to miss those edge cases like a closed door.   That makes sense why no forums really talk about it. Also it was pretty obvious and I am pretty dumb ;)
  2. greeniekin

    multi-player games and physics engines

    hplus0603, Well I have bullet physics engine in my mind I'm really talking of any open source physics engines like ode or what ever. Which is what seems to be confusing me since most articles about replaying movement on prediction error can just rewind that one object and step it through time. A lot of the time these people have articles about basic theory about creating a physics engine. Like gafferongames.com I thought I would avoid making my own physics engine.   I'm not really sure what you mean by cascading correction. In my mind I had a picture of everything else except for the replayed object being frozen and these frozen object interacts like they are solid and static with the object being replayed. Yet after completing the error correction all frozen objects still retain and velocity or spin that they had before the prediction error.   Though cascading corrections sounds like something much more advanced than what I was thinking.     Maybe the answer is so obvious that no one ever talks about it and I'm just so dumb.
  3. greeniekin

    multi-player games and physics engines

    My message was not that clear as it was really late at the time.   The only way I can see how to rewind one entity and replay was to have a separate world for each entity and copy a static copy of each worlds dynamic one to each other. or when a prediction conflict occurs create a new world copy everything from the other world as static then recalculate the entities physics stuff. There is one thing I just noticed for bullet physics engine is http://bulletphysics.org/mediawiki-1.5.8/index.php/Activation_States it has one that is DISABLE_SIMULATION. I'm hoping I can just set all other objects as DISABLE_SIMULATION and then apply an old state to an the object and just step forward 200ms of calculations for that one player and then reactivate all the objects and they keep their velocities. I assume there is a feature like this for ODE? Is this what people do? Any help or ideas is much appreciated
  4. 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.
  5. greeniekin

    quake 3's state based delta compression

    I never said they were not the same. I said  that I have already implemented my first interpretation of quake 3 method which at the very least requires serialization and packets and game state as well as the compression. So I could not think they were the same. Also I explicitly said get the delta compression part out of your mind .   It is no doubt my fault as I am horrible at communicating. Why can't everyone just live in my brain.     Why would bullets be guaranteed from the server to the client? if someone shot a bullet 1 second ago I'm not going to display it because it is out of date. If you think you need it to calculate someone's health that will be done by the players state on server.   hplus0603, I am not sure if your talking about inputs from the client to the server or not. I understand from the client to the server of queuing commands.   I am more talking about getting entities sate that is on the server to clients so they can show the entities state. It is like the player input thing but in reverse. send 3 states taken at different times in a packet. not guaranteed though because we do not need old information. It would have been nice to get a confirmation if that is what quake 3 uses or that this is the general idea of how this model should be implemented. I suppose no one really knows.    Edit: Missed papalazaru's message it was posted as I was writing.   Your idea about using state to communicate how many shots have been fired is interesting. I will give it some serious thought. Though things like flag caps I can represent with my broadcast event thing I have.      I had a look around quake 3 source. Though it would take for ever to understand where everything is to figure out what to look out for.  
  6. greeniekin

    quake 3's state based delta compression

    I seem to have confused everyone by saying delta compression. I understand the compression part. What I do not know if multiple states for an entity are sent in the same packet.   when I said 3 frames are delta compressed I meant 3 frames are compressed and sent in same packet. That article talks about the compression but does not actually say what was sent. Which is what I always hear.   Edit: Just to further clarify   if i'm sending 20 packets per secound and I'm doing 60 game calculations(frames) per second then there are missing states.  which mean (60-20=)40 frames per second are not sent and things like a fire state may only last 1 frame then there is only a 1 in 3 chance that the shots will fire on the client. So the only way I can think that it would be to pack extra previous states(the 2 missing) into the same packet. I was wondering if this is what the quake 3 model does.
  7. 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.
  8. greeniekin

    Serializer add on with game example

    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.
  9. greeniekin

    Detect if function argument is passed by reference

    Thank you so much for the quick reply.  I did try the paramflags before but stupidly I was trying to do a bit mask with asOBJ_REF. It is working perfectly now.
  10. 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.
  11. 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  
  12. Ravyne That method is the second method I mentioned. I suppose writing it that way is easiest in that it always works the same as server client, or the one. Though will double up on memory and resources that could be shared. Like models and there animations   ApochPiQ I do like that the only problem is animation needs to be available both for client and server. The server may need it for collision detection stuff.   I suppose the completely separate client & server model might be the simplest method and where prediction is needed just inherit for the server. Even if there is some duplication.
  13. I have read a lot about handling network communication. What I have not read is how to structure objects. I am thinking for c++ specifically. for instance a server and client share the same entity behavior. Some may be disabled if it is considered authoritative or not. Which the client could be authoritative in single player or when hosting a game, but not when connecting to another server. Also some entities may be predictive like player where it will still run the authorative code. The behavior part is easy enough to account for.   An entity will of course contain a graphical part and a behavior part. A console server will only need the behavior part.     I can only think of 2 ways. Have preprocessor  statements in every entity to remove all graphics code. Which is a bit annoying as I will need to access model animations and it's transformations.    The other is have completely separate server and client code and if they run in the same app have the server and client code run.  Problem being is there will be some duplication of information and also any predictive code will need to be written in the client object as well as the server. I suppose it could inherit the code from the server side.   So I was just wondering what methods you have seen used and which s the best and why.     I am pretty tired so sorry if this seems a bit silly. I was just wondering if there is a better way.  
  14. greeniekin

    Custom text handling for SFML String

    Never mind I worked out what was wrong. I was not using namespace sf which is where the global function operators was declared. I could get around it by using that name space or using the asFUNCTIONPR asFUNCTIONPR(sf::operator +, (const sf::String &, const sf::String &), sf::String) all that frustration for something so stupid. [s]With that change i get the following as an error error: 'operator==' is not a member of 'sf::String'| I also think the function version matches it better. It uses this outside of the class declaration. like so SFML_SYSTEM_API bool operator ==(const String& left, const String& right); There must be something really stupid I am doing Also here is a link to the headers of sfml string. https://github.com/L...stem/String.hpp[/s]
  15. greeniekin

    Custom text handling for SFML String

    I have been using sfml libraries and it's string class. I really want to keep using the sfml string class though it will not work with the angelscript std string addon. Even though if the string class is given a stdString in c++ it will convert it. I have tried modifying the angelscript std string add on for sfml string(with some changes to sfml string) Like the following error error: invalid static_cast from type '<unresolved overloaded function type>' to type 'bool (*)(const sf::String&, const sf::String&)'| for the following r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(operator ==, (const sf::String &, const sf::String &), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); I know I can not expect you to write it or fix mine so I just have a few questions I have not really read anything about alternative to the std string addon anywhere. I was wondering if there might be some other examples I can look at. Also internally sfml String uses a std::basic_string<Uint32> to store the string. the functions that i would expose to script would be like this int XUIElement::getAttributeInt(sf::String searchName) Is there a way this could be used to simplify the process. I am not really sure if std string addon needs to be modified for using this type of string as opposed to just a uint8 char.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!