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!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


colinhect

Member Since 09 Jul 2005
Offline Last Active Jul 23 2012 12:39 PM

Topics I've Started

Texturing large terrain

17 July 2012 - 09:42 AM

I am rendering large terrain (65km x 65km) at 8m height resolution and 1m triangle resolution by sampling height with bi-cubic interpolation. I've been experimenting but having trouble finding a decent method of texturing. The texturing needs to be detailed at ground level and look good from far away as well (no view distance culling, entire terrain is visible).

Methods that I've tried but look bad:

Splat mapping - Textures that are detailed at ground level (about 1m x 1m) tile very obviously.
Macro texture + detail textures - Can't really afford to have a decent resolution macro texture for the entire terrain. Looks good from far away but gets pretty bad as you get close.

Methods that look nice but not technically possible for me:

Per-tile procedural on GPU (see Outerra) - Can't afford the render-to-texture overhead for when terrain tiles are split.

Currently I'm leaning toward trying a larger scale splat map (say 1024m x 1024m textures) to avoid tiling and add detail textures on that. However, I don't really like the look of a stretched macro texture with a detail texture on it (looks very dated).

Are there any techniques that I haven't considered? I don't need fine control over textures so procedural approaches are fine. But it will need to include dirt/grass/sand/rock based on slope/altitude. All ideas are welcome.

Spacial Partitioning and Game Logic

09 September 2011 - 05:36 PM

When writing my game I figured it would be a good idea to separate the scene's spacial partitioning from the logic entirely. This has worked fine for a while. A game object has a scene node which is stored in the scene which internally subdivides nodes in an octree or quadtree. This way the game object does not depend on the way the scene subdivides the nodes for visibility and the scene does not care what a game object is.

However, I have realized that the logic really needs to query the scene to retrieve logic-dependent values. For example, finding the nearest enemy or tracing a bullet ray.

Can anyone share how they have tackled this problem? Here are my initial ideas but they both seem flawed:

Separate spacial structure for game objects. The scene nodes that the game objects control are still managed by the scene for culling, but the game objects themselves are subdivided in another structure.

Scene nodes contain a pointer to the game object they belong to. Self explanatory. I really don't like this idea though.

Thanks

OpenTK "vshost32.exe has stopped working"

04 August 2011 - 02:44 PM

I also posted this on the OpenTK forums but I wanted to also post here to increase visiblity (OpenTK Forums Post).

When attempting to run any of the demos from a new project I get the error "vshost32.exe has stopped working". It is hard to find exactly when it occurs since it is not an exception. It appears to be happening when the demo is calling the GameWindow constructor (base(...)).Running the demos from the Examples.exe work fine though.

I am using Visual Studio 2010 on Windows 7.

Any help would be appreciated.


Issues interpolating quaternions from Bullet

14 June 2011 - 03:23 PM

My game has a fixed time-step and interpolates translations and rotations between updates. My quaternion slerp function works fine for my own rotations, but when converting Bullet's quaternions to my own quaternion structure I get strange artifacts occasionally when slerping. The body will appear to slerp the wrong direction for a split second. Here is a video demonstrating it (the jerking in the beginning is due to the video capture process).




Here is my code for getting the rigid body's rotation and for slerping:


const Quaternion<> RigidBody::getOrientation() const {
    return Physics::fromQuaternion(rigidBody->getWorldTransform().getRotation());
}

const Quaternion<> Physics::fromQuaternion(const btQuaternion& q) {
    return Quaternion<double>(-q.w(), Vector<3, double>(q.x(), q.y(), q.z()));
}

template <class T>
const Quaternion<T> Quaternion<T>::slerp(const Quaternion<T>& a, const Quaternion<T>& b, T delta) {
    T w1, w2;

    T cosTheta = dot(a, b);
    T theta    = (T)acos(cosTheta);
    T sinTheta = (T)sin(theta);

    if (sinTheta > 0.001) {
        w1 = (T)(sin((1.0 - delta) * theta) / sinTheta);
        w2 = (T)(sin(delta * theta) / sinTheta);
    } else {
        w1 = 1.0 - delta;
        w2 = delta;
    }

    Quaternion<T> result(a * w1 + b * w2);
    result.normalize();

    return result;
}

template const Quaternion<double> Quaternion<double>::slerp(const Quaternion<double>&, const Quaternion<double>&, double);



My slerp code works fine for my own rotations. This only seems to happen on quaternions converted from Bullet.

Any ideas?

Luabind and non garbage collected collections

31 May 2011 - 04:02 PM

The majority of my game's logic code is written in Lua including the entire entity system. I've been storing my entities in Lua tables and it has been working fine. However, I need to hold very large lists of entities (hundreds of thousands). Whenever I have an extremely large table of Lua objects the garbage collector starts to interfere with performance.

There should be a way around this because the entities themselves should only be deleted when explicitly removed from the list or the list itself is destroyed. I tried to achieve this like the following:


class LuaList {

public:

    ~LuaList () {
        deleteList(&elements);
    }

    void insert(luabind::object* object) { elements.push_back(object); }

    std::list<luabind::object*>& getElements() { return elements; }

private:

    std::list<luabind::object*> elements;

};


class_<LuaList >("LuaList ")
            .def(constructor<>())
            .def("insert", &LuaList ::insert, adopt(_2))
            .property("elements", &LuaList ::getElements, return_stl_iterator),

... but when I execute the insert function within Lua it says that the arguments do not match. Has anyone else done something like this? Any help is appreciated.

Thanks



PARTNERS