Script execution

This is a discussion on Script execution within the Game Programming forums, part of the General Programming Boards category; So my attempts at writing the scripting system for this engine are going well. Very well in fact. The bytecode ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    Script execution

    So my attempts at writing the scripting system for this engine are going well. Very well in fact. The bytecode compiler hasn't been as hard to implement as I'd thought, but that's off-topic.

    A little vital info:

    I'm using a co-operative multi-tasker. Anything that needs some processing time each frame must implement the Process interface, the only pure virtual of which is onUpdate( const int deltaMs ).

    Each frame, the task manager's update function calls the onUpdate() function of each Process it's managing.

    Now, my P_ScriptExecutor process. At the moment I've got it executing a single script instruction per update. Since I can't actually test it right now, I'm not sure if this would be a problem when scripts start getting pretty big.

    Another way I could do it would be to execute as many instructions as possible every 250 ms or something, in a similar way sprite animation / GUI animation's work.

    Any thoughts / comments? Would larger scripts lag behind the gameplay?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    Experimentation is the simplest (and best) solution, implement time slicing as well and see what kind of performance you get from each in different situations. I assume you aren't trying to implement a general purpose vm so there should be plenty of context optimization available.

  3. #3
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    I would think that letting a script run for x amount of time would be better than x number of lines. Maybe even some scripts flag themselves as "let me continue running until I'm done" just in case?

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Ah that flag idea is good. Thanks for everything else too guys.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 02-12-2009, 12:49 PM
  2. Replies: 0
    Last Post: 10-06-2007, 02:25 PM
  3. Script in games
    By Shakti in forum Game Programming
    Replies: 7
    Last Post: 09-27-2006, 01:27 AM
  4. In a game Engine...
    By Shamino in forum Game Programming
    Replies: 28
    Last Post: 02-19-2006, 11:30 AM
  5. Game structure, any thoughts?
    By Vorok in forum Game Programming
    Replies: 2
    Last Post: 06-07-2003, 02:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21