Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


nfactorial

Member Since 10 May 2002
Offline Last Active Nov 14 2014 06:09 PM

Posts I've Made

In Topic: What's a quick way to get a database going for a .net text-based game?

05 June 2014 - 01:41 AM

I wouldn't do it that way at all, it'll be full of security holes if you're accessing the database directly from the client.

 

However, mysql (www.mysql.com) would be the immediate replacement for sqllite. There are other options, but mysql is a reasonable first step up from sqllite.

 

As I said, I wouldn't recommend doing it this way. Instead write a simple server application that performs the necessary database queries in response to messages from the client, so that people don't have direct access to the database.

 

n!


In Topic: Trying to load objects one at a time

20 May 2014 - 12:59 AM

The first thing that jumps at me is that your class cLoadStreamDataMenuSystem is not aligned. And the address it's complaining about is also not aligned. Try ensuring your cLoadStreamDataMenuSystem begins on an aligned memory address.

 

[edit] Reading back, your class holds a pointer to a matrix rather than an instance. So that's probably not the direct issue, but make sure the OrthographicProjection matrix is aligned. It does seem to be complaining about alignment to me (due to the address ending in F8, which is not 16byte aligned. The typical alignment for vectors and matrices)..

 

n!


In Topic: RefCount and Manager

02 May 2014 - 08:33 AM

RefCount should be used for Texture, Mesh, Material, Sound and Animation. The question is for these type of objects.

There is no *should* here, it is an option of-course. But it is entirely dependent on how you structure the management of these resources.

 

I'm neither for or against reference counting, I think it's a fine solution for many things but it isn't the only solution.

 

For example, lets say we have some resource manager objects that manages a list of resources and destroys them all in its destructor.

 

We can have:

 

Scene

    TextureManager

    ModelManager

 

When a model asks for a texture it goes through the scenes texture manager. When the scene is destroyed. All models are destroyed and all textures, no reference counting necessary.

 

Simply following the same method we can extend it further with a hierarchy:

 

Application

   TextureManager

   ModelManager

   Scene

        TextureManager

        ModelManager

 

The lifetime is simply controlled by the containers lifetime, at it is not possible for something higher up the hierarchy to access something lower down. It is a simple alternative, it is not a complete solution. More a quick overview to show why it isn't *necessary* for reference counting. But please don't take this as a "you shouldn't" use reference counting. It's a decision you can make as a developer.

 

n!


In Topic: RefCount and Manager

02 May 2014 - 08:19 AM

[Except that upon decreasing a count you may also need to delete/release the resource, and during that whole process you need to maintain a lock.

 

No, you don't need to maintain a lock at all. If it has 0 references, then there is nothing referencing it, so nothing else could actually gain access to it for the lock to protect against.

 

In an atomic operation, you can indeed correctly enter an “if” when it reaches 0 and begin a segment of code to delete the OpenGL ID or Direct3D handle/pointer, except that suddenly another thread is free to raise that reference count back to 1 and then use that deleted resource.

This logic doesn't work sorry, another thread cannot suddenly raise the reference back to 1. Because there is nothing else referencing it for that to be possible.

 

n!


In Topic: RefCount and Manager

02 May 2014 - 06:03 AM

You don't need a lock for a reference count, you can just use atomic operations (such as InterlockedIncrement etc. on windows, other platforms have similar).

 

I feel a 'manager' implies you don't need a ref-count, as the manager would manage the lifetime.

 

However, whether a ref-count is good or necessary for you is entirely down to what you're doing and the behaviour you desire. There's not really any complete answer without more detail.

 

n!


PARTNERS