08.09.2019 Views

Progettazione e Sviluppo di un Multiplayer Online Game su Reti Peer-to-Peer

Alma Mater Studiorum Universit`a degli Studi di Bologna Facolta` di Scienze Matematiche, Fisiche e Naturali Corso di Laurea in Scienze di Internet Tesi di Laurea in Laboratorio di Programmazione Internet

Alma Mater Studiorum Universit`a degli Studi di Bologna
Facolta` di Scienze Matematiche, Fisiche e Naturali
Corso di Laurea in Scienze di Internet
Tesi di Laurea in Laboratorio di Programmazione Internet

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.4. MODULO SHAREDCOMPONENTS 33<br />

appartenente al proprio Manager. Ques<strong>to</strong> sistema viene utilizza<strong>to</strong> quando da<br />

<strong>un</strong> Layer esterno si vuole creare <strong>un</strong> nuovo componente all’interno del proprio<br />

contes<strong>to</strong>, specificandone solo il tipo ed eventualmente il valore <strong>di</strong> default.<br />

Il secondo invece viene utilizza<strong>to</strong> per istanziare “copie” <strong>di</strong> componenti appartenenti<br />

ad altri Fac<strong>to</strong>ry, eventualmente associati ad altri <strong>Peer</strong> (associazione<br />

che verrà implementata nel prossimo Layer Logic): il componente così crea<strong>to</strong><br />

non sarà <strong>di</strong> proprietà del Fac<strong>to</strong>ry, e non sarà “marchia<strong>to</strong>” come tale, dal<br />

momen<strong>to</strong> che possiede già l’identificativo assegna<strong>to</strong>gli dal Fac<strong>to</strong>ry originale.<br />

Il terzo permette <strong>di</strong> aggi<strong>un</strong>gere <strong>un</strong> generico componente come “sot<strong>to</strong>-componente”<br />

<strong>di</strong> <strong>un</strong> componente già esistente all’interno del contes<strong>to</strong>.<br />

E’ importante notare quin<strong>di</strong> come, all’interno del modulo SharedComponents,<br />

la lista dei componenti non sia popolata necessariamente da componenti<br />

generati dal “proprio” Fac<strong>to</strong>ry.<br />

Se ad esempio si vogliono modellare le informazioni che caratterizzano <strong>un</strong><br />

ogget<strong>to</strong> tri<strong>di</strong>mensionale, si possono utilizzare i seguenti componenti secondo<br />

la gerarchia proposta in Figura 2.10:<br />

Il componente <strong>di</strong> tipo Object3D è caratterizza<strong>to</strong> da due sot<strong>to</strong>-componenti,<br />

rispettivamente identificati dal LocalID “Position” e “Rotation” (non è sta<strong>to</strong><br />

inseri<strong>to</strong> <strong>un</strong> componente relativo al valore <strong>di</strong> Scaling dell’ogget<strong>to</strong> perché è <strong>un</strong><br />

parametro lega<strong>to</strong> maggiormente al Layer VIEW ed eventualmente può essere<br />

com<strong>un</strong>que incluso estendendo ques<strong>to</strong> componente). Entrambi sono componenti<br />

<strong>di</strong> tipo Vec<strong>to</strong>r3 che, come illustra<strong>to</strong> precedentemente, è compos<strong>to</strong> a <strong>su</strong>a<br />

volta dai componenti <strong>di</strong> tipo Float, “X ”,“Y ” e“Z ”.<br />

Un componente non “leaf” viene considera<strong>to</strong> “ready” solo quando tutti<br />

i <strong>su</strong>oi componenti sono stati istanziati e ri<strong>su</strong>ltano “ready” a loro volta: <strong>un</strong><br />

Object3D, quin<strong>di</strong>, non sarà considera<strong>to</strong> “ready” fintan<strong>to</strong> che non lo saranno<br />

i <strong>su</strong>oi due Vec<strong>to</strong>r3 “Position” e “Rotation”;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!