Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





Network Classes

Iniciado por , 26 de Octubre de 2005, 08:15:31 PM

« anterior - próximo »

 hi,
i tried to use the network classes, combined with sdl-based tilemap painting. im working windowed for development.

server and client are started by keypress. i start the same application two times on the same pc and before i start both, it runs ok. one is slower (i have the fps displayed), but this should be fine (im not very advanced in windows programming).
i start the server and wait. it doesn't affect fps. then i start the client in the second running version and the framerate is halved in the client. the server runs slow as well.

is that just normal? neither client nor server do send anything of interest just yet.

any ideas? or could you have a look at the library?

thanks a lot,
atomhamster

TheAzazel

 Hello atomhamster,

yes, you have found a known bug... right now Im coding a network game and a few weeks ago I found the same issue as you... before that, I didnt check CPU time when server-client were connected but my game was terribly slow..
No problem at all, Im working on a new version (4.70) and I have already fixed this issue, I think that this version take a while(maybe 2-3 weeks more) so if you dont want to wait, let me know an email and I will send you an incomplete but fully working v4.70 with this issue fixed.

For your tiles...are you using CTiles? or you have your own code?

Cheers

 ah, cool! "already fixed" always sounds so good  :)
i'm not putting too much work into this "project" at the moment, but it would be nice to see the difference and if you don't mind, i will mail you. many thanks!

as for the tile-class: i use someone else's class to display "mappy" tilemaps. again this is something i just chose to "get started" and have results very fast. it works so far, but maybe it's slow itself. the framerate doesn't look too good, after all. if you want to take a look yourself, i gathered some links:

mappy:
http://www.tilemap.co.uk/mappy.php

i think i use this class (don't have the code here right now):
http://membres.lycos.fr/edorul/SDLMappye.htm


cheers,
atomhamster


TheAzazel

 Yes, I know mappy and sdlmappy but I dont know anything about its speed issues... if you want to put here a link to your demo, we could test it for you :)

Anyway, I put here a link to CRM32Pro v4.7x with the following changes:
Citar
    · IStuffDPF:
      - LoadBlock() return compressed size of loaded block(if it was successfully).
      - AddFile() and AddData() return compressed size of added block(if it was successfully).
      - Added new member ->FreeBlock() to free a loaded block.
    · CSprite does not depend on ITimeSystem.
    · IButton:
      - TODO: Support input box text.
      - Icon button type removed. Previous Icon will have its right behaviour. Now, Normal=Icon.
      - Minor fix: hold 'check on' state of check buttons.
      - Minor fix: allow to enable a check button after a previous disable.
      - Minor fix: setup of slider button is easier than before (25pixels on each X side).
    · INetwork:
      - Bug fixed: client thread consumed all CPU cycles.
      - TODO: DataNets reception queue.
      - Print a message when your are losing datanet (your code did not handle it).
      - Ping occurs every second.
    · Added the static library. You can choose between shared or static.
      Use CRM32PRO_STATIC define to enable it. Only works on Win32 platform.
    · Fully cleaned shared interface of external libraries.
    · TODO: Slight improve documentation.
    · TODO: a few things more...

Please, do not forget that it is not finish but it will work for you :). Let me know if it solves your problems.

CRM32Pro v4.7x (Non-complete release, only for testing purposes)

Cheers

 huh - i could have noticed this long ago, but im using the mingw win version, so i can't "just test" the version you posted (many many thanks, btw).
do you mind building the mingw version?

TheAzazel

 Well, I have ready a "release" of oncoming v4.70, it is not finish yet but you could play with new CRM32Pro interface(only global functions and variables have changed) and other bugs fixed...

it works only for win32 with mingw32 compiler...let me know if you have any problem with it.


CRM32Pro v4.7x Mingw32

cheers!

P.S.: I have attached source code example to show you the use of new interface, dont worry, is quite easy!

ups. i didn't read your post fully and missed the "ps". nevermind: i found out how it works now - its really quite simple (and nice).
it already solved my connection/performance problem and that's really nice to see. i think i might code something nice with that today. we will see. in any case: may thanks for your support! it's nice to use a lib where you are so close to the developer  :)

cheers,
atomhamster

hmmm, me again.
something seems strange, but maybe it's me: what exactly does the server do?! does it only receive and forward the data of the clients? cause i try to receive the data in the server-instance, but have no luck: nothing happens, when a single connected client sends something. the result stays 0 and there is only log-output about "dispatch data".

