Crystal Space
Welcome, Guest. Please login or register.
September 21, 2017, 01:26:30 pm

Login with username, password and session length
Search:     Advanced search
9054 Posts in 2047 Topics by 73919 Members
Latest Member: Delmuro21669
* Home Help Search Login Register
  Show Posts
Pages: 1 [2] 3 4
16  Crystal Space Development / Support / Re: CS and RakNet on: November 19, 2007, 11:52:25 pm

Conceptually, if you want to syncronize the position of a player, the position is the relevant state, and it is irrelevant to the synchronisation part how this state is updated. In case of a keypress, it is the new position of the object that is send to the server, and not the keypress.

you could define a function tick() that is called in the CS ProcessFrame() method of the csApplicationFramework based application.
  p = rakPeer->Receive();
  if (p)
In this way RakNet execution occurs once per frame.

This does not seem to be right. Suppose if I have 100 FPS this would mean I am sending 100 packets per second. Moreover, besides sending packets I also need to read input from network etc, so doing anything each frame is generally a bad idea and would quickly hang up my application.

Looking at the iPcLinearMovement interface in CEL API you'd see that it exposes UpdateDR() for DeadReckoning. I am wondering if this can somehow be used ?
Any ideas?

The Raknet::ReplicaConstructor based class is responsible for ghost object creation.
When the position of a player has changed as result of a keypress, this has to be told to the RakNet::ReplicaManager:
replicaManager.SignalSerializeNeeded(player, UNASSIGNED_SYSTEM_ADDRESS, true); // UNASSIGNED_SYSTEM_ADDRESS, true means everybody

Yes, but again, "where" and "when" in the code should we send the packets to ReplicaManager? Sending in ProcessFrame() is not right so it has to be done someplace else.


P.S. BTW, do you know that Sun has now released the source for SGS/DarkStar server and client. I downloaded and went through the manuals, but as its all Java-based it does not suit me.

17  Crystal Space Development / Support / CS and RakNet on: November 12, 2007, 12:58:21 pm

I could'nt find a better forum to start this thread, so here it is.

Networking support in CS is probably an issue for many games/applications being developed.
I intend to use RakNet for networking and would like to know how many other projects (if any) are using or have used RakNet.

If you could provide any advice, helpful hints, code samples, tutorials etc. I'd be greatful and this thread would then help all others in future to implement RakNet.

As I go through implementing RakNet, I'd also continue updating this thread with my experience so others could get a quick-start.

18  Crystal Space Development / Support / Re: Problem with integrating "Torque Network Library" on: November 12, 2007, 12:39:54 pm
i don't agree on that, RakNet is by itself not scalable such that is can be used for MMORGs, SGS on the other hand is designed with this in mind. In terms of "efficiency and speed", RakNet looks stronger.

Humn.. thats interesting. I must admit I practically know nothing about SGS so not in a good position to compare, but I'd be nice if you could perhaps point out some concrete reasosn why SGS should be more suitable for MMORPG. Also, is "speed and efficiency" not one of the key requirements for an MMORPG┬┤?

Anyway, to be more constructive, i can tell that i'm very pleased with the RakNet solution. I started studying the ReplicaManagerCS example of the SDK, which is a good example to get an overview. Basicaly, you derive your "synchronised class" from RakNet::Replica. After establishing a connection with your server application (in case of an client-server approach), the server can (as an example) instantiate the "synhcronised object", all connected clients will receive this "event" such that the "ghost" objects can be created. When one of the clients upates its "local gost", all other gost will be synchronised. The "syncronised class" contains just the state that needs to be synchronised, for example, a CS actor object will be connected to a "synchronised class" such that only the relevant state will be syncronised, you do not want complete object synchronisation, because this is redundant and thus inefficient. Ofcourse there are all kinds of details, but basically this is how it can be used.

Incidently, I also just now finished reading the RakNet manual. If I'd had my own messageloop it seems simple how to integrate with RakNet. But how exactly to pass the events to CS Run() loop or actually vice-versa.. for instance at this stage I'm not clear at all on how would I catch an onKeyboard event and send it to server (for instance to replicate player movement).
Simply means I need to look more into CS event handling Smiley

The syncrhonisation part of the project is not confidential, so i can share the corresponding class structure soon (i quite busy getting my application ready..)

This would be great and probably help me much to start off with using RakNet in my CS solution.


19  Crystal Space Development / Support / Re: regions, sectors and memory allocation... on: November 12, 2007, 11:58:49 am
Ah yes, now I got it right and it seems so very logical, thank you Smiley

I am indeed very interested in the terrain2 plugin as it seems to be doing quite what I need.

