Thread: [Avatarsdev-general] modificatori e altro
Status: Inactive
Brought to you by:
andreavalente
From: K <st...@in...> - 2003-03-18 18:14:42
Attachments:
mods_ids.txt
|
Ciao a tutti. Ho lavorato un po' sui modificatori e le mie idee/osservazioni sono=20 nell'allegato. Perdonate il pessimo inglese :-P Attendo consigli prima di procedere. :-) K PS: la prima versione =E8 di tre giorni fa; oggi ho fatto un paio di=20 aggiunte marcate con [ADD], se qualche frase "salta" =E8 per questo. PPS: spero di poter fare qualche fanfagramma al pi=F9 presto. Si possono=20 spedire (piccole) immagini sulla ML? |
From: Inglima M. D. S. <st9...@ed...> - 2003-05-21 16:25:41
Attachments:
mods_ids.txt
|
On Tue, 18 Mar 2003, K wrote: A grande richiesta (K me lo ha richiesto e Mamma sapevo che lo voleva) riposto il messaggio online :) > Ciao a tutti. > Ho lavorato un po' sui modificatori e le mie idee/osservazioni sono > nell'allegato. Perdonate il pessimo inglese :-P > Attendo consigli prima di procedere. > :-) > =09K > PS: la prima versione =E8 di tre giorni fa; oggi ho fatto un paio di > aggiunte marcate con [ADD], se qualche frase "salta" =E8 per questo. > PPS: spero di poter fare qualche fanfagramma al pi=F9 presto. Si possono > spedire (piccole) immagini sulla ML? |
From: Davide I. - l. <li...@li...> - 2003-05-22 07:18:31
|
Io vi ripeto: dovete guardare robocode! http://robocode.alphaworks.ibm.com/ Ha tutto quello che possiamo desiderare da un programmino! Ha un ambiente con: (A) personaggi (i carriarmatini) (B) limiti (i muri) (C) possibilita' di osservare il mondo (sensori limitati) Su questo possiamo cominciare ad implementare modelli semplicissimi di - agenzie (direi agenzie tipo: hai paura, sei aggressivo, ricerca e sviluppa strategie, combatti normalmente) - analisi degli input - planner eccetera. -- limaCAT |
From: Inglima M. D. S. <st9...@ed...> - 2003-06-03 13:52:44
|
On Tue, 3 Jun 2003, Inglima Modica Davide Silvio wrote: > Modifiers and ids -- K - 2003 03 18 > 1) Modifiers: "Modifiers" means the way I chose to apply changes to > entities in the game. That changes could be temporary ("transient") or > can be not-reversible ("permanent"). [snip] The problem is: what do you think a modifier has to do? * Does it have to work as a netbeans/eclipse/mozilla plugin component? * Does it have instead to work a simple "modifier" for the outcome of an action? In the first case the chaos ensues, but in the second case it is rather simple. You have a modifier which: (a) registers (enters a stack) (b) unregisters let's say to have a man with "Strenght" as one of his characteristics, then there is a stack of modifiers somewhere. To get the raw or modified strenght we have these member functions: int getStrenghtRaw() { return strenght; } int getStrenghtModified() { int tempvalue = processStrenght(strengh); return validate(tempvalue); } To add a modifier we use a Collection: List strenghtPile; void strenghtModifiersPile(StrenghtModifier x) { /// should throw an exception in case of duplicate modifier strenghtPile.add(x); } To use the modifiers then we iterate on it: int processStrenght(int strenght) { /// of course it could access directly strenght, but maybe we want /// a little more freedom... /* * insert classic iterator example here * since I'm trying to remember things... */ Iterator i = strenghtPile.getIterator() while(i.hasnext()) { strenght = i.getNext().getModifierAction(strenght); } return strenght; } Modifiers then could be added or removed when needed > We need a way to identify the modifier to remove. > [ADD] I need some explanation: how the universe is supposed to > work? The "universe" has many "worlds" (one per runtime environment) > connected, and an entity can travel from one to another > on the net (ie over TCP/IP, etc.)? [ADD] [snip] > 3.1) What can be used as id in Java? [snip] > [ADD] 4- java.rmi.server.UID [ADD] Could be useful (the classes you propose are in J2SE if I'm correct, right?). Anyway... IDManager could be a singleton class. A singleton is a design pattern which says: "for each running instance of program x there is only a given object of a given singleton class", so having only one IDManager we can keep track of consistencies and inconsistencies. If we ever need to have a set of local and distributed IDManagers, the local IDManager could call a central server IDManager which will give back a pool of 100/1000 id's at a time. How to write a singleton: package net.sourceforge.avatars.util; public class IDManager { private static IDManager idmanager = null; private int lastid = 0; // note the private constructor private IDManager() { } // this creates a new IDManager OR returns the IDManager already running public static IDManager getInstance() { if (idmanager == null) { idmanager = new IDManager(); } return idmanager; } // this returns a number and adds one to the count; public synchronized Integer getNewID() { Integer result = new Integer(lastid); lastid++; return result; } } How to access it: IDManager idm = IDManager.getInstance(); Integer ix = idm.getNewID(); If we need to scale the IDs to a number higher, we could give back a class with four integers, or whatevere other else. Do we really need to free the IDs after having used them? Ciao. -- Davide Silvio Inglima-Modica "Mana is rapidly disappearing from the world, Even the" "mana tree has begun to wither" - Seiken Densetsu 3 http://web.tiscali.it/inglima/davide/ mailto:had...@li... |