Jump to content

  • Log In with Google      Sign In   
  • Create Account


Kurasu1415

Member Since 14 Jan 2005
Offline Last Active Aug 21 2013 02:47 AM
-----

Topics I've Started

implementing scripting system in C++ using LUA or Python

25 July 2013 - 01:12 AM

In the simplest terms, what is the common architecture that developers use to manage and persist script states in their games? Below is a better description of my issue.

I've doing a lot of research lately regarding exposing my c++ classes to either LUA or Python. I'm still not sure on what language I want to go with, but that isn't the real question. Exposing a class in either language is no problem, but what I don't understand is where to go from here.

What I don't understand is how people manage to get seemingly separate script states for every script instance in their game. For example, Every enemy in the game has a script, that defines a health variable for that enemy. So, if an enemy loses health, the next time I run his script, his health variable in the script should still show the health value it was previously.

I can see two obvious solutions to this problem.

#1. Have a different Lua interpreter for ever single instance. (This just seems needlessly expensive)

#2. Save the state of your entire interpreter and load that up for each script run.

The 2nd option seems like the best solution, but I have seen that this is a bad idea. Regardless, I did look into this, and it seems like using the Pickle library with Python would be a good solution. I have also seen that I could serialize parts of my Lua instance and store those.

What do you guys recommend  as the best solution?
 


How do variables and objects persist in Lua?

14 November 2012 - 03:02 PM

I am using LuaBind to embed Lua scripting into my C++ game engine. My question is how do variables persist in this situation. For example, a game object has the name of a Lua file associated with it. At the creation of the Game object in C++, I call the "OnCreate()" function in the lua script associated with the game object. It seems like I should tell lua what Lua file to look at, and then run the function for that specific file. What if last time I had that specific file open, I set a variable local to the whole script. When the file is reopened, does lua automatically know, and give me access to those variables again?

Sorry if this is a confusing question.

Thanks.

Physics Engine Timing Suggestions?

03 October 2012 - 05:39 PM

So, I am working on my own physics engine for a game that requires precise controls. The physics is handled in it's own thread separate from the rendering. My issue is making sure that my simulations run at the same speed on all systems. I have looked around and found a few posts relating to this, but as they use Box2D, some things aren't explained. I am particularly interested in the Semi-fixed timestep.

Related Posts :
http://gafferongames.com/game-physics/fix-your-timestep/
http://blog.allanbishop.com/box-2d-2-1a-tutorial-part-10-fixed-time-step/

Now, my system essentially works this way as of current. This is a pretty simplified explanation, but I have a list of Physical Objects, and a Queue of Pairs(or tuples) that have an objectID and a Vector (The mathematical vector). Each Pair represents a force. Then I have my collision handling code. (As I said, horribly oversimplified)

How have you guys solved this problem? Could you offer any clarification on what is explained in these posts?

Using different shaders on objects, and multiple shaders on one object

11 August 2012 - 12:20 AM

Essentially I am trying to handle my shaders in the most dynamic way possible. I want to be able to associate certain objects with shaders, like a component-based system. So an object can have multiple shaders attached to it. The simplest way I can think of doing it is by having a map of shaders to objects.

I am targeting OpenGL 3.3 so that I can get decently modern code that works on the majority of systems owned by gamers.


My biggest issues revolve around two questions :

1) What is the best way to apply different shaders to different objects?

Thoughts : From what I have read, it seems like the best way is to designate what objects use what shaders, then begin using a shader, draw the corresponding objects, move to next shader.

2) What is the best way to apply multiple shaders to an object?
Thoughts : Should I just bind a shader program, draw what I need, get a texture back, then bind the next shader and pass it my texture? For example, if I had a shader that rendered one specific object in black and white, could I apply my normal shaders, then pass a resulting texture on to the new shaders to do the final processing? Is that too much overhead?

I apologize if my issues are hard to understand. Please ask any questions that can help make the issues more clear. Thanks in advance!
-Kreed

I got a job offer, is it ok to finish school online?

09 February 2012 - 08:11 AM

So, I got offered a good-paying job developing 3D training Simulations for the military. I still have a year of college left. They picked me up based on my experience. If I go with them, will it look bad if my degree is completed online?

Thanks,
Charlie

PARTNERS