Jump to content
  • entries
    437
  • comments
    1000
  • views
    337174

-

Sign in to follow this  
evolutional

92 views

So I went away and rejigged the API to use the tables to hold the API functions. It works very much like the concept of namespaces, and I believe it's made the API a lot cleaner. I've also adopted the CamelCase naming system for function names, keeping the lowercase identifiers for variables.

Another large addition I've made was to allow you to spawn an entity's handler into its own scripted thread. This is hugely powerful as it allows you to instill it with a 'brain' that's much more powerful than the 'on_think' event. When using an event-based callback system you have to be careful not to block anything. If you engage in a lengthy operation, for example a loop, you could potentially lock the game up. However, GMScript has a powerful feature in the form of cooperative threads (like Lua's coroutines) which allows you get around this. If you spawn a new 'thread' (different to OS threads, they exist only in the VM) you can use the block, signal and yield functions to run long operations. In the terms of the entities, you launch a new thread which is associated to the entity (passed as 'this'). From here, you can effectively treat it as a separate program - you can tell it to block until a certain signal is reached and then continue operation as normal.

I'm going to investigate how well this plays with the existing codebase to ensure that either method could be used or both used together. If so, this would bring extra power to the system :)
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!