Jump to content
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423431

Untitled

Sign in to follow this  
Evil Steve

76 views

DruinkASM is now "Complete". That is, I have support for all the opcodes and constructs I need. It should be easy enough to add support for other stuff later on, as required.

So I've started making the VM and test app now. The VM compiles to a .lib file, and you #include "DruinkScript.h", which will include the other files.
I'm not entirely sure how to lay the code out though. Usually I have a Code folder in the solution directory, and then one folder for each .cpp/.h pair. But I want the client apps to be able to just include one file, which will include others, so I guess I'll stuff all the headers into one folder, and seperate them out using the filters in the IDE. That way I should end up with the classic "include" "src" "lib" "bin" folders that libs like Lua dish out.

I'm aiming to make the VM as simple as possible to start up and get scripts loaded, it'll probably be something like:

#include "DruinkScript/DruinkScript.h"
#include

int main(int, char**)
{
DruinkScript::VM theVM;
theVM.Init();

DruinkScript::Script* pScript = theVM.LoadScript("Test.ds");
if(!pScript)
{
printf("Failed to load script: %s\n", theVM.GetError());
return -1;
}

while(!pScript->Finished())
{
pScript->Run(50); // Execute up to 50 opcodes this cycle
}

pScript->Release();
return 0;
}


Yes, that doesn't show much, I know. But it's a start. The function binding will probably be via functors, since I hate writing static member functions that just call a non-static member.
I'm not entirely sure how I'll handle multiple scripts, I think the above method should lend itself pretty well to handling that without much bother though.

Anyway. Work...
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!