I guet data description files..but I dont get how to define behaviors

Started by
-1 comments, last by Icebone1000 11 years, 6 months ago
I just started using Lua (first script language), and Ive been reading a lot, and still dont get it, theres some darkness in there and it keeps getting darker.

My main objective with Lua is really ending up using it for defining all sort of behaviors : control mechanics ( how player jumps, how player attacks, how player moves, combos, etc.. ), ai agents behaviors, weapon behavior (I imagine something like worms game, defining what each weapon does on scripts), gui behaviors ( what happens when button is pressed )..etc. (is my Idea of script language usage wrong? I dont think so since all those Ideas I got from games that actually did it (Shanks, Half Life, Liero..))

I cant really visualize how to do even the simplest of the stuff, I get how to use it as data descriptors (like ini files, loading values only), but how to integrate it with your code making it work as external code("code asset")? When I start reading an article about how to do this, BANG, another lua oo library thrown at your face, I dont wanna another library, I want to know how to do it using the goddam lua library*! Since Lua only allows you to register static functions this gets really confuse..

[size=2]*(yeah I tried looking on the source of those libraries, not a chance of understanding it)

To illustrate my confusion:

Imagine an AI agent, the input is a map 20x20 with IDs(player, power ups, obstacles..) and current HP, the output is a movement to some tile, and an action:(shoot(requires direction), defend and use power up...

How to use lua to define this agent decision making code? The only stupid thing I can think is calling a lua function passing a zillion of parameters and returning a zillion of weird values that are actually keywords + value pairs that the c++ code understands ( i.e. passing an 20x20 array to the stack, the HP, and returning something like [A, 8, 4, B, up], 'A' being a keyword for movement, witch is followed by tile x and y, 'B' meaning shoot, followed by a direction..)

Resuming, I dont know how to modulate the architecture around Lua/c++ to do the stuff I wish to do.

This topic is closed to new replies.

Advertisement