Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Everlong Online
#37
Just got back from the hospital, everyone is alright! Aside from Austin, who has a horrid broken arm ^.^

I'll respond properly tomorrow, but a quick answer is yes I have a massive flow chart drawn out in our programming dept. at work of how its all set out, all the coders at work have been helping me plan and put it together so I'm cheating a bit lol. I'll see what I can do to get it to you.

And as for a static factory, a factory is essentially just a class that is fecking quick at deciding what you need. Say I get an object in on one of my streams, the factory will check what kind of object it is very quickly, for example objPlayerMove, and fire off everything I need. Its really a glorified listener (without actually listening to anything or using resources while it waits) that knows exactly what we will need to deal with each packet. So objPlayerMove arrives, my factory will go RIGHT! give me a playerMovementHandler(objPlayerMove) and return me something I can send the client to let it know we are A-OK. While you are at it, I want a new globalPlayerPositionUpdate and notifyPlayersOnscreen object too, as they are going to be used by my playerMovementHandler.

Factories are great when used properly, in this instance I am using one to create new instances of everything I will need when any given packet comes in, its like the backbone of the server. They basically will look at what you have, and give you what you need back in any given situation. If something happens and I am going to need 5 new objects because of this, my factory creates all these and passes required information onwards.

Because my socket is open, I can fire all of my objectInputStream data into my factory and it will deal with it all. No evil server loops, no 2389749823879489237489723 listeners, no overhead and no fuss. Just one beautiful aspect of java perfectly suited to the job ^.^

Anyway, goodnight xP
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)