OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:48 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Java Adventure Interpreter--> To extend scripting or not?
PostPosted: Sun Oct 27, 2002 9:42 pm 
My next project will involve using J2ME to create an "adventure" genre game similar to AGI/SCI, but with modern graphic and sound formats.

Anyway, the real deal is that I'm wondering if I'll have to extend the scripting to parse/lex room logic scripts or if it would be possible to define a group of static variables in a room class, and inherit those classes into further room class objects, each with their events and scripting of interaction hard-coded into them (To avoid run-time overhead on mobile devices by using precompiled code).

Would hard-coding the logics be possible, or am I going to have to create an interpreter in Java on top of the Java VM?


Top
  
 
 Post subject: Re:Java Adventure Interpreter--> To extend scripting or n
PostPosted: Sun Oct 27, 2002 11:05 pm 
I'm sure it's possible to hard-code the behavior of each logic. The only questions are ease and extensibility.


Top
  
 
 Post subject: Re:Java Adventure Interpreter--> To extend scripting or n
PostPosted: Mon Oct 28, 2002 1:27 am 
you could write a script engine similar to those used in most current PC games. the script is loaded, interpreted, compiled, then executed that way.

eventually, you end up writing something not unlike your own machine language, but with effective use of enumerations and parse tables, it's a lot simpler than it sounds. i'd do that just for kicks.

but for an embedded environment? just create an API and allow external classes to interface with it. that's much easier to implement and will probably end up being a lot smaller than your own script engine.


Top
  
 
 Post subject: Re:Java Adventure Interpreter--> To extend scripting or n
PostPosted: Mon Oct 28, 2002 1:35 am 
Yeah, basically, I want to make a class library with my different game objects: room, object/sprite, inventory item.

Then, I would put the sprite's behavior script (probably event capture) into an object that inherits my Sprite class.

Also, I would have multiple rooms inherited from Room with event capture triggered behavior (i.e., if ego is on a certain box on screen, if a certain command is activated, etc.).

Something similar for inventory items.

Then, I'd refer to these objects through the main application, probably in the same way AGI refers to them, by placing a number in their name, so (pseudo: run.room.logic("Room"+room_no+".class")).

In the Java book I'm using for reference and learning, one of the projects is creating a VM, but I think that the Java VM should already be able to handle all of my needs, and I'm not sure if I can afford the run-time overhead.


Top
  
 
 Post subject: Re:Java Adventure Interpreter--> To extend scripting or n
PostPosted: Wed Oct 30, 2002 12:38 am 
you can't afford that kind of waste on an embedded platform. the java VM is already a lot of overhead as it is, as you probably well know.

stick with the API method. it's about your only option as far as this goes.


Top
  
 
 Post subject: Re:Java Adventure Interpreter--> To extend scripting or n
PostPosted: Thu Oct 31, 2002 5:07 pm 
I've been doing some reading into Java. It seems that I'm going to go with an abstract room class and a group of final room classes linked with pointers.


Top
  
 
 Post subject: Re:Java Adventure Interpreter--> To extend scripting or n
PostPosted: Sat Nov 16, 2002 10:25 pm 
Does anyone know of any good references for programming graphics in Java? My text book is fairly weak inasmuchas sprite graphics. For instance, it doesn't provide a means to designate transparent colors for my sprites.

Any help is appreciated.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group