Panda3D 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 :smiley:

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 :frowning:

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. 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 8).

So the question is - would you suggest Panda3D, 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? Or maybe I should choose some other 3D engine+netwroking library combination?

Thanks for ideas.

Well, since you’re asking here, you are probably looking for info on how Panda would do for your project.
Given the background you provided, here’s how I see this working for you: take 1 week (7 hours) to understand panda3d and python. If you are expert in C it should be more than enough to start prototyping. I had little C experience but serious php+mysql experience and it was almost a breeze. Then plan something simple and do it by using existing models and maybe existing codebase here in the forums. This should be another 7 hours tops…
After that you will be hooked to using Panda3D and you can start working on your project.

I am in the exact same situation as you are, doing something completely different during the day and spending 1-2 hours daily on this hobby.
Panda3d is great as it can help you get results immediately once you got the hang of it, and you will quite rapidly move on to better and more complex things, and if you will never really release anything you would still get your daily dose of satisfaction :wink:

Thanks for sharing your experience.
I have no doubts that Panda 3D will be good for 3D part, but one thing makes me bothered - will I be able to implement also the networking part? I’ll use C# for game-world server and database access (it would be weird to use game engine for that, I guess :smiley:) and maybe also for AI bots which will run as separate applications (or separate threads in one application).

I looked into Panda3D docs - the chapter about Networking is really small, so I guess there are only some basic abilities. I hope, it will be enough to implement connections between AI bots, server, and 3D client application.

Someone correct me if I am wrong, but Panda’s network library is more intended for panda-panda communication. For something more framework neutral you will probably want to use sockets directly and either develop your own protocol or use something like Protocol Buffers, JSON, YAML, etc to assist.

Panda3D’s networking code should just do fine and is working the best, but if you really need to you can use Twisted (which I recommend second), which is a very good networking engine.

You might want to lookup “distributednode” and “distributedobject” on these forums if you want to use panda’s features, and “pydatagram” if you want to go one level down and python’s features.

Both work great, with low latency, and if implemented right they could be excellent for realtime game networking.

Have a look also at PodSixNet on the web, a lightweight and fast multiplayer game library which comes with two good examples and works with realtime precision.

Thanks for suggestions. I’ll jump into the Python then :slight_smile:

I’ll need to control server-side physics and AI bot scripts. Uff, then I’ll have some physics and networking libraries on server-side and Panda with its physics and networking on the client side.
Would be great to have Panda for a server side, too, but then I’ll have to split it in parts :unamused: Can I deactivate Panda 3D rendering and use just physics+networking for server?

Something like in this thread:

Has anyone tried Panda3D as a game server with physics+network+database ?

I have a working version somewhere (still running I believe) on one of my Gentoo servers in a remote data center. The game part uses the Panda3D libraries with no graphics, as X is not even built on that linux server.
I can connect just fine to that server and it would be playable if the game would playable :slight_smile:
As far as physics are concerned, I haven’t really used any advanced stuff, but all the physics part will be completely transparent as far as network communication is concerned. You transmit what you want, how you want it, and you just need to make sure stuff is in-sync and no suspect events or movements are happening. For prototyping I don’t care too much about cheating (I wouldn’t cheat myself, would I) and I guess if my non-existing project will ever have a chance to go mainstream I can worry about that part then.

And to answer your question: yes, you can easily deactivate rendering on the server side.
This is what I am using (also disable sound and tweak to make sure you don’t push your cpu load to 100%:

from pandac.PandaModules import loadPrcFileData 
loadPrcFileData("", "window-type none") 
loadPrcFileData("", "audio-library-name null")
loadPrcFileData("", "lock-to-one-cpu 0")
loadPrcFileData("", "client-sleep 0.000001")

but you also need to make sure the server code doesn’t “try” to render anything :slight_smile:

I am a beginner myself, but it seems you are walking in my footsteps just now, so I’d be happy to assist until you manage to overpass me :wink:

Thanks for really useful info.

I also was inspired by this article:

I looked into the source to see how much I can understand of Python, and actually it was pretty easy to understand how it works.

One thing that’ll be hard for me is indentation :smiley: I have used to C#/C++/PHP style with {} for scoping and complete freedom with indents, but in Python it is reversed - no scoping symbols, and strict indentation.
Anyways, it’ll be useful. Maybe some day my boss will say “Hay, I need someone who knows Python” and then I’ll have a chance to ask for salary increment :smiley:

Use PyPE as editor.
It helps you with the indentation and if you assign run to a function key you will get the python feedback in a PyPE window.