SC4 Devotion Forum Archives

Other City-Building Games => Other games => [Archived] CityMania - Open Source Sim City => Topic started by: Nique on January 21, 2010, 04:32:42 PM

Title: Researching Engines
Post by: Nique on January 21, 2010, 04:32:42 PM
Hi there,

Where the others are still programming and doing stuff, i'm trying to find out if there are 'shortcuts' to create something to start with. I've found Unity3d.
This 3d, sound+video+gui for Windows And Mac looks great. There is still a problem with Linux while the whole engine/program itself was written with Mono (a .NET for linux).

Anyway, i hope you guys can take a shot and see how it works/feels. i have some good feelings about it because can give us a huge, huge step forward.

http://unity3d.com/

This toke me 5 minutes to create:
http://dl.dropbox.com/u/552137/Unity/terrainTest/Game.rar
(arrow keys to move around and plus/minus on your numpad board to go up/down)
Title: Re: Researching Unity3d (engine and devIDE)
Post by: croxis on January 21, 2010, 06:11:37 PM
Lack of linux support is a major issue with me, as that is the OS I program in :P

For reference, I am placing the ETA on my next prototype for this Sunday.
Title: Re: Researching Unity3d (engine and devIDE)
Post by: toberas on January 22, 2010, 03:10:50 AM
 :thumbsup: drumroll