i couldn't find any definitve statement of what the server does.

thanks in adance,
atomhamster

TheAzazel

Cita de: "atomhamster"hmmm, me again.
something seems strange, but maybe it's me: what exactly does the server do?! does it only receive and forward the data of the clients? cause i try to receive the data in the server-instance, but have no luck: nothing happens, when a single connected client sends something. the result stays 0 and there is only log-output about "dispatch data".

i couldn't find any definitve statement of what the server does.

thanks in adance,
atomhamster
Server only does the "dirty work": connect others clients, transmit all its data, detect a new client and when it is out or loss its connections, send a ping signal to check if all clients are alive....

Whatever you need is to connect to clients to the same server, then, the transmision will start :P. Of course, you can create a server (INetwork->CreateServer(...)) and after its creation, you can connect a client on the same machine or code, actually, INetwork supports simultaneous  behaviour...as client and as server.

Dont worry because on CRM32Pro examples, maybe it is not very clear but as you see, one program create a server and nothing more...and the other...can connect clients to it but nothing stop you to create a client on the same program of the server.

Hope this clarifies you, anyway, if you have doubts I could write a real example of what I mean.

Let me know any progress...

Cheers!

ok, i understand. i assumed somehow, the server would also be client. but this way it might actually be easier to develop: the instance which is working as server, also needs to use client code, to join the game.
on the other hand: the user who is hosting the game, needs to open a server to have that manage the events and then a client to actually act as host of the game (being master). do you get what i mean? i have difficulties to describe what i mean in this case  :)

i will take a look into this stuff at the weekend. i will have to do more thinking work, before i code again.
thanks for the reply!
atomhamster

im not fully into windows network game programming, but i do this stuff for mobiles and as much as i understand it, the concept of a game-server can only be implemented very clumsy, the way it is.

here is the idea: having a server is nice, because it helps solving colliding actions. lets say, someone wants to take some item and somone else too, clients-only will have a problem seeing who is first and who succeeds getting the item. all get the "get item" data of both players, but both players don't get their own data - so each does not know if the other one reached the host first.

a solution would be: a host gets all data-messages, as any client does, but if some actions collide, he has to tell which one is first and cancel the second, sending another data-message.


maybe a nicer idea would be to have some server, who will check first, if the action is still possible and then either broadcast the action to all clients, or have the server send a negative reaction to the client who cannot act.
this could be done maybe with some sort of callback or function, which tells the crm32-server how to treat each data-message: reply-to-sender or broadcast.


what do you think?

cheers,
atomhamster

TheAzazel

 Hi again!

yes, you were right!

Right now, the server do not process the "user" information (everything you can send from a client to the rest) and it only sends it to others. Server only process "system" information(as new client, ping, quit client, etc..) but I though to add a kind of callback (as you have noted) into CRM32Pro-Server to allow to process the user information.

Anyway, to implement something as you said, you will need to add your own code to send a "client-order" and after that, wait for confirmation of the server, if it was allowed or not. I imagine you already know all this issues and this model of network gaming where the server is the "one", it has the power and the clients always have to validate its actions against it.
The actual CRM32Pro network code do not allow this on easy way (you should use a special client to do these tasks...but is better to delegate it to the server). But it will be more feasible using a callback function to plugin into real server...

So, I take note of it and push it into library roadmap, thanks you very much for your reminder... that feature was lost in time :P.

It takes me a while as I am working on other fields of the library but it will be finish as soon as possible.

Thanks you for your feedback!
Cheers

you're welcome  :)
just mention it, when you finally get bored of my comments, whishes and extra-needs, ok?!  ;)

thanks for your work and don't overact!
atomhamster

 hi, i just wanted to ask if there's anything new on the networking front?
and before i forget: happy holiday season  :)

cheers,
atomhamster

TheAzazel

Cita de: "atomhamster"hi, i just wanted to ask if there's anything new on the networking front?
and before i forget: happy holiday season  :)

cheers,
atomhamster
Hi boy,

right now, Im working hard on XML parser and a cross-platform config system.
After that I have to add a network queue (to store all data coming from network connection) and also to add a input box support.

I think this will take to me a few days more. Once I finish it, I will add the server callback function.
Stay tuned! :P

Merry Christmas for all people!






Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.