Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Dec 2008
Offline Last Active Jun 28 2014 04:27 PM

Posts I've Made

In Topic: Server Exception Handling

24 October 2012 - 07:36 AM

what are you using exceptions for, what are you using threads for?

Sorry, didn't have much time last night.

Our server is using a thread pool, when we receive a network request we assign a thread to handle it. This can include sql queries, movement updates, game objectives, etc.

Ideally our exception handling will be as comprehensive as possible so as to quietly handle any soft hardware or database failures. At the very least it will be used to resolve external problems. It'd be nice to use asserts to fix any programming errors and EH to handle any external problems, however due to the nature of servers we prize stability over all else. An offline is 0% efficient, so we're willing to sacrifice some performance while we fix the broken things.

In Topic: Using C++-Allocated Objects in Lua

04 June 2012 - 02:04 PM

I personally use tolua++. In C++, I will implement a factory class, something like this:

I started out trying ToLua++ and Luabind until I found out they both use the Boost libs. Because of the bulkiness I've tried to stay away from Boost but unfortunately I may have to bite the bullet on that one... I much prefer Boost+Type Safety to no Boost+Bad Design. Your implementation looks exactly like what I wanted to do in the first place, I guess I'll back up/revert my Luna code and start working on ToLua++

In Topic: Simple ListView Inventory Question

04 June 2012 - 08:03 AM

Just to piggyback on mikeman's code a bit, to add multiple items you could do something like this:

	 public struct GameItem
		  public static string Name;
		  public int Energy;
		  public int Damage;
		  public int Value;
	 lvi.Tag = new List<GameItem>();
	 lvi.Text = GameItem.Name;
	 List<GameItem> itemList = (List<GameItem>)lvi.Tag;
	 int quantity = itemList.Count;

	 foreach( GameItem item in itemList )
		  // Do thing with individual item

In Topic: How effective is javascript if we want to develop a facebook social game like...

04 June 2012 - 07:49 AM

You can always make the game in flash and call JavaScript externally to drive your logic. Flash is attractive because of how rapidly you can set up and develop an application (very in-depth GUI), JavaScript is attractive because of the lower level control. I don't think there's a good reason not to have the best of both worlds. It obviously won't be as efficient as everything being done in JS (interop never is), but you're not normally too worried about optimization in Facebook apps. It's more about production efficiency.

In Topic: Main game loop design

03 June 2012 - 05:34 PM

  • what would you have HandleInput() do within an individual Object::Update?

That depends on the object.. Generally you have an ObjectManager that contains a list of Object*.
Then you have other objects that derive from the parent object and do different things.

Something like this (untested code):
class Animal
public: virtual void Talk() = 0;

class Cat : public Animal
public: void Talk() { say( "Meow" ); }

class Dog : public Animal
public: void Talk() { say( "Woof" ); }

class Bird : public Animal
public: void Talk() { say( "Chirp" ); }

class AnimalManager
	 Add( Animal* _animal ) { m_Animals.push_back( _animal ); }
		  for( int i = 0; i < m_Animals.size(); ++i )

	 std::vector<Animal*> m_Animals;

int main()
	 Cat cat;
	 Dog dog;
	 Bird bird;
	 AnimalManager mgr;



	 return 0;

  • what are some examples of what m_Events.Update() might include?

Simple Event System

  • If opjects are being moved one at a time, where would collisions be handled? Would that be within m_ObjectManager.Update after all the individual Object::Update methods have been called?

Different people handle it different ways. Some people move the collision check out of the object and make it part of the object manager. Some people do it through events, and keep track of objects they've collided with that frame so that they don't multiply collide. There are other solutions as well. Do a little Googling and find a solution that works for you.