Archive for December, 2007

Further Netbeans notes

Friday, December 21st, 2007

Netbeans is working out well as an IDE. I was able to build a static library for RakNet in about 20 minutes including the learning curve. The UI is intuitive and I didn’t experience any bugs. It also automatically creates makefiles and is the first GUI based tool I have found that does so.

I did experience a few design problems. The first is that the C++ project settings don’t expose the C++ compiler settings the way Visual Studio does. Instead, you can pass command line options to GCC. Of course you could do that with Visual Studio too, but nobody I know does. Second, it makes a project directory, rather than a project file. This is bad because you can ignore files with unknown extensions, but directories you have to look at because directory names are not standardized. Lastly, it doesn’t have the concept of solutions with many related and interdependent projects. Because it uses project directories with a fixed name, you can only have one project per directory. The best you can do to emulate a solution is to make a bunch of subdirectories under a common parent directory, have each subdirectory contain a project file, and to just assume people will search for and find the project directories.

Other than this Netbeans is good, doubly so when compared to KDevelop and Eclipse. I’m going to try building the Galactic Melee server on Linux using Netbeans.

Netbeans is a good IDE

Thursday, December 20th, 2007

I installed Netbeans this morning and the interface is astoundingly better than KDevelop and Eclipse. I’m surprised anyone uses the other two with the difference in quality. It even had a real installer. I was able to run through the sample and actually run and debug a program! I’ll look at this more later tonight but it’s quite likely I will add a Netbeans based project for RakNet and use this for further Linux development.

Further Ubuntu notes

Wednesday, December 19th, 2007

For the last day or so I have been actively trying to code on Ubuntu. I took some notes on my experiences.

Ubuntu:

On bootup in order to get internet through the wireless network, I have to go to System / Administration / Network, open the Wireless connection properties, and retype my password every time. I believe what fixes the network is not that though but something internal to the the “Changing interface configuration” screen. The funny thing is that didn’t work this morning. Every other time I did this I already had my Windows XP computer already turned on (which uses a cable to the wireless router). As a guess I turned on Windows, tried again, and now I could connect to the internet. Is it an IP confict? Is Windows providing DHCP?

I like Synaptic Package Manager, it’s very nice having instant download access to so much software. However, it’s hard to tell what you are getting or where it installs to. For example, I installed subversion but I can’t find the executible svn when I search on disk so I don’t know how to start it as a server. I also installed Eclipse for C++ but it just seemed to have gotten some files, I couldn’t find an executible to run.

I like the update manager. It just works and works for every package as far as I can tell. This is an improvement over Windows.

Searching for files doesn’t seem to work. I figured out how to fix it by searching the bug reports. You have to change System / Preferences / Indexing preferences and install some package the name of which I no longer remember. People in the bug report were complaining about this and I agree with them.

Under Applications / Programming I have dead links to KDevelop and I don’t know how to get rid of them. I also don’t know how to add Evolution to the menu system, which I downloaded independently.

The application installer and update manager shouldn’t take focus away from what you are doing. It made me die while playing Chromium.

When I click switch desktop in the lower right gedit won’t stay on the desktop I left it on, but follows me to the new one. This is true even if I deselect it. The desktop icons also stay around.

I wish the File Browser had a button to open the Terminal at the current directory I am looking at.

gedit:

I like it! Much snappier than notepad but with more features.

Cmake:

I tried CMake on Windows. It seemed to me I’m just replacing one set of text commands with another set of text commands, when what I actually want is a GUI.

Evolution:

The reason Evolution didn’t work originally was g++ and various programmer packages were not installed. This should have been noted in an error message when trying to run it the first time rather than giving a cryptic message when you first try to compile. Better yet, it could have installed this automatically.

Evolution has a better interface than KDevelop but it’s an order of magnitude behind Visual Studio and not as good as the Windows interfaces to Code Blocks or Dev-CPP. It didn’t seem to make a project file like KDevelop does and didn’t modify or create makefiles as far as I could tell.

It took me about an hour to figure out how to add files to the project to get them to compile. It’s not intuitive to me to import a file system.

If you create the project in an existing directory, such as RakNet, it adds every file, not just source files or just the source files you want. You can exclude directories but if I exclude the root directory of Samples I can’t individually unexclude the sample sources I want. Also the icon indicating what is excluded is inconsistently shown. They should have just did it the way Visual Studio does, where I add the files I want and if I want to add a directory of files I type a filter for the filename (*.cpp) select them all and hit OK.

Once I copied the sample I wanted out of the excluded base Samples directory I was able to build. However, when I tried to run the application said it couldn’t find an executable. When I looked under /Debug there was an icon with the name of my project whose properties said it was an executible, but double clicking it did nothing. I gave up at that point.

In order to test my program I copied the sources to one directory and typed g++ *.cpp -l pthread and ran ./a.out and it worked. I knew to do this because I took a class on Linux in college.

Code Blocks:

I tried to install the nightly build of Code Blocks on Ubuntu 7.10. I got as far as installing the wxwidgets source and then the instructions got too complicated. I didn’t know for sure what steps I needed to do and I didn’t know if it was compatible with Ubuntu 7.10. I didn’t want to spend a lot of time guessing only to have it not work in the end. So I gave up.

KDevelop:

In KDevelop, if I hit Project / New Project there is no option for a static library. So I’m not sure how to make RakNet as a static library. The equivalent with g++ is three commands, assuming you are already at the RakNet download:

cd Source
g++ -c *.cpp
ar cq libRakNet.a *.o

So in KDevelop I tried selecting C++ / Automake project / Empty Autotools template and tried to place it where I have the RakNet download at present. But it wouldn’t let me as that directory already existed.

It took about 20 minutes to figure out how to add files to the project. It’s on the right side under Automake manager, which you can figure out as it’s a tooltip on one of the buttons. There is already one item in the listbox there (Header in noinst) but I have no idea what that is.

One of the buttons is to add a directory of existing files. This is good since I have RakNet/Source. In the dialog, unlike Eclipse, there is no filter to not add the the .o files, CMakeLists.txt, configure.ac, and some others. Rather than remove those one by one I deleted those files in the File Browser with the dialog still open in another window. However, this deletion didn’t get reflected in the dialog box. I hit cancel to do the process over again, but that crashed KDevelop. I gave up at that point.

Windows Vista is a big disappointment

Monday, December 17th, 2007

I was reading how PC World named Vista the #1 technology disappointment of 2007 and having used it I agree.

Performance: In my opinion the point of an operating system is to run your programs, and the OS should be as lightweight as possible. My new laptop uses a “AMD Turion(TM) 64 X2 Dual-Core Mobile Technology TL-66 (2.3 GHz, 512KB+512KB L2 Cache )” with “2GB DDR2 System Memory (2 Dimm)” and it is noticeably sluggish. Usable, but sluggish.

Compatibility: Right off I wasn’t able to install Visual Studio 2005. Plus, DX10 is not backwards compatible, which has already created hassles at work because all work needs to be done twice. On my own 3D engine I’m just sticking with DX9.

Security: Are you sure you want to do this? [Yes] Are you REALLY sure? [Yes] Absolutely sure? Your average user is just going to click yes 3 times in a row. It’s not like he’s going to click yes twice twice and then reconsider running “XXX girls now!”

DRM: Read this article

The only positive thing that I can think of over XP is I like how you can have multiple windows occupy the same slot in the task bar.

On the other hand, Ubuntu on my old computer, a 2 GHZ Athlon with 1 GB of memory, runs quite well. There are some delays due to the 5,400 RPM harddrive but I ran some of the games on it and they were fine. Ubuntu was easier to install and I think the interface is cleaner. I especially like that it automatically downloaded updated drivers and security packages for various programs. I also like that it’s open source – not that I want to contribute so much as that I can feel confident it doesn’t have malware or backdoors.

Once Ubuntu gets or I find a decent IDE, on par with Visual Studio, and Open GL is optimized to be as fast as DirectX I wouldn’t mind doing cross platform with all my games to it.

Ubuntu good so far

Sunday, December 16th, 2007

One thing I like about Ubuntu is the networking system is much better than Windows. To this day I still don’t really understand how to setup windows networks, but Ubuntu was able to connect to my Windows system almost automatically.

I also like the add/remove programs feature that downloads programs from the internet. It ought to automatically take care of dependencies though. When I got Eclipse for example it wouldn’t run because I didn’t have the java runtime environment.

I’m confused about Eclipse right now. When I created a project under the RakNet directory it automatically added every file there to the project. With Visual Studio you have to select the files to add. This seems bad to me, because it added non-source files.

It also won’t seem to build even if I create it in a clean directory.

I’m not sure what’s going on.

Got Ubuntu working

Sunday, December 16th, 2007

Two years ago when I tried installing Linux my audio, network, and video cards didn’t work. Now I tried again using Ubuntu 7.1 and everything worked except I couldn’t get on the internet until I figured out how to setup my wireless access. So this is good news, as it is the first time I’ve successfully installed Linux. It installed much faster than Windows and comes with Firefox, which I use over IE.

If I can keep this server running I will put subversion on it for source control, apache (?) to host my webpage for Galactic Melee, and then move the Galactic Melee server to that. It will save me $150 in hosting fees each month on be on a faster computer too.

Now I have to find an IDE equivalent to Visual Studio, meaning I don’t have to write makefiles, and I can trace and debug while running.

Wait on Windows Vista

Tuesday, December 11th, 2007

I got a laptop with Windows Vista last week. It wasn’t by choice, that was the only option offered. I got the laptop so I would be able to present my game to publishers in-person.

The first problem was that Visual Studio 2005 is not compatible, and simply won’t run. I downloaded Visual Studio 2008 Express. It wouldn’t install either, crashing during the install of the .net framework 3.5. I’m not sure why this is required, as I don’t use the .net framework, but at that point I was out of options.

I formatted the harddrive with XP instead. The problem now was that HP, the manufacturer of the laptop, doesn’t release video card drivers for my 128MB NVIDIA GeForce 8400M GS for XP. The Vista drivers won’t install. So I’m stuck with <1 FPS even for browsing the web with Firefox, and I’m sure my game won’t work either.

I put a clean install of Vista again and am going to try to install the .net framework again. If it doesn’t work I’m formatting it entirely and putting Ubuntu on it instead.

Even if Vista works I’m not happy about it because of the DRM.

http://www.theregister.co.uk/2006/12/27/windows_drm_monstered/
http://www.techweb.com/wire/software/167101037

Another thing is Vista is closed source and the current goverment does not have much respect for civil liberties. I would not be surprised if there were backdoors in Vista allowing the goverment to spy and intrude on people. Until Ron Paul gets elected, I would rather stick to open source.

D3DX Math functions very fast

Sunday, December 2nd, 2007

I ran across this
http://cache-www.intel.com/cd/00/00/01/76/17699_code_zohar.pdf which is a math library using SSE2 to do fast math operations. I spent a lot of time upgrading his code to be more suitable to games, such as doing a transpose for an inverse of a orthonormal matrix. But after profiling I found his code was slower than the equivalent D3DX math functions, even for matrix multiply.

D3DXMatrixMultiply 10000000 times:
diffGP=564 milliseconds diffDX=396 milliseconds

Bleh.

I also tried this: http://www.cs.nmsu.edu/CSWS/techRpt/2003-003.ps

It appears that D3DX already does better than this as well:
Theirs=695 milliseconds Mine=801 milliseconds

However, the version without scaling was 100 milliseconds faster. However, that is such a special case it’s not worth leaving in.

So Kudos to Direct3D because their math functions are very fast!

By the way, this is something I was able to figure out while experimenting. In every library I’ve ever used, except the one at The Collective, this was very unclear. I think they used to always store the matrices transposed to make them easier to use or something.

[code]
inline D3DXVECTOR3 * GetAtVec(D3DXVECTOR3 *out, D3DXMATRIX *in)
{
out->x=in->_13;
out->y=in->_23;
out->z=in->_33;
return out;
}
inline D3DXVECTOR3 * GetUpVec(D3DXVECTOR3 *out, D3DXMATRIX *in)
{
out->x=in->_12;
out->y=in->_22;
out->z=in->_23;
return out;
}
inline D3DXVECTOR3 * GetRightVec(D3DXVECTOR3 *out, D3DXMATRIX *in)
{
out->x=in->_11;
out->y=in->_21;
out->z=in->_31;
return out;
}
inline D3DXVECTOR3 GetAtVec(D3DXMATRIX *in)
{
return D3DXVECTOR3(in->_13,in->_23,in->_33);
}
inline D3DXVECTOR3 GetUpVec(D3DXMATRIX *in)
{
return D3DXVECTOR3(in->_12,in->_22,in->_23);
}
inline D3DXVECTOR3 GetRightVec(D3DXMATRIX *in)
{
return D3DXVECTOR3(in->_11,in->_21,in->_31);
}
[/code]