Title: Re: Researching Unity3d (engine and devIDE)
Post by: Nique on January 22, 2010, 09:35:48 AM
And what about UDK ? (Unreal Development Kit (http://www.udk.com/index.html)) (we could maybe use the old UDK, it's supporting Linux and all of it). Its not i want to throw away stuff you guys made already, i'm just thinking about skipping steps we normaly should take by making a new game. I'm just putting my nouse in the wild bushes to scout..  :)
Title: Re: Researching Engines
Post by: tomkeus on January 22, 2010, 04:04:43 PM
Unreal wont cut it because it provides only the scripting language, and the engine itself is created primarily to serve FPS games.

What I usually try to convey in engine related discussions is that city simulator is very atypical case of the game, where conventional wisdom just wont work. We have huge amounts of geometry that changes over time. Doing graphics in any scripting language is a very bad idea. For each frame we will have to do aggressive LODing and efficient visibility determination and occlusion culling. Available engines do not offer appropriate solution because their visibility determination algorithms are usually designed for small to medium, primarily prebuilt scene graphs, compact in space, which are typical for most of the games out there so they all rely on some form of space partitioning into power of two parts and corresponding kd-trees.

Of course, we could use scripting, but we would have to limit ourselves only to small towns, or alternatively, we would have to sacrifice free camera and panoramic views.
Title: Re: Researching Engines
Post by: Nique on January 22, 2010, 04:36:34 PM
Quote from: tomkeus on January 22, 2010, 04:04:43 PM
Unreal wont cut it because it provides only the scripting language, and the engine itself is created primarily to serve FPS games.

What I usually try to convey in engine related discussions is that city simulator is very atypical case of the game, where conventional wisdom just wont work. We have huge amounts of geometry that changes over time. Doing graphics in any scripting language is a very bad idea. For each frame we will have to do aggressive LODing and efficient visibility determination and occlusion culling. Available engines do not offer appropriate solution because their visibility determination algorithms are usually designed for small to medium, primarily prebuilt scene graphs, compact in space, which are typical for most of the games out there so they all rely on some form of space partitioning into power of two parts and corresponding kd-trees.

Of course, we could use scripting, but we would have to limit ourselves only to small towns, or alternatively, we would have to sacrifice free camera and panoramic views.

Ok, good one. So.. Panda3D is the best solution?
Title: Re: Researching Engines
Post by: tomkeus on January 22, 2010, 04:50:23 PM
Quote from: Nique on January 22, 2010, 04:36:34 PM
Ok, good one. So.. Panda3D is the best solution?

Panda3D certainly is a very complete solution, probably the most complete and well developed amongst the free engines, because it has experienced industry professionals working on it, but I'm not sure it is best suited to our needs and the reason is that there is almost no documentation on C++ API and doing things in Python, well, I explained in previous post. I'm struggling for almost a month to start doing something useful with Panda, but I get constantly bogged down by either having to wait for someone to answer me on the forum or by having to look into Panda's source code in order to understand what is doing what.

There is Irrlicht on other side, which imo by its structure suits us better (because it is more of a graphics engine than game engine), but I have lately got some suspicions about efficiency of its OpenGL implementation.

It is getting really frustrating for me, especially since my programming experience comes from computational physics, and I have zilch experience with 3D graphics, although my maths and physics knowledge helps a lot there. I am seriously thinking about giving up on the GUI work, and working only on the simulator.
Title: Re: Researching Engines
Post by: Nique on January 22, 2010, 05:38:01 PM
I spended almost all evening by reading Panda3D stuff. About the GUI thing, i think, we could just use panda3d's directGUI or implement the ceGUI  (http://www.cegui.org.uk)libraries. But im most flattered by the MyGUI (http://mygui.info/) libs (because of it's capabilities and speed). I didnt want to create some confusion here with my engine reviews, but i 'also' had some problems with Panda3D. We have to go through it. Once we understand (some basic) Panda3D things, working with it will be more easy.

I'm currently on a laptop, and installing visual Studio shell so i can install the python studio and installed NetBeans (python). I hope i get 'something' working from panda3d after this weekend... Even if it's a simple text render.. i just need 'something' (and nice) to get some motivation..

Title: Re: Researching Engines
Post by: croxis on January 22, 2010, 06:54:54 PM
tomkeus is quit right, there is simply not going to be an engine that is designed for a city builder. No matter what is done we are going to have to drag it kicking and screaming and a lot of hammering.

I believe there will be issues no matter what engine is chosen. I know very, very little c/c++ so it will be quite some time before I could be any use for the 3d engine.

I've poked a few people on the optimization topic and our biggest issue is going to be geom count and texture size. The latter is established as an issue, but the former is something we have not considered in great detail. Graphics cards even 4 years old can render millions of textured polygons on screen if they are part of the same geometry object. But put 6000 triangles, each their own geom (or mesh) and even the latest most expensive cards will come to a crawl. See this thread: http://www.panda3d.org/phpbb2/viewtopic.php?t=8135

Zoomed out there will definitely be a high numbers of separate buildings and roads. I know panda has means for combining meshes into one geom (NodePath.flattenStrong() with the python interface. As it is actually a collection of c++ functions I would have to look into the c code to figure out what it does. I guess that is why i like the engine, I am indirectly coding in c++ by using a python interface). In either case we will need to group geoms into one, but still be able to redo, or remake it if a building changes.

We are also getting hardware instancing is coming in 1.7.0 (being released in less than 24 hours according to rdb). See this blog post: http://www.panda3d.org/blog/?p=44
Title: Re: Researching Engines
Post by: Nique on January 23, 2010, 03:34:04 AM
Ok, sounds good, except for the individual objects rendering issue. As i said, i never did Python before so in the time i have, i try to learn something. Luckely i did already know some other script languages to understand this one faster.

My problem is about "Panda3D is not for beginners, its for professionals" (the guide said it). So i'm trying to understand the engine without being professional..
Anyway, i finaly got 'something' rendered to screen here  :P


from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", """
    window-title CityMania
    fullscreen 0
    win-size 1024 768
    cursor-hidden true
    show-frame-rate-meter true
""")

import direct.directbase.DirectStart
from pandac.PandaModules import TextNode,Point3,Vec4
from direct.showbase.DirectObject import DirectObject
from direct.gui.OnscreenText import OnscreenText
import sys

font = loader.loadFont("cmss12")

# Function to put title on the screen.
def addTitle(text):
    return OnscreenText(text=text, style=1, fg=(1,1,1,1), font = font,
                pos=(0,0), align=TextNode.ACenter, scale = .07)

class Game(DirectObject):
    def __init__(self):
        base.setBackgroundColor(0.22,0.22,0.22)
        self.accept("escape",sys.exit)
        self.title = addTitle("CityMania")

t=Game()

#Run app
run()


Gives me
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi45.tinypic.com%2Fsfv4vs.jpg&hash=200cd59cd771e4a9a17557d2bae3759b6e29a906)
Title: Re: Researching Engines
Post by: tomkeus on January 23, 2010, 11:51:18 AM
Quote from: croxis on January 22, 2010, 06:54:54 PM
We are also getting hardware instancing is coming in 1.7.0 (being released in less than 24 hours according to rdb). See this blog post: http://www.panda3d.org/blog/?p=44

I wouldn't get my hopes up on out of the box hardware instancing. It is not that simple especially for complex meshes.
Title: Re: Researching Engines
Post by: wouanagaine on January 23, 2010, 02:49:34 PM
Maybe a stupid question, but did you made a fake picture of what you expect to have on screen at which quality level and at which framerate ?

This will certainly help you eliminate a big number of engine



Title: Re: Researching Engines
Post by: Nique on January 23, 2010, 05:27:46 PM
We will have to do it with panda3d for now. I think there is no other (free) engine that can help us out with our ideas now. CityBuilding is not only just a 3d world... but lots of objects also have functionality in it. I am convinced that with Panda3D you can make beautiful graphics.. (you can make your own shaders etc). The picture u see above is not fake.. but the FPS counter is limited on 60fps (i guess).. or the game just doesnt render more than 60fps, i dont know
Title: Re: Researching Engines
Post by: croxis on January 23, 2010, 06:24:00 PM
It might be limited to your monitor's refresh rate as there is no point in going faster. You can disable this with a config setting to get true fps.
Title: Re: Researching Engines
Post by: Nique on January 23, 2010, 08:05:43 PM
indeed, of course, its a waste to render more frames than you monitor's refresh rate..  :D

But for now, i tested it by turning off sync-video
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi50.tinypic.com%2F24e2xc8.jpg&hash=15bdc43048e89b80f5dd38dc4c048dfaee9b52b6)