This project is read-only.

Object Transactions

The transaction context, allows you to add multiple objects to your world and then receive an event callback when the transaction was completed. The transactions are optimized to be able to add/remove or change multiple objects in the shortest time possible. You can see an example video of the speed of a transaction on :
Updating 225 objects (full update/all attributes) in one second flat
Bot running remote on simple Wifi Connection to the remote universe. Browser running from the same connection.

A Simple transaction code snippet.

The following code snippet builds up a transaction with a reasonable amount of objects. Then on the transaction_OnTransactionCompleted event handler, the objects are deleted.

        public void TransactionExample() {
            var transaction = new SimpleTransaction<Model>(sender);
            transaction.OnTransactionCompleted += transaction_OnTransactionCompleted;
            for (int h = 0; h < 1; h++)
                for (int j = 0; j < 15; j++)
                    for (int i = 0; i < 15; i++)
                        transaction.Add(new Model()
                                                ModelName = "bzmb0.rwx",
                                                Action = "@key=unittest",
                                                Description = "Bot created object test",
                                                Position = new Vector3((i * 120) + (-h * 1600), j * 120, 1000)

        void transaction_OnTransactionCompleted(BotEngine sender, EventTransactionCompletedArgs e)
            ConsoleHelpers.WriteLine(string.Format("Transaction {0} committed {1} objects, and completed in {2} ms.",

            foreach (var model in sender.SceneNodes.Models.FindAll(p => p.Action.Contains("@key=unittest")))

Last edited Jan 15, 2010 at 10:03 PM by cube3, version 4


No comments yet.