dynamic number of functioons - need for a pattern
Hey all!
I'm currently developing web based game, with a quite original core system. You can skip the details to the point who brings me troubles.
In this game, players sends units in the "wolrd", to fetch gold packs. Players have no real-time view of what's happening to their units; instead, they receive a written report of what has happened during the units' journey, when they come back to home.
These reports are built out of 3 to 7events, depending on the length of the trip.
In fact, the game is a big pool of events - i.e. short stories, that are non-linear. They are tree-shaped, thus they have several possible executions. The events tell the players stories in a roman-fashion, but they also specify the bonuses the units gain (like gold, items etc...).
I invented a simple language, designed to simplify the writing of events. Non-java programmer are supposed to write these events. I also developped a compiler that does the job of translating these events into JAVA. The compiler works, however I have no idea how to present the output.
Here is the trouble :
As events should be represented by objects, I'd prefer an OO solution. I need to retain information about events, such as "which player as already encountered such event".
But if I need to write a class for each event, and the game gets really big later on, there will be hundreds of classes loaded in the server (TOMCAT) and I don't like that.
Note that I can't use a template class, and instanciate it with the code of the event, simply because itis code, with statements, flow control etc....
If only I could instanciate that template, providing a method to its constructor, I'd be happy. Any one knows how to do that?

