Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Little Coding Fox

Member Since 08 Apr 2003
Offline Last Active Apr 13 2013 05:35 AM
-----

Topics I've Started

Creating a reference object without modifying base class - Possible?

13 April 2013 - 03:55 AM

I'm working on some AngelScript bindings for a framework I'm working on, and I have created a generic reference countable class that works fine with AngelScript, but I have some problems when I want to interface the properties of the contained class with the scripts.

 

To give you an idea, let's say I have a class Texture. I have something like this in my Reference class:

 

class ScriptReferenceTexture
{
public:
	SuperSmartPointer<Texture> Object;

	uint32 ReferenceCount;

	ScriptReferenceTexture() : ReferenceCount(1) {};

	void AddReference()
	{
		ReferenceCount++;
	};

	void RemoveReference()
	{
		ReferenceCount--;

		if(ReferenceCount == 0)
		{
			delete this;
		};
	};

	static ScriptReferenceTexture *Factory()
	{
		return new ScriptReferenceTexture();
	};
};

So this works fine for containing the Texture object, but let's say I want to connect a regular Texture to a ScriptTexture stored in another script class, or want to add methods that access the Texture's own methods. I can't do that since the reference counting bit isn't in the Texture class, and I'm using a smart pointer to store the texture class so modifying the Texture class is not going to work.

 

I really don't want to change my resource handling scheme since SuperSmartPointers are too important for the native side (since my framework should be used both with and without scripting), and they also allow for the implicit destruction of their contained object (which goes against the AngelScript reference style).

 

So does anyone have any idea of how I could solve this?


Need some help developing an universe

23 March 2013 - 02:44 AM

I've been developing a fantasy universe for a while now, about two years. I'm at that point where I need to add all those tiny details that are necessary for making the universe credible - that is, details like how the economy works, what sort of police force it has, etc - but, I'm having trouble coming up with what those details are (not so much about coming up with their actual content). I've been told by several people to check history books and such, but I don't know what to search for so I'm still kind of lost there.

 

You can find all the information I have developed about this universe at https://docs.google.com/document/d/1XK9nRByKCZfcX59lm6d0TCQfJmsK_eP1EIech1u5ayE/edit?authkey=CN34wYMM&authkey=CN34wYMM

 

Hopefully this will explain my problem properly: I have no trouble deciding these details, but I have trouble thinking about which details to include. For instance, a friend of mine suggested the police force detail, but before that I had no idea of that detail to include.

 

I was hoping to get some help to figure out which details I should include to make this feel more like a living world rather than something artificial, any help is appreciated!


Alternative to Node/Grid-based pathfinding for 2D game

04 March 2013 - 05:56 AM

Hello,

I've been working on a 2D tile-based game and due to the way I do the pathfinding (Dijkstra-based) I've had to force my moving entities to be grid-positioned due to all sorts of problems that arised from trying to move them otherwise (such as getting stuck on the player or on the map).

 

All the entities are positioned in tile coordinates but they can move between tiles, they just won't move properly. I realize that the reason that I'm having so much trouble getting that working is due to the pathfinding algorithm. I've also recently gotten per-pixel collision to work, so now I'd like to know if there are any algorithms for 2D pathfinding that are freeform, so I can release my entities from being stuck on a grid.


PARTNERS