Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Lua for a change...

Sign in to follow this  


A while ago I wrote some code to allow you to compile lua code on the fly and then call it like a normal functor, it wasnt really finished but I also couldnt really think of a really good useage for it, until just this minute.

RTS games are the key here. Most RTS games give you a set number of units, a selection of tanks and such with set AI patterns hard coded into them. There is a notable exception to this, although the name of the game escapes me at the moment, but it let you design your own units and use them.

Now, designing the units is all well and good, but there is some kind of base AI still being used. Now, this got me thinking, what if you could design the AI to some degree as well? Define how a group of units react.

For example, you might have a heavy tank which you want to hold its position and only fire if fired apon, but you might have another group which you want to seek and destory any units, only withdrawing from combat if they take a certain amount of damage. Or a scout unit which you want to only engage if there is a chance they can win the battle otherwise report back the information and attempt to stay out of the detection range of the units they are observing.

The simplest way I could think of doing it would be to have a set of scripted (or traditionaly coded) behaviours, you can then take a template for a vehical/unit/whatever and attach a set of behaviours to it which would make a unique unit type.

This does link in somewhat with my MMORTS idea, in that you could pre-program a scout ship to say depart the fleet, make a jump to a location, execute a recon mission of some type and then jump back with a conditional order to return apon being detected.

Ofcourse, this wouldnt be a coding job (or not by default, maybe different layers for different people), more a click-n-drag system where you have a palette of things which can be done.

I should probably finish up my dynamic Lua class (and update it for the newest version of Luabind...), maybe write something about it..
Sign in to follow this  

1 Comment

Recommended Comments

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!