Sign in to follow this  

Using scripting to control sprite behaviour

This topic is 4761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Apologies if this isn't the right forum for this problem; the A.I. forum also seemed reasonable, but I suspect that'd be a higher-lever problem. I'm working on a 2D platforming game in a similar style to Metroid and Castlevania. I'm planning to have each "monster" have a generic data file, instead of having specific content-related information encoded into my C++ program. That is, I don't want to have "EvilKnight* joe = new EvilKnight", but instead "Monster* joe = new Monster(TYPE_EVIL_KNIGHT)". Obviously this means that I can't encode the A.I. of the monsters into the update function of the Monster class; I'd rather view the A.I. as just another component of the monster's specification, without limiting my game to a set of precoded A.I. types. I was thinking of trying to associate a simple script with each monster's data file. The trouble is that I've no real ideas on how to do this and what languages I should use (making my own homebrew is really unappealing). Is what I have in mind even workable? What kind of performance hit would I face by using uncompiled scripts that get run each update cycle for each monster? I'm planning to give each monster some basic information about their world, but they'll be pretty stupid on the whole. They'll know the player's current location and state (since the player has a variety of forms available), as well as their own health, location, et cetera. I don't really plan for them to know the local terrain, since that seems like it could get complicated quickly. Some monsters will completely ignore this data; e.g. monsters that just walk straight forward, Goomba-style. Ideally I'd like the behaviour scripts to be able to call my own spawnMissile(), die(), et cetera functions, which would be written in C++. Any advice is appreciated. This includes pointing me at resources that I've missed. Is this even a good idea? Edited to fix, of all things, a syntax error in my C++. That was really sad. [Edited by - Derakon on November 29, 2004 7:22:32 PM]

Share this post


Link to post
Share on other sites
http://www.lua.org
http://www.lua.org/pil/

I'd say code everything in a level as a script, run the script, and let your engine update the entities as specified by the level script. For such simple monsters, you should be able to put the entire AI system in script form.
--or like Tarzan says--
Script Specify, Engine Run.

Share this post


Link to post
Share on other sites

This topic is 4761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this