Stendhal code design: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Chad3f No edit summary |
imported>Hendrik Brummermann No edit summary |
||
| (216 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
{{Stendhal code design}}{{Navigation for Stendhal Top|Developing}}__NOTOC__ |
|||
This page gives a little overview about the Stendhal code. |
|||
== Development Environment == |
|||
Stendhal is completely open source. So you can [http://arianne.sourceforge.net/download/stendhal-src.tar.gz download the source code] and have a look. If you plan to modify it and contribute to the project, we suggest that you use the Eclipse IDE and checkout the latest development state from our version control system. |
|||
== Client == |
|||
There are good [[Configure a development environment (IDE)|tutorials]] to get you started with Eclipse. |
|||
=== Entities === |
|||
== Finding your way around the Code == |
|||
Entity's are created using '''EntityFactory.createEntity()''': |
|||
The next step is to find your way around the code. The Stendhal code base is roughly divided into the server, client and a little code that is used by both: |
|||
RPObject object = ... |
|||
| ⚫ | |||
Entity entity = EntityFactory.createEntity(object); |
|||
| ⚫ | |||
// Done with entity - free up resources |
|||
entity.release(); |
|||
* [[Finding your way around the Stendhal Server Code]] |
|||
* [[Finding your way around the Stendhal Client Code]] |
|||
* [[Finding your way around the Stendhal Web Client Code]] (early development) |
|||
=== Sound System === |
|||
== Coding Standards == |
|||
We try to follow [http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html SUN Java code convention], in order to create code that feels familiar to many developers. |
|||
Despite this: |
|||
== Server == |
|||
* We use tab for all indentation. (One tab is equivalent to 4 spaces for display purpose.) |
|||
* We do not stick too closely to line length. |
|||
* We always use blocks in if-statements and loops, even if the block only consists of one single statement: |
|||
<code> |
|||
if (condition) { |
|||
method(); |
|||
| ⚫ | |||
</code> |
|||
Avoid evaluation and assignment in the same line like: |
|||
* ternary operators, for example in: |
|||
<code>String y = x==null ? "NULL": x.toString();</code> |
|||
* post-increment/decrement operators as in: |
|||
if (idx++ == 10) { |
|||
| ⚫ | |||
} |
|||