3D game engine for networked world simulation / AI sandbox

More than 5 years ago I was playing with DirectSound and Direct3D and I found it really exciting although it took much time to get some good results with C++. I was a college student then. Now I have mostly enterprise development experience in C# and PHP, and I do it for living. There is really no chance to earn money with serious game development in our country. Each day more and more I find that I miss something. So I decided to spend an hour or so each day to do programming for fun.

So my idea is to build a world simulation. I would like to begin with something simple - some human-like creatures that live their life - like Sims 3 but much more simple, just basic needs, basic animations, minimum graphic assets - I guess it won't be a city but just a large house for a start. The idea is to have some kind of a server application which stores the world data in MySQL database, and some client applications - body-less AI bots which simulate movement and some interactions with the world and each other. But it wouldn't be fun without 3D. So there are also 3D clients - I can enter that virtual world and see the AI bots living. When the bot enters visible area, it becomes material - loads a mesh and animations, so I can see it. When I leave, the bots lose their 3d mesh bodies again, but their virtual life still continues.

With time I hope to make it like some expandable scriptable sandbox to experiment with various AI algorithms and so on. But I am not intended to create a full-blown MMORPG :D

I have looked for many possible things I would need (free and open source) and now I have to make a choice:

  • OGRE3D + enet (or RakNet). Old good C++. But won't it slow me down so much that I won't have fun any more?

  • CrystalSpace. Formally not a game engine but very close to that. C++ again.

  • MOgre (OGRE3D wrapper for .NET) + lidgren (networking library which is already used in some gaming projects). Good - I like C#, it is good for fast programming and also can be used for scripting.

  • XNA seems just a framework, not an engine, so really have doubts, should I even look at XNA Game Studio :(

  • Panda3D - full game engine with positive feedback. I really like idea to have all the toolset in one package, it has good reviews as a beginner-friendly engine...if you know Python. On the C++ side, Panda3D has almost non-existent documentation. I have 0 experience with Python, but I've heard it is easy to learn. And if it will be fun and challenging then I guess I would benefit from experience in one more programming language.

  • Which of those would you suggest, not because of advanced features or good platform support but mostly for fun, easy workflow and expandability, and so I can create and integrate all the components I need - the server with the database, AI bots and a 3D client application?


    If you like python, there are bindings for Ogre. Check out python-ogre. I have used it a little bit and it seemed stable enough to be used. However you will encounter the occasional bug as the user base is not that big.

    I have more experience with plain C++ Ogre, which I enjoy using a lot. I don't think it will slow you down that much. It looks like your project could scale to a pretty big level, and you will need a lot of performance to do that. In this case C++ is never a bad choice.

    Anyway once the engine is done, it's pretty much all about scripting. And you could do that in a high level language if you wanted.


    I've only used XNA, so I can't really give you a good comparison to the others. I will say that while XNA is just a framework, TorqueX 3D is an engine. You get access to the TorqueX 2D and 3D engine binaries when you sign up to develop for XNA ($100/year).

    I haven't worked with the 3D engine, but I have used the 2D engine. I will say that the documentation on the API can be a little sparse, but they have some really good introduction tutorials and a fairly helpful and active forum for questions that aren't answered by the tutorials.

    Your experience with C# will obviously come in very handy. You'll have to stick to Windows development though, because you won't have access to the network stack (or database) on the Xbox 360.

    Once I worked through the tutorials and got used to Torque's style, I found it to be pretty fun to work with. It's very easy to add objects/behaviors. Sound support has been improved and made really simple with some of the XNA framework's latest releases. It has a good editor for 2D, and I think the 3D editor is decent as well (haven't really tried it) to help you get started creating levels. I guess it's lacking in the network/database department though, you'd have to use the standard .NET stuff or bring in other libraries to work with.

    I think it would be worth your time to take a look at it anyway and compare it to the others. I believe you can download a free (30 day) trial even without signing up for XNA if you want to play around with it. Good luck!


    Panda3D looks to have promise since it has a way to modify meshes at runtime (this feature is lacking, buggy or otherwise difficult to use in many 3D engines) which would be what you need for interactive client-side mesh changes recorded by a common server. In your database be sure to include a timestamp on modifications so you can run appropriate queries to generate patches for clients to get update mesh information as it is altered.

    using InnoDB you could make tables something like my SQL is probably off but this gives the idea:

    create table `vertex` (
      `id` bigint(15) not null auto_increment,
      `when` timestamp default now() not null,
      `x` number not null,
      `y` number not null,
      `z` number not null,
      `cR` number default 0.0 not null,
      `cG` number default 0.0 not null,
      `cB` number default 0.0 not null,
      `cA` number default 1.0 not null,
      `u` number default 0.5 not null,
      `v` number default 0.5 not null
    ) primary key (id) ENGINE=InnoDB;
    
    create table triangles (
      `p1` bigint(15) not null references (vertex.id) on delete restrict on update cascade,
      `p2` bigint(15) not null references (vertex.id) on delete restrict on update cascade,
      `p3` bigint(15) not null references (vertex.id) on delete restrict on update cascade,
      `when` timestamp default now() not null
    ) primary key (p1,p2,p3) ENGINE=InnoDB;
    

    id is vertex id when is timestamp allowing you to make update patches x,y,z is the 3d vertex point cR,cG,cB,cA is RGBA vertex color u,v is vertex texture coordinate p1,p2,p3 refer to the vertexes in the vertex table to form triangles as indicated by those foreign key references... InnoDB lets us prevent undefined vertex (ie: consistency) related issues so may as well use it. If it is acceptable to remove all triangles with a deleted vertex in your situation change 'restrict' to 'cascade' (restrict makes it an error to delete a vertex with triangles that use it)

    As for the bot mesh algorithm, basically you are implemententing an LOD cull for bots not in view. Many engines are already able to do this for you already. For instance all the bot's skinning/animation meshes can be made children to the bot's outer object in Panda3D and the if the bot's outer object is culled out of visible scope then none of the children are referenced at all.

    链接地址: http://www.djcxy.com/p/17104.html

    上一篇: 退出程序时抛出异常(Ogre3d)

    下一篇: 网络世界模拟/ AI沙盒的3D游戏引擎