Search the Community
Showing results for tags 'development'.
-
Here is how i made it possible to call C++ from LUA. I want to build Multiplayer game in Leadwerks. But i couldn't find networking libraries and threading libraries that would make it usable in Lua. So i build a Networking client in C++ with libcurl and libpthread . But i want to still use the Lua scripting on the prefabs since a lot of work is already done for me here. And also programming in Higher level languages is just faster. I decided to use the libtolua++ libraries, since this is already build into Leadwerks. I work on Ubuntu 15.04. Here the tolua++ libs are installed with: sudo apt-get install libtolua++5.1-dev The tolua++ program needs a pck file which shall contain the c++ like seudo code that is translated into lua classes. My package: $#include "shot.h" class ShotListener { ShotListener(); ~ShotListener(); void shot(Object* oEntity, float damage); float getHealth(Object* oEntity); }; I have made two functions. One to emit shots detected on the Entities from the Lua scripting. Another to get the current health status from C++ side. My actual ShotListener.h class looks like this: #pragma once #include "App.h" #include "Leadwerks.h" using namespace Leadwerks; class ShotListener { private: public: ShotListener(void) { } ~ShotListener(void){} void shot(Object* oEntity, float damage) { App *app = App::getInstance(); Entity * entity = (Entity*)oEntity; app->entityShot(entity, damage); return; } float getHealth(Object* oEntity) { App *app = App::getInstance(); Entity * entity = (Entity*)oEntity; float value = app->getEntityHealth(entity); return value; } }; As you can see i changed the default App class into a Singleton so that i can get the App object from the instances of ShotListener that is used from Lua. Having placed these two files in the same folder i ran the following function from the terminal: tolua++5.1 -o tolua_shot.cpp -H tolua_shot.h -n Shot shot.pkg This generated two files tolua_shot.cpp and tolua_shot.h that i included in my C++ project along with the shot.h file. This way i can do a self.shotListener = ShotListener:new() In the Script:Start() function in mu Lua objects and a self.shotListener:shot(self.entity, self.hits) When Hurt is called in the Lua object. After this i just had to sort out all the Segmentation error bugs because of multithreading. I forgot to mention that the ShotListener Lua also needs to be initialized in the main.cpp before app->Start() with the following: if (Interpreter::L==NULL) Interpreter::Reset(); tolua_ShotListener_open(Interpreter::L);
-
This is my very first blog, so I'm not sure the ins and outs of writing one. I will do my best and hopefully become better at writing them. In the last few weeks, I have been contemplating starting a business in making games. I have done countless research on starting a business and have finally come to a point where I'm ready to begin registering the business and getting a website up and running. I have decided to write a blog on said website, which will mainly consist of dev logs on the game I will be working on. I also plan on making dev logs on YouTube, showing my progress, not only for other to see, but also for a record of what I did so I can learn from it for future projects. My first game will be on iOS, as 3D games are just too ambitious. The plan is to make a 2D action RPG. It's not going to be as complex as Pokemon or Zelda, but will be big enough to keep my interest. A lot of people suggest making simple games first, but that doesn't interest me. I want a challenge. Hopefully running a business will kind of force me to stick with a project, instead of just making a prototype and moving on. My first hurdle has been making the website. I've decided not to use a CMS such as Wordpress, as I have enough web experience to make my own. I want it to be customizable and I want to make it as secure as possible for when I start implementing a login mechanism with mailing lists and the sort. I have the skeleton of a website with enough visual fidelity to be released, but I just don't know what content to put in. I don't have any images to put up and I'm not sure what to write, as I haven't actually done much development work yet. I'd love to know what you guys think I should add. The website isn't public, so I can't show you what I have, but if you have any experience with this kind of thing, I'd love to hear from you. I hope to write more blogs like this in the future, so any feedback on my writing or suggestions on starting a business would be greatly appreciated. Also, If you are thinking of starting an indie game business of your own, I'd be happy to share the info that I have gathered.
- 6 comments
-
- development
- indie
-
(and 1 more)
Tagged with: