Monday, June 16, 2008

Just playing around

Today, I decided to take a little break from coding and explore some of the other projects in the Thousand Parsec universe.

Quite a few of the GSOC projects (the two AI projects and the server configuration project) focus on allowing TP to be played by a single player. This is very exciting and I'm already envisioning creating a coffee-break ruleset similar to strange adventures in infinite space. :)

After reading through the list, I wanted to try out some of the rulesets, particularly Risk as it has a playable version available already. Unfortunately, due to my noobishness in gcc compilation I was unable to get the git version of tpserver-cpp (where all the rulesets are stored) working. What I tried instead was to copy the risk folder over to my working tpserver 0.5 directory and compile it instead. This seemed to work at first:

The screenshot shows the client connected to a server running the risk ruleset. Unfortunately, I could not seem to get the game working properly, as it did not assign me any planets or ships to start with. This problem also existed in the tpwx client, so I suppose the ruleset requires the latest tpserver in some manner.

Slight disappointment aside, I spent the latter part of the day looking at how I could improve the frame rate of the client somehow. The base fps on the client is very low, and even when the screen is not showing anything (all objects are culled) the framerate is clipped at around 40 fps. I found the bottleneck to be the starry background code, once I commented it out the framerate became about 99 fps (still without looking at anything).

Level of detail, in which objects reduce their polygon count as the camera becomes further, was another technique I wanted to apply. Thankfully, this turned out to be easy as I simply had to run OgreMeshUpdate (a program bundled with Ogre) on the models I wanted. After trying a few options, the framerate went up to about 15-16 fps. After a while I noticed some corruption in the model skin due to polygon reduction.

What I did was to tweak the distance levels so it only reduces when really far. I guess someone who can see at the pixel level might still notice it though.

After that, I rebooted in Windows to try creating a binary using py2exe. Since the script was already written, packaging it was not difficult but what I did notice was a tremendous boost in fps when I ran the client.

Here's a "action-packed" shot of the client connected to the demo tp server. With 6x anti-aliasing and 1280x1024 resolution, it still has better fps than the linux version. Wow, windows is great! Actually, the cause of the difference is probably my linux drivers. Since ATI has abysmal driver support, I'm running the open-source drivers which are slower in 3d performance but at least they work. (ATI drivers give me graphical corruption even when browsing the net or openoffice)

Here are my relevant system specs consisting pretty much of last-gen hardware.

Processor: Can't remember the model, but windows reports it as a 1.3 ghz Athlon.
RAM: 1 gig. I thought it was overkill when I first bought it.
Video card: Radeon 9800 Pro. I'll get Nvidia next time.
Motherboard: Nvidia nForce-2. Irony?

5 comments:

Anonymous said...

You are doing a great work here, I'm really waiting to see what all this looks like at the end of the summer ;-)

BTW, all that ATI vs Nvidia thing. I wouldn't get a Nvidia next time, ATI has improved their drivers lots in the last year or so and they have opened up their specifications so this is helping develop the open source driver.

mithro said...

Jphr has commented on the Risk problems you where having.

tpserver-cpp from git should be trivial to compile on Linux, you can find out how to do on the wiki. If you want to recompile tpserver-cpp after doing an git update, make sure that you re-run autogen.sh.

If you have any other problem, make sure you report it!

mithro said...

Jphr also left a comment on planet-soc.

I have included it below so it doesn't get lost,


Thought something looked familiar
I was browsing my news reader when I saw a 4 star configuration that look really odd. As soon as I saw it was TP I realized it was MY 4 star test configuration. And here I am now!

Glad to hear you wanted to give Risk a try with your client. I’d be glad to help you get your git working correctly to try Risk out (and I will be doing the same with your client to see how it works for me!) I’m going to just pretend you don’t have any repository cloned, and give you a command run down of ME setting up my own repo to work with:

git clone git+ssh://USERNAME@git.thousandparsec.net/git/tpserver-cpp
cd tpserver-cpp
git branch -r #To check out the correct name of remote branch
git checkout —track -b risk origin/risk
git pull

Generally this will get me up and running to work on my repo, try it out. I’ll leave another comment once I try your client out on my server :P.

P.S. - Since the map is so small, and I haven’t updated the quickstart-risk.conf file, you should start the server with the config file in modules/games/risk called testing-risk.conf. Since it is seeded you should get planet’s gamma and delta assigned to you. Move and Reinforce work, Colonize doesn’t (and I’ll be adding some options this week so it won’t show up all the time when it shouldn’t)

Tyler S said...

Various (and admittedly very sleep deprived) thoughts and comments from another TP mentor/dev, xdotx.

A 50ms frame time is worrisome, especially if it's the best-case scenario. It doesn't look like you're doing anything complex(?) Something seems very wrong.

"What I did was to tweak the distance levels so it only reduces when really far"
- This is very appropriate (and common) for dynamic LoD.

"With 6x anti-aliasing and 1280x1024 resolution, it still has better fps than the linux version. "
- 6x AA? That's FSAA via mutlisampling I assume? And 6... buffers? or 6 samples?

I can empathize with the radeon 9800 driver support in linux. I had good experience with the card in windows and it's great for the price; so, I used it when building a computer for my friend. Then to my surprise she wants linux as a dual boot option, and well, yeah...

PS: watch you're frame TIME, not rate. FPS is a poor indicator of performance. Briefly, frame time is linear, FPS is not.

PPS: did I not say this was really cool? cus it definitely is.

Eugene Tan said...

Thanks for the encouragement guys.

> BTW, all that ATI vs Nvidia thing. I wouldn't get a Nvidia next time, ATI has improved their drivers

While ATI's drivers are certainly better than the old ones, I'm also curious to see how Nvidia runs, I love testing hardware :)

> If you want to recompile tpserver-cpp after doing an git update, make sure that you re-run autogen.sh.

That command always gives me problems, I've only managed to compile the release version which comes with the configure script already. I'll try it with Ubuntu again and see how it goes, I've chalked up all problems encountered so far to Archlinux which usually runs bleeding edge software.

> P.S. - Since the map is so small, and I haven’t updated the quickstart-risk.conf file, you should start the server with the config file in modules/games/risk called testing-risk.conf.

Thanks for the help! I can display the commands now.

> A 50ms frame time is worrisome, especially if it's the best-case scenario. It doesn't look like you're doing anything complex(?) Something seems very wrong.

I appreciate this tip, having such a frame time does make it difficult to add new stuff. I guess I'll concentrate on playable features for now, then come back to the graphics again with a proper profiler.

> - 6x AA? That's FSAA via mutlisampling I assume? And 6... buffers? or 6 samples?

Samples