Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAngus Hollands

Posted 20 January 2013 - 12:28 PM

Thank you very much. I've thought a lot, and I'm enjoying the realisations!
Best of luck in the new year, I hope I don't come running back too soon ;)!
---------------------------------------------------------------------------
Nope, looks like I'm back as ever!

So, one of my fundamental reasons for rewriting the system was the fact that It felt like I was writing everything twice, and using shared base classes seemed a little messy.
I had started thinking through a system where there was no discrimination between server and client, and I think that would have required some environment setup to establish specific behaviour like binding to the correct port, and establishing server or client behaviour; at which point there is a discrimination. So, I then thought about it in terms of using the same file with switches; defining a server method and a client method, using the same name but invoking only the one that the game environment is set to. Something like this:
http://www.pasteall.org/38986/python

However, I have yet more code that is copied. (DRY principle is once more violated).
So, after picking an idea from the pdf on meerkat, I thought about this:
http://www.pasteall.org/38988/python

It's the same idea; using environment flags (which I haven't exposed in the examples) to suppress method calls if they are incorrect.

Is this an acceptable solution? Can you see any inconveniences that I've not?

Following from this, In order to ensure that only relevant data is shared between client and server, the entity class must declare attributes as networked in order for them to be sent and received. This is done with a hidden interface; As in Source, if an attribute is changed - attributes will be descriptors[1] - it will be flagged as changed. When the networked values are asked for by the network layer, the entity manager (handler) layer will return the concatenation of two things. Firstly, a bitmask of which attributes it contains, and secondly the value of those attributes (in bytes).

[1]If you don't know what a descriptor is in Python, It is a class instanced as an attribute of the holder class. It has get and set methods that are called when the set and get operators are called. When accessed on the class the descriptor instance is returned, but when accessed on the class instance the behaviour is invoked - hence one can intercept the set method to register a changed flag

#2Angus Hollands

Posted 20 January 2013 - 12:28 PM

Thank you very much. I've thought a lot, and I'm enjoying the realisations!
Best of luck in the new year, I hope I don't come running back too soon ;)!
---------------------------------------------------------------------------
Nope, looks like I'm back as ever!

So, one of my fundamental reasons for rewriting the system was the fact that It felt like I was writing everything twice, and using shared base classes seemed a little messy.
I had started thinking through a system where there was no discrimination between server and client, and I think that would have required some environment setup to establish specific behaviour like binding to the correct port, and establishing server or client behaviour; at which point there is a discrimination. So, I then thought about it in terms of using the same file with switches; defining a server method and a client method, using the same name but invoking only the one that the game environment is set to. Something like this:
http://www.pasteall.org/38986/python

However, I have yet more code that is copied. (DRY principle is once more violated).
So, after picking an idea from the pdf on meerkat, I thought about this:
http://www.pasteall.org/38988/python

It's the same idea; using environment flags (which I haven't exposed in the examples) to suppress method calls if they are incorrect.

Is this an acceptable solution? Can you see any inconveniences that I've not?

Following from this, In order to ensure that only relevant data is shared between client and server, the entity class must declare attributes as networked in order for them to be sent and received. This is done with a hidden interface; As in Source, if an attribute is changed - attributes will be descriptors[1] - it will be flagged as changed. When the networked values are asked for by the network layer, the entity manager (handler) layer will return the concatenation of two things. Firstly, a bitmask of which attributes it contains, and secondly the value of those attributes (in bytes).

[1]If you don't know what a descriptor is in Python, It is a class instanced as an attribute of the holder class. It has get and set methods that are called when the set and get operators are called. When accessed on the class the descriptor instance is returned, but when accessed on the class instance the behaviour is invoked - hence one can intercept the set method to register a changed flag

#1Angus Hollands

Posted 20 January 2013 - 09:42 AM

Thank you very much. I've thought a lot, and I'm enjoying the realisations!

Best of luck in the new year, I hope I don't come running back too soon ;)!

Angus.


PARTNERS