Actually, my application requires rendering enormous terrains and during my research into this I had read the ROAM (Real-Time Optimal Adapting Meshes) papers presented by Mark Duchaineau et. al and more recently I got my hands on the book  "Real-Time 3D Terrain Engines" by Greg Snook which shows another implementation of ROAM to generate truly enormous but memory-efficient terrains.

I have briefly looked at the CS terrain2 plugin and if I am not mistaken it seems to be following pretty much the same algorithms. So as soon as I get past some basic things I am working on atm I'd be looking into using terrain2 instead. Thanks again!

20  Crystal Space Development / Support / regions, sectors and memory allocation... on: November 12, 2007, 11:22:52 am

here is the problem description:

1. I need to represent terrain which is approx. 16000 meters x 16000 meters.  In the xml world file, I create a sector "room" and then use a heightmap to generate the terrain. So far so good. But it seems ridiculous to load an entire terrain of this size into memory, so a more efficent way would be, lets say, divide the terrain in a 2x2 grid, total of 4 sectors and load/unload them dynamically as needed. Problem is the fact that a "region" is supposed to be the smallest logical unti that can be dynamically loaded/unloaded. So I can have 4 regions, each containing one part of my terrain as sector00 OR sector01 OR sector10 OR sector11 and load/unload the region dynamically. Would this be the right way to do this?

2. But then comes the second problem. On each part of terrain (which is itself a sector) I need to load hundreds of buildings, each having many sectors. How could this be achieved? Can sectors be "nested" ? Or should the terrain not be a "sector" in the first place?

As you can see, I am rather confused Smiley

Any help would be highly appreciated.

21  Crystal Space Development / Support / Re: Problem with integrating "Torque Network Library" on: November 09, 2007, 06:29:09 pm
Well, that sounds like a good start Smiley

If the nature of your work is not confidential or copyrighted, I'd be very interested to look at your class structure, so perhaps we could use it as a starting point.

I do think though that either of these libraries are by themselves neither optimised for MMORPGs nor for FPS, these are just plain network libraries. The ability to support large number of players in MMORPG is usually implemented through various algorithms and techniques such as server-side extrapolation and so on. Since raknet handles UDP well it seems quite an appropriate base on which one could develop either an FPS or an MMORPG. Supporting mobile devices is certainly another issue.

I need to implement a very efficient client-server solution myself and as I understand that is what you are doing as well, so perhaps lets just build a decent client-server solution with CS and raknet first and later we can see how to create communication plugins for CS.

Let me know what you think?

22  Crystal Space Development / Support / Re: loading sectors and objects seperately on: November 09, 2007, 12:17:18 pm
yes, this is where I really have a problem that I do not understand CS shaders well.
I have read everything about shaders what is in the manual but still unable to understand how exactly to use them or write own shaders.

Is there some place other than the manual where shaders are explained more?
For instance, there are a huge number of shaders in the /shader CS folder and I would really like to know what each one of these shaders does and how to use it.

Is there any place where such info can be found?

another question I have is regarding the efficiency of shaders. My application needs to be **very** efficient memory wise and processing wise, even if that means not having some cool graphic effects. so I need to know how the use of shaders compare against using just simple textures and materials? which way is more efficient memory wise and processing wise?

23  Crystal Space Development / Support / Re: loading sectors and objects seperately on: November 09, 2007, 11:30:23 am
Thank you very much. Loding with LoadMapFile ("raekoda", false) solved it.

So the application now runs, but the strage thing is that the box still does not appear in the level.
I have the start position set at 0,0,0 and the box should be somewhere around here but its nowhere to be found Smiley

I'll look more into it myself but if you got any idea I'd appreciate.

24  Crystal Space Development / Support / Re: loading sectors and objects seperately on: November 09, 2007, 10:15:12 am
Sure, here it comes:

<?xml version="1.0" encoding="utf-8" ?>

<!--*** initialization part ***-->
<!-- plugin section -->
    <plugin name="thingFact">crystalspace.mesh.loader.factory.thing</plugin>
    <plugin name="thing">crystalspace.mesh.loader.thing</plugin>
    <plugin name="genmeshFactory">crystalspace.mesh.loader.factory.genmesh</plugin>
    <plugin name="genmesh">crystalspace.mesh.loader.genmesh</plugin>
    <plugin name="terrainFact">crystalspace.mesh.loader.factory.terrain</plugin>
    <plugin name="terrain">crystalspace.mesh.loader.terrain</plugin>

<!-- texture specification section -->
    <texture name="grass.png">
    <texture name="grassDOT3.png">
    <texture name="basemap">
    <texture name="base_normalmap">

<!-- shader section -->


<!-- material specification section -->
    <material name="ScatterSky">
      <color red="0" green="0" blue="0" />

      <shadervar type='vector3' name="sky base color">0.0,0.1,0.2</shadervar>
      <shadervar type='vector3' name="sky sun-glow color">0.9,0.3,0.01</shadervar>
      <shadervar type='float' name="sky sun size">0.004</shadervar>

      <shader type="ambient">sky_scattering</shader>
    <material name="Base">
      <shadervar name="tex normal" type="texture">base_normalmap</shadervar>
      <shader type="ambient">splatting_scattering_base</shader>
    <material name="Grass">
      <shadervar name="tex normal" type="texture">grassDOT3.png</shadervar>
      <shadervar name="texture scale" type="vector2">16,16</shadervar>
      <!-- <shader type="diffuse">splatting_bump</shader> -->
      <shader type="terrain splat">splatting_scattering</shader>

<!-- sounds section -->

<!-- variable section -->

<!-- add-ons section -->


<!-- settings section -->


<!-- start locations section -->

    <position x="100" y="30" z="0" />
    <forward x="0" y="0" z="5" />
    <!-- <up x="0" y="1" z="0" /> -->

<!-- library section -->

<!-- keys section -->

<!--*** world elements part ***-->

<!-- mesh factories -->

  <meshfact name="skydome">
      <sphere rimvertices="64" reversed="true">
   <radius x="500000" y="500000" z="500000" />

      <scale x="8192" y="69" z="8192" />
      <materialmap image="/lev/terrain/materialmap.png" />

  <meshfact name="TerrainFact">
        <min x="-1024" y="-1024" />
        <max x="8192" y="8192" />                   

<!--*** world definition part ***-->

<!-- sectors -->

  <sector name="room">
    <light name="sun">
      <center x="500000" y="866030" z="0" />
      <color red="0.85903" green="0.80995" blue="0.70420" />

    <meshobj name="sky">
        <color red="0" green="0" blue="0" />
      <zfill />
      <camera />
      <polymesh> <colldet/> </polymesh>

    <meshobj name="Terrain">
        <lodvalue name="splatting distance">200</lodvalue>
        <lodvalue name="block resolution">16</lodvalue>
        <lodvalue name="block split distance">8</lodvalue>
        <lodvalue name="minimum block size">32</lodvalue>
        <v x="0" y="0" z="0" />


<!-- collections -->

<!--*** actions part ***-->

<!-- sequence section -->
<!-- trigger section -->


25  Crystal Space Development / Support / Re: loading sectors and objects seperately on: November 09, 2007, 10:05:52 am
ok, I tried in both ways and now its recalculating lights but I still see absolutely nothing other than flicker.

Here is my entire second world file (loaded after the first one).


    <texture name="Yellobrk.JPG"> <file>Yellobrk.JPG</file></texture>
    <material name="Yellobrk.JPG"> <texture>Yellobrk.JPG</texture></material>

  <sector name="room">
    <meshobj name="raekoda">
      <zuse />
      <v x="-13.0215" y="0.0" z="-15.0" />
      <v x="1.97853" y="0.0" z="-15.0" />
      <v x="-13.0215" y="0.0" z="15.0" />
      <v x="1.97853" y="0.0" z="15.0" />
      <v x="-13.0215" y="20.0" z="-15.0" />
      <v x="1.97853" y="20.0" z="-15.0" />
      <v x="-13.0215" y="20.0" z="15.0" />
      <v x="1.97853" y="20.0" z="15.0" />

      <p name="raekoda_1">      <v>3</v><v>2</v><v>0</v><v>1</v>
      <texmap><uv idx="0" u="0.0" v="0.0" /><uv idx="1" u="1.0" v="0.0" /><uv idx="2" u="1.0" v="1.0" /></texmap></p>
      <p name="raekoda_3">      <v>7</v><v>5</v><v>4</v><v>6</v>
      <texmap><uv idx="0" u="1.0" v="0.0" /><uv idx="1" u="1.0" v="1.0" /><uv idx="2" u="0.0" v="1.0" /></texmap></p>
      <p name="raekoda_5">      <v>5</v><v>1</v><v>0</v><v>4</v>
      <texmap><uv idx="0" u="1.0" v="0.0" /><uv idx="1" u="1.0" v="1.0" /><uv idx="2" u="0.0" v="1.0" /></texmap></p>
      <p name="raekoda_7">      <v>7</v><v>3</v><v>1</v><v>5</v>
      <texmap><uv idx="0" u="1.0" v="0.0" /><uv idx="1" u="1.0" v="1.0" /><uv idx="2" u="0.0" v="1.0" /></texmap></p>
      <p name="raekoda_9">      <v>6</v><v>2</v><v>3</v><v>7</v>
      <texmap><uv idx="0" u="1.0" v="0.0" /><uv idx="1" u="1.0" v="1.0" /><uv idx="2" u="0.0" v="1.0" /></texmap></p>
      <p name="raekoda_11">      <v>4</v><v>0</v><v>2</v><v>6</v>
      <texmap><uv idx="0" u="1.0" v="0.0" /><uv idx="1" u="1.0" v="1.0" /><uv idx="2" u="0.0" v="1.0" /></texmap></p>

    <light name="Omni01room">
      <center x="1.8824" y="30.7916" z="-25.372" />
      <color red="1.0" green="1.0" blue="1.0" />


