Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Mar 2000
Offline Last Active Today, 03:44 AM

Posts I've Made

In Topic: Hundreds of timers...

Today, 02:54 AM

I love how this thread ended up in premature optimization land. I've seen the following naïve code in practice:
for all characters:
    for all timers:
        if the timer is ready:
            fire it
            mark it for removal
    remove all timers marked for removal
And it worked fine for thousands of characters. You can optimize it by keeping each timer list sorted by time so that you can stop early as soon as you know there's no point iterating over the rest. And obviously it's optimized further by putting all the timers in one sorted priority queue as suggested above. But you can do that if and when timers start showing up in your profiles.

In Topic: Game Object Update Order

22 June 2016 - 08:23 AM

The bucket approach is easy to parallelise (since anything in the zero-dependencies bucket can be processed at the same time as anything else).

As I understand it, the two approaches are basically equivalent, since the dependency graph is more specifically a dependency tree, and each layer of the tree could be a bucket.

In Topic: Game Object Update Order

22 June 2016 - 03:19 AM

I'd just stop trying to shoehorn everything into Component->Update and allow one component to call methods on another when there is such a dependency. Use events/observers/messages/callbacks to clean it up if necessary. Limit Component->Update to things that can be done without making assumptions about the state of other components.

In Topic: Should video game mechanics be scripted?

21 June 2016 - 08:07 AM

I see it the other way; you're going to have multiple languages on any significantly-sized project, so you need to get used to that and you also need to make sure you're using the right language for each job. I can't imagine ever writing a large scale game and being happy writing all of it in C++ when that is an obviously inferior language for quick prototyping and script-style processes.

I also don't agree that binding/interop between 2 languages is necessarily time-consuming. Most of the time you just have 2 sets of functions you need to bind - functions that let a script change things, and functions that let the script query things. It can take just a few hours to set them up, especially if you think about this in advance, and you're done.

In Topic: How to avoid Singletons/global variables

14 June 2016 - 09:57 AM

In the original example I would just have TextureManager create the Textures via a static factory function, allocating the IDs as appropriate, and it can pass in the ID to the Texture's constructor.