• Advertisement
Sign in to follow this  
  • entries
    208
  • comments
    383
  • views
    65753

Realtime Dynamic Object Generation and Alteration

Sign in to follow this  

321 views

More...

I've got some nice buttons for jEdit, Digg.com, D&D
(The only podcast I listen to) and my XML RSS feed. Let me know if there is anything else that should be added.

After quite a bit of coding I was able to implement a BeanShell scripting engine into my codebase. This allows for realtime modification of objects in the game. For instance, I can be playing the game, and then send the command 'StateTracker.loadState("MainMenuState");' and it will switch my current state. But his also means that I can even create functions on the fly, and create variables/other objects. I am not limited to having to only use methods, as I was with my own custom scripting back with Java Tactics.

This also means that my when I go to develop map files, the map files can be written in Java and saved as a script, and then interpreted during run-time with all the same functionality as if it were compiled. This will make the scripting later down the road much better.

Think of this as a javascript engine, but with actual Java. Realtime programming is actually pretty neat, and I'm enjoying the benefits from it all ready. Debugging is entirely more easy, as is testing out new methods.

So there you go: Realtime dynamic object generation and alteration, brought to you by the wonderfully compact and elegant Beanshell engine.

//EDIT
From this point on I will only type with the Dvorak keyboard. So beware of this happening: Ydco co mf yflcbi ,cyd ',.py cboy.ae ru Ekrpatss
Sign in to follow this  


3 Comments


Recommended Comments

I found out about it from my IDE: jEdit... it uses beanshell for macroing, and so when I was learning how to make a macro today to count all the lines in open buffers I kind of fell in love with it.

I was like "Man, this is perfect!" And then I went about implementing it… hehe…

Here's the link by the way: BeanShell

It even supports a bunch of java 5 syntax (and still runs in 1.4.2) such as the foreach for loop, generics, autoboxing, and more. I was like wow, gives me java 5 functionality with scripting, which is what will make the difference when the actuall development of the gameplay starts.

Share this comment


Link to comment

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