Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

gfxgangsta

Member Since 06 Dec 2011
Offline Last Active Private
-----

Topics I've Started

Optimizing database/server interaction with players across multiple servers

26 February 2013 - 01:29 PM

I'm working on a social game in which clients, for scalability's sake, are assigned a game server to play on. That way, there can be a limit to the number of players per game server. Unfortunately, players on one server should be able to interact with players on a different server (i.e. visiting friends, etc). My current thought is to use a centralized server which holds the shared data. Ideally, only the game servers would access the central server. But because some of the shared data is unique per player (i.e. gathering a list of actions that a player and their friends have done as a group), this would mean that possibly all players could hit the central server at the same time. Even though that might be very unlikely, this approach sounds a bit inefficient, and may get in the way of scaling the game. Is there a best practice as far as sharing data across multiple game servers? Another idea is to still use a centralized server but replicate/mirror the data on the game servers, perhaps on a schedule, where it doesn't matter if the game server's data is not 100% up-to-date. This approach wouldn't need to hit the central server, but it means making sure to sync the values correctly with the central server (it might be two-way interaction in case the player can have an effect on the values). Thoughts?

 

Thanks!


Move object to desired location

24 July 2012 - 10:10 AM

Hi,

I have an object that I'd like to move around to different, pre-determined locations in 3d space. I have a velocity vector which I multiply by delta time, to get the distance I should travel during one frame. The way I'm checking if I'm already at the desired location is to compute the distance to that point. If the distance is less than some specific value, then I stop moving. But that value is tied to delta time, and, if the game slowed down enough, the distance traveled could overshoot the checked distance value, and the object would just keep going. Is it better to just see if the object has moved past the desired point, in the direction of the velocity vector, and then stop? What other methods are used in games?

Thanks in advance

Observer pattern question

25 June 2012 - 03:19 PM

Hey everyone, I have to implement something where I feel the Observer pattern fits. There are multiple objects that observe/listen to certain events. At the moment, they listen to one type of event, but in the future, one class may have to listen to more than one type of event. Which sounds better out of these two:

1. Use a common IObservable interface, but make override NotifyObservers() in each subclass... that way I can call different functions on the observers based on the type of event... like "onEventA()" and "onEventB()"...

2. Create a single Observable class with a dictionary that maps each event type to a list of observers. Observers register with that single Observable object. Then, some class may call FireEvent(EventType et) on the single Observable class, which would grab the appropriate list of observers from the dictionary, and then call onEvent(EventType et) on every observer on that list. That means doing a switch(et) inside onEvent().

Thanks!

PARTNERS