The first file only has a terrain mesh object in the sector 'room' plus 'sun' light, and by itself works fine.

any ideas why this is not working?

26  Crystal Space Development / Support / Re: loading sectors and objects seperately on: November 09, 2007, 08:44:12 am
Thanks very much, it is interesting indeed.

However, now I seem to be having a problem with lighting.
It does not calculate lighting for the second file I load and keeps informing to use -relight but I don't have such a switch in my app.
Basically, when I do   engine->Prepare (); should it not recalculate all lighting itself?

In the second XML file I am using ambient light as follows:

    <ambient red="0.5" green="0.5" blue="0.5" />

Should this work or am I doing something wrong?

Many thanks again,

27  Crystal Space Development / Support / Re: New to this on: November 09, 2007, 03:14:35 am
hi, I was myself in similar situation when I started with CS, so nothing to worry about Smiley

The most important thing to understand is that Crystal Space is not a "gamiing engine". It's an SDK. A library that provides you a lot of ready-made ways to start writing 3d applications, so it saves a lot of time.

However, to actually start making a 3d application of any kind, it would be best to start with learning 3d design concepts.
You can learn some of the concepts from the crystal space manual, but it is not really intended for this purpose.

Assuming you are a biggener to 3D, I would suggest the best way would be to get a good openGL or directX book and take some time to read it through.

While there are many books to choose from, a very good biggener level book is "DirectX9 Graphics The Definitive Guide to Direct3D". (

The fact that its about directX does not make any difference as it explains the 3d design and programming concepts in the most user-friendly way I have ever seen.
Otherwise just use google and find some 3d tutorials Smiley

Afterwards, read the CS manual and you will be writing games in no time.

28  Crystal Space Development / Support / Re: Problem with integrating "Torque Network Library" on: November 09, 2007, 02:53:20 am
Instead of trying to solve the specific problem, i threw TNL aboard and continued with RakNet, which is one of the other network libraries...
I think it would be a good thing to have a SGS-plugin (or another OpenSource networking library, but there are not that many) for CS.

Hi rvhaasen,

Are you working or intend to start working on a raknet plugin for CS?
I am personally very interested to develop a raknet plugin for CS and have been looking into it for some time.
I have not started any coding yet but have been familiarizing myself with multithreading in CS.

If you are interested we could perhaps collaborate on this?


29  Crystal Space Development / Support / loading sectors and objects seperately on: November 09, 2007, 02:27:11 am

I have a simple Crystal Space C++ application which loads a map from an XML World file with one sector "room" which is basically just terrain.
Is there some way to load objects to the same sector from another file?

So for instance, in the first XML file we have the sector "room" which contains the entire terrain but nothing else.
Lets we want to place 10 different objects on this terrain.
The usual way would be to define all the factories textures, materials and genmesh objects within the first World file.
But is it possible to have the factories, textures, materials and meshobject definitions in a "second" file and load them into the same sector "room" which was defined in the first file?

If yes, could someone please provide some hints or link to some code which shows how to do this?

Many thanks in advance.

30  Crystal Space Development / Support / help with sound plugin on: November 09, 2007, 02:16:41 am
Hi, need some help on sound plugin. I'm using CS 1.2 branch, winlib_1.2_002 and C++ 7.1 aka VS.Net 2003.

I have a simple Crystal Space C++ application which loads a map from XML world file with multiple sectors and I am able to play a background music by looping a .wav file from the C++ code.

I need to play a different music for each different sector and ideally would like to load the music from the XML world file and not have it hard-coded in the app.

Could anyone provide some hints or point me to some sample code or examples on this?

Many thanks in advance.

Pages: 1 [2] 3 4
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 9.173 seconds with 16 queries.