🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published October 11, 2006
Advertisement
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...
Previous Entry Untitled
Next Entry Untitled
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement