sdk javahelp: Removed deprecated spidermonkey directory; Added missing ".html" to some items in wiki-map, Added MotionPath and Save&Load documentation.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8331 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
roo..li 13 years ago
parent 3969d34a03
commit 663a3ba7d5
  1. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml
  2. 14
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/spidermonkey/tutorial/compression.html
  3. 37
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/spidermonkey/tutorial/connection.html
  4. 21
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/spidermonkey/tutorial/sending_and_receiving_messages.html
  5. 36
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/spidermonkey/tutorial/serializing.html
  6. 22
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/spidermonkey/tutorial/services.html
  7. 26
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/spidermonkey/tutorial/streaming.html
  8. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml
  9. 2
      sdk/jme3-core/javahelp/wiki_help.properties

@ -118,10 +118,12 @@
<tocitem text="3D Models" target="jme3.advanced.3d_models"/>
<tocitem text="Custom Meshes" target="jme3.advanced.custom_meshes"/>
<tocitem text="Asset Manager" target="jme3.advanced.asset_manager"/>
<tocitem text="Save and Load" target="jme3.advanced.save_and_load"/>
<tocitem text="Collision and Intersection" target="jme3.advanced.collision_and_intersection"/>
<tocitem text="Mouse Picking" target="jme3.advanced.mouse_picking"/>
<tocitem text="Animation" target="jme3.advanced.animation"/>
<tocitem text="Cinematics" target="jme3.advanced.cinematics"/>
<tocitem text="MotionPath" target="jme3.advanced.motionpath"/>
</tocitem>
<tocitem text="Materials, Light and Shadow" expand="false">
<tocitem text="jME3 and Shaders" target="jme3.advanced.jme3_shaders"/>

@ -1,14 +0,0 @@
<h1><a
name="compression">Compression</a></h1><div
class="level1"><p><p><div
class="notewarning">This article covers a deprecated <acronym
title="Application Programming Interface">API</acronym>! See <a
href="/com/jme3/gde/core/docs/jme3/advanced/networking.html">networking</a> for current documentation.</div></p> Now this is going to be a real simply tutorial but still I wanted this in a separate article. Why you may ask? Simply because it&#039;s a feature that requires some explanation, since it has some caveats that I&#039;ll discuss. Also, I&#039;ll cover writing your own compression message.</p><p> First off - there are two compression types in SpiderMonkey, they are GZip and Zip. Could&#039;ve added more, but didn&#039;t want to have a dependency for just a compression method. Both are used by wrapping your message in the appropriate compression message:</p><pre>MyMessage msg = new MyMessage&#40;&#41;;
client.send&#40;new GZIPCompressedMessage&#40;msg&#41;&#41;;
// or
client.send&#40;new ZIPCompressedMessage&#40;msg&#41;&#41;;</pre><p> Really simple, but ZIP requires some explanation. The ZIPCompressedMessage class also has two extra methods; setLevel(int) and getLevel(). These methods are for setting the compression level, where 1 is best compression but slowest, and where 9 is weakest compression but fastest. Please note that 9 is <strong>not</strong> the so called &#039;store&#039; ZIP method, which simply stores file in the ZIP, instead of compressing it. This &#039;store&#039; feature is not in SpiderMonkey since otherwise it would not have been called compression.</p></div><h3><a
name="writing_your_own">Writing your own</a></h3><div
class="level3"><p> Now of course I&#039;d love to see more compression methods in SpiderMonkey, so I&#039;ll discuss how to write your own. Let&#039;s just take GZIPCompressedMessage as example, since that one is the most straightforward. What I&#039;ve done, is I&#039;ve just created a GZIPCompressedMessage which extends CompressedMessage. It does not contain any extra messages, so the GZIPCompressedMessage class is practically &#039;empty&#039;. The magic happens at the serializer, which is called the GZIPSerializer (you can read about writing your own serializer <a
href="/com/jme3/gde/core/docs/spidermonkey/tutorial/serializing.html">here</a>). Then I just registered the GZIPSerializer to GZIPCompressedMessage and presto - you&#039;re done. Don&#039;t forget that in the Serializer you need to use writeClassAndObject first and then compress that data, and for read you&#039;d need to use readClassAndObject after you&#039;ve uncompressed (inflated) the message. For this to be clear, it may be useful to read <a
href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/networking/com/jme3/network/serializing/serializers/GZIPSerializer.java">the GZIPSerializer class</a>.</p><p> That&#039;s that! Next tutorial we&#039;re going to discuss how to use the Service system.</p></div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/spidermonkey:tutorial:compression?do=export_xhtmlbody">view online version</a></em></p>

@ -1,37 +0,0 @@
<h1><a
name="connecting">Connecting</a></h1><div
class="level1"><p><p><div
class="notewarning">This article covers a deprecated <acronym
title="Application Programming Interface">API</acronym>! See <a
href="/com/jme3/gde/core/docs/jme3/advanced/networking.html">networking</a> for current documentation.</div></p></p><p> This very first tutorial is going to teach you how to open a server and a client, and connect them to eachother. I&#039;ll also discuss how connection registration works. Since this is a very simple process in SpiderMonkey, this tutorial will be quite short.</p></div><h3><a
name="simple_connections">Simple connections</a></h3><div
class="level3"><p> Creating a server is as simple as doing this:</p><pre>Server myServer = new Server&#40;4040, 5050&#41;;
myServer.start&#40;&#41;;</pre><p> This initializes and starts a server on TCP port 4040 and UDP port 5050. Now it&#039;s time to connect a client:</p><pre>Client client = new Client&#40;&quot;localhost&quot;, 4040, 5050&#41;;
client.start&#40;&#41;;</pre><p> This initializes and starts a client, and it will immediately connect to localhost, TCP port 4040, and UDP port 5050. In the log, you&#039;ll get to see this:</p><pre>Sep 16, 2010 11:52:16 AM com.jme3.network.connection.TCPConnection bind
INFO: [Server#1][TCP] Bound to 0.0.0.0/0.0.0.0:4040
Sep 16, 2010 11:52:16 AM com.jme3.network.connection.UDPConnection bind
INFO: [Server#1][UDP] Bound to 0.0.0.0/0.0.0.0:5050
Sep 16, 2010 11:52:16 AM com.jme3.network.connection.Server start
INFO: [Server#1][???] Started server.
Sep 16, 2010 11:52:16 AM com.jme3.network.connection.TCPConnection connect
INFO: [Client#1][TCP] Connecting to localhost/127.0.0.1:4040
Sep 16, 2010 11:52:16 AM com.jme3.network.connection.UDPConnection connect
INFO: [Client#1][UDP] Set target to localhost/127.0.0.1:5050
Sep 16, 2010 11:52:16 AM com.jme3.network.connection.TCPConnection accept
INFO: [Server#1][TCP] A client connected with address /127.0.0.1
Sep 16, 2010 11:52:16 AM com.jme3.network.connection.TCPConnection connect
INFO: [Client#1][TCP] Connection succeeded.</pre><p> As you can see, this is a combined log of the client and server. Even though it looks like only a connection has been made, the Client registration has already happened at this point as well. Client registration is necessary so you can call TCP and UDP methods on only one Client instance on the server. You don&#039;t have to worry about client registration, since SpiderMonkey does this automatically on connection.</p></div><h3><a
name="connector_filters">Connector filters</a></h3><div
class="level3"><p> You can also filter connections (or connectors as I call them) in SpiderMonkey. You can do this by implementing the ConnectorFilter interface:</p><pre>public class MyConnectorFilter implements ConnectorFilter &#123;
public String filterConnector&#40;InetSocketAddress address&#41; &#123;
if &#40;address.isLoopbackAddress&#40;&#41;&#41; return &quot;I don't like locals!&quot;;
return null;
&#125;
&#125;</pre><p> Return null for no filtering, or a String with the reason if you want to filter this person.</p></div><h3><a
name="discover_hosts">Discover hosts</a></h3><div
class="level3"><p> SpiderMonkey Clients are also able to discover hosts running in the LAN. This is also a very simple process, and can be done as follows:</p><pre>Client client = new Client&#40;&#41;;
List&lt;InetAddress&gt; foundHosts = client.discoverHosts&#40;5050, 5000&#41;;</pre><p> This starts the host discovery on port 5050, and listens for servers for 5 seconds. Typically, servers respond pretty fast so a few seconds should be enough. To do something with these hosts it&#039;s as simple as doing:</p><pre>for &#40;InetAddress host : foundHosts&#41; &#123;
client.connect&#40;host.getCanonicalHostName&#40;&#41;, 4040, 5050&#41;;
&#125;
client.start&#40;&#41;;</pre><p> Do note that this would connect to every host found, so this does not work properly, but the idea is that you can configure it the way you want it. Don&#039;t forget to start() the client.</p><p> This concludes the first tutorial. In the next tutorial, it&#039;s time to send and listen for messages!</p></div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/spidermonkey:tutorial:connection?do=export_xhtmlbody">view online version</a></em></p>

@ -1,21 +0,0 @@
<h1><a
name="sending_and_receiving_messages">Sending and receiving messages</a></h1><div
class="level1"><p><p><div
class="notewarning">This article covers a deprecated <acronym
title="Application Programming Interface">API</acronym>! See <a
href="/com/jme3/gde/core/docs/jme3/advanced/networking.html">networking</a> for current documentation.</div></p> In this tutorial I&#039;m going to cover sending and receiving messages. I&#039;ll also explain how to write your own messages. This tutorial assumes you already have a working server-client connection.</p><p> Let&#039;s start by creating our own message. Later on we&#039;ll send this across the network.</p><pre>@Serializable&#40;&#41;
public class HelloMessage extends Message &#123;
public String hello = &quot;Hello!&quot;;
&#125;</pre><p> This is probably the smallest and simplest message you&#039;ll find. This is simply the process of creating a class, extending Message, and adding your fields to it. Also you need the @Serializable annotation, but we&#039;ll get to that later. Even though you don&#039;t <strong>have to</strong> extend Message, you generally should since then SpiderMonkey can add client and connection information on receiving. You can also send separate data, but we&#039;ll not go into that here - you should just send Messages.</p><p> Now let&#039;s send this message across the network. We&#039;ll send it from the client to the server.</p><pre>Serializer.registerClass&#40;HelloMessage.class&#41;;
server.addMessageListener&#40;this, HelloMessage.class&#41;;
client.addMessageListener&#40;this, HelloMessage.class&#41;;
client.send&#40;new HelloMessage&#40;&#41;&#41;; </pre><p> First we&#039;ve registered the class to the Serializer. This needs to happen on both the client and server, I&#039;ll explain why in the next tutorial. Then we add the message listeners for both the server and client, this makes sure we&#039;re notified when messages are received. Then we send the message. The message is by default reliable, and so it will be sent over TCP. Now we&#039;ll handle it on the server:</p><pre>public void messageReceived&#40;Message message&#41; &#123;
// This message is of type HelloMessage, so we don't have to check.
HelloMessage helloMessage = &#40;HelloMessage&#41;message;
System.out.println&#40;helloMessage.hello&#41;;
helloMessage.hello = &quot;Hi!&quot;;
message.getClient&#40;&#41;.send&#40;helloMessage&#41;;
&#125;</pre><p> This simply receives the message, and changes the Hello! to Hi! and sends it back to the client. The client, can of course handle this message however it wants to.</p></div><h3><a
name="serializable_annotation">Serializable annotation</a></h3><div
class="level3"><p> The Serializable annotation is used to determine which serializer you want to use for your message, and which ID you want to register to it. If you specify no ID and no serializer, a ID will be assigned, and the default serializer will be used. The problem with specifying no ID is that you have to have the same order of registration on both the client and server, otherwise serializing will go wrong. It&#039;s therefore advisable that you use the id field, if you want to register classes in a different order.</p><p> The default serializer is, of course, FieldSerializer, which&#039;ll do just fine for just about any message you can throw at it. However, if you wish to serialize your message yourself, all you must do is write your own serializer, and then pass the class to the serializer field in the annotation. For example, this Serializable annotation sets ID to four, and serializer to CustomSerializer (which doesn&#039;t exist, mind you).</p><pre>@Serializable&#40;id=4, serializer=CustomSerializer.class&#41;</pre><p> That was it! The next tutorial explains how the Serializer system works, and how you can register your own serializers!</p></div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/spidermonkey:tutorial:sending_and_receiving_messages?do=export_xhtmlbody">view online version</a></em></p>

@ -1,36 +0,0 @@
<h1><a
name="serialization_system">Serialization system</a></h1><div
class="level1"><p><p><div
class="notewarning">This article covers a deprecated <acronym
title="Application Programming Interface">API</acronym>! See <a
href="/com/jme3/gde/core/docs/jme3/advanced/networking.html">networking</a> for current documentation.</div></p> In this lesson you&#039;ll learn about a pretty advanced system of SpiderMonkey. Why so early, you may ask; it&#039;s because it is an important aspect of SpiderMonkey, that you need to understand to effectively network your games.</p><p> Let&#039;s start with a general explanation of how the serialization system works. SpiderMonkey&#039;s Serializer class is the entry point for everything serializing. Serializing is the act of translating an object into bytes, so it can be transferred over the network. SpiderMonkey does this by having Serializer classes (they extend Serializer itself), and having some static methods available in the Serializer class. A serializer does not exist without a class it can serialize - this means that Serializers need to be registered with a class. For example, the String type is registered to the StringSerializer class. Without the String type being registered, there&#039;d be no instance of StringSerializer. So! Let&#039;s get down to business!</p></div><h3><a
name="writing_your_own_serializer">Writing your own serializer</a></h3><div
class="level3"><p> There is going to be a situation where you need to serialize something yourself, whether you like it or not. We&#039;re going through how you&#039;re going to do, by writing a entirely new Serializer - please note that this Serializer is not necessary in SpiderMonkey, since SpiderMonkey can serialize Serializable, and InetAddress4 implements Serializable (though it does save a LOT of bytes by doing it yourself). The field that makes an InetAddress4 an InetAddress4 is the IP address, so that&#039;s what we&#039;re going to serialize. Let&#039;s start by going through the basics of extending the Serializer class:</p><pre>public class Inet4AddressSerializer extends Serializer &#123;
public IOException
return null;
&#125;
&nbsp;
public void writeObject&#40;ByteBuffer buffer, IOException &#123;
InetAddress&#41;object;
&#125;
&#125;</pre><p> As you can see, you have to extend Serializer and implement the methods T readObject(ByteBuffer, Class) and writeObject(ByteBuffer, Object). These are the methods that actually do the job. Obviously, writeObject is used when sending, and readObject is used when reading. The next part is just Java coding - you just kind of have to know the <acronym
title="Application Programming Interface">API</acronym> of those objects you&#039;re serializing to convert into bytes. This one&#039;s really simple though ;)</p><pre>public class Inet4AddressSerializer extends Serializer &#123;
@Override
public &lt;T&gt; T readObject&#40;ByteBuffer data, Class&lt;T&gt; c&#41; throws IOException &#123;
byte&#91;&#93; address = new byte&#91;4&#93;;
data.get&#40;address&#41;;
return &#40;T&#41;Inet4Address.getByAddress&#40;address&#41;;
&#125;
&nbsp;
@Override
public void writeObject&#40;ByteBuffer buffer, IOException &#123;
Inet4Address address = &#40;Inet4Address&#41;object;
buffer.put&#40;address.getAddress&#40;&#41;&#41;;
&#125;
&#125;</pre><p> So now you&#039;ve got this serializer, and you don&#039;t know what to do with it. Well, you need to register it to a class, and what other class would you want to register it to, than Inet4Address?</p><pre>Serializer.registerClass(Inet4Address.class, new Inet4AddressSerializer());</pre><p> And now you can use the Inet4Address anywhere in a Message! Now we&#039;ll test this Serializer, and see if we can get the IP on the other side:</p><pre>public class AddressMessage extends Message &#123;
public Inet4Address addr;
public AddressMessage&#40;Inet4Address addr&#41; &#123; this.addr = addr; &#125;
&#125;
...
client.send&#40;new AddressMessage&#40;Inet4Address.getByName&#40;&quot;google.com&quot;&#41;&#41;&#41;;</pre><p> Results in a message being received, which prints out as:</p><pre>/66.102.13.106</pre><p> And there you go, that&#039;s the end of this tutorial!</p><p> Next tutorial you&#039;ll learn about a simple, but powerful feature - compression.</p></div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/spidermonkey:tutorial:serializing?do=export_xhtmlbody">view online version</a></em></p>

@ -1,22 +0,0 @@
<h1><a
name="service_system">Service system</a></h1><div
class="level1"><p><p><div
class="notewarning">This article covers a deprecated <acronym
title="Application Programming Interface">API</acronym>! See <a
href="/com/jme3/gde/core/docs/jme3/advanced/networking.html">networking</a> for current documentation.</div></p></p><p> The service system is meant to create a common way of using plugins. It is a tiny system, on Server and Client level. In this tutorial I&#039;ll tell you how to use services, and how to create your own.</p></div><h3><a
name="creating_services">Creating services</a></h3><div
class="level3"><p> Creating services is really easy - you just have to implement the Service interface. <strong>Make sure you don&#039;t do anything time consuming</strong> since the developer may not be expecting it. Services can choose to support Server, Client, or both. To implement this, use the appropriate constructors:</p><pre>public class MyExampleService implements Service &#123;
public MyExampleService&#40;Server server&#41; &#123;
// By adding the constructor with the Server as argument, this service
// now supports servers.
&#125;
&nbsp;
public MyExampleService&#40;Client client&#41; &#123;
// Same goes for client. I could just leave this constructor out, and
// SpiderMonkey would determine this service does not support client mode.
&#125;
&#125;</pre></div><h3><a
name="using_services">Using services</a></h3><div
class="level3"><p> The Server and Client class both have a method called getService(). It retrieves a service based on class name, and instantiates it if necessary. From there you can use the service.</p><p> The Service system is not a terribly powerful system, neither does it do safety checks and service management - it just provides a way to commonly manage extensions.</p><p> That&#039;s it! Next tutorial we&#039;re going to have a look at how to use the streaming <acronym
title="Application Programming Interface">API</acronym>.</p></div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/spidermonkey:tutorial:services?do=export_xhtmlbody">view online version</a></em></p>

@ -1,26 +0,0 @@
<h1><a
name="streaming_service">Streaming service</a></h1><div
class="level1"><p><p><div
class="notewarning">This article covers a deprecated <acronym
title="Application Programming Interface">API</acronym>! See <a
href="/com/jme3/gde/core/docs/jme3/advanced/networking.html">networking</a> for current documentation.</div></p></p><p> The streaming service is meant for situations where you want to transfer files, or other types of data to clients. In this tutorial we&#039;ll discuss how it works, and how to use it.</p><p> Let&#039;s start off with how it works; streaming service uses messages to transfer data. This is done so it doesn&#039;t block other messages from being sent, while transferring. First a message is sent the describes the stream. The peer can now choose whether to accept or reject the stream. When the peer accepts, the data will be sent. You have to handle this data yourself. At the end of the stream you get the same message as when the stream was offered, to indicate the end of the stream.</p><p> Let&#039;s transfer a file to a client:</p><pre>StreamingService sService = client.getService&#40;StreamingService.class&#41;;
sService.addStreamListener&#40;this&#41;;
&nbsp;
sService = server.getService&#40;StreamingService.class&#41;;
Client receiver = server.getConnectors&#40;&#41;.get&#40;0&#41;; // Note that you can't use 'client' here, since it's not a connector.
sService.offerStream&#40;receiver, new StreamMessage&#40;&#41;, new FileInputStream&#40;&quot;test.txt&quot;&#41;&#41;; // StreamMessage used here as start and end message, but can be anything to describe the stream on the other end.</pre><p> As you can see, this system uses the Service system. First, we get the client&#039;s StreamingService, and register ourselves as a listener. Then we get the server&#039;s version of the StreamingService, from which you can stream things. Then we get a connector client (the first one), and send the file via an InputStream.</p><p> Now to receive this stuff is simple;</p><pre>public boolean streamOffered&#40;StreamMessage message&#41; &#123;
// Here you'd normally check the message what this stream is all about, and
// base your acception criteria on that.
fileStream = new FileOutputStream&#40;&quot;test.txt&quot;&#41;;
return true; // Sure, we'll just accept this message.
&#125;
&nbsp;
public void streamDataReceived&#40;StreamDataMessage message&#41; &#123;
fileStream.write&#40;message.getData&#40;&#41;&#41;;
&#125;
&nbsp;
public void streamCompleted&#40;StreamMessage message&#41; &#123;
fileStream.flush&#40;&#41;;
fileStream.close&#40;&#41;;
&#125;</pre><p> That was all; simple right?</p></div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/spidermonkey:tutorial:streaming?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long

@ -73,6 +73,7 @@ jme3:advanced:material_definitions,\
jme3:advanced:materials_overview,\
jme3:advanced:mesh,\
jme3:advanced:monkey_zone,\
jme3:advanced:motionpath,\
jme3:advanced:mouse_picking,\
jme3:advanced:multiple_camera_views,\
jme3:advanced:multithreading,\
@ -91,6 +92,7 @@ jme3:advanced:post-processor_water,\
jme3:advanced:ragdoll,\
jme3:advanced:read_graphic_card_capabilites,\
jme3:advanced:remote-controlling_the_camera,\
jme3:advanced:save_and_load,\
jme3:advanced:shape,\
jme3:advanced:sky,\
jme3:advanced:spatial,\

Loading…
Cancel
Save