Saturday, November 29, 2008

Stuff I've read lately

"Vorpal Blade" (John Ringo) - This is the second book in the series starting with "Into the Looking Glass". Ringo is doing an excellent job of building up a rather unique space opera universe. Pretty hard SF, with good characters and the right mix of humor (like, a giant alien squid trying to eat their space going submarine!). I'm looking forward to more.

Wednesday, November 19, 2008

Stuff I've read lately

"The Family Trade" (Charles Stross) - I have been loathe to start in to these, as they are marked "Fantasy". I haven't read any fantasy in a long time (in all starts to be the same after a while). Sadly, Stross seems determined to continue this series...

That said, this book feels a lot like a hard SF version of "Chronicles of Amber" - so, that's good. For example, once the main character gets back from her first "hell ride", she starts planning all sorts of experiments and evidence gathering!

Tuesday, November 18, 2008

New Stars Status

Some big changes in store (not much visually...)



Here we can see the recent files list. It does not re-sort when you select a previous file (I am undecided whether that is a good feature or if some sort of better LRU might be nice).

I also fixed the C++ code to use 64 bit numbers when interfacing to Tcl. I think that just went in to Tcl 8.4. That will get things ready for the object id redux.

Finally, I fixed the new game wizard to actually generate the turn files when you start a new game. That is much better than having to save out the new game def, switch to a terminal, and do a 'newStars -n', then switching back to the client...

Sunday, November 09, 2008

Stuff I've read lately

"Into the Looking Glass" (John Ringo) - This is the first book by Ringo that I have read. It was pretty good. Kind of a mix of David Drake and some harder SF guy (Niven?). The story is about a physics experiment gone horribly wrong. The initial experiment blows up UCF, and starts opening stargates to all sorts of different places. Soon, evil aliens start pouring through some of them. Lots of action. In the end, they have to nuke Eustis.

Ringo had an interesting weapon system, a "quarkium bomb" or "quark ray". The exact mechanics weren't clear, but it was supposed to be more powerful than anti-matter. So, it can't be that the quarks are the direct objects converting to energy at the target (that would be equally powerful). Perhaps there is some way a form of quarks could trigger a chain reaction of disrupting nuclei. That would be scary...

Saturday, November 08, 2008

Tcl and Ini files

The NewStars client GUI is proceeding pretty well. I am finally getting tired of navigating from the client start directory to the regression directory (up two! src/testfiles/twop).

This is the implementation for the "Recent file list" in Tcl:

Create the resource file if it doesn't exist, or process it if it does:

if {![file exists [file join ~ $resourceFileName]]} {
close [open [file join ~ $resourceFileName] w]
} else {
eval [read [open [file join ~ $resourceFileName]]]
}


The ini file is a series of Tcl statements. That way, I can just "eval" the file to bring it in.

Then to handle saving the preferences:

rename exit origExit
proc exit {} {
set f [open [file join ~ $::resourceFileName] w]
foreach n [lsort [array names nsGui::prevFiles]] {
puts $f "set nsGui::prevFiles($n) \{$nsGui::prevFiles($n)\}"
}
origExit
}


The previous files is a map from the numbers ("1" to "9") to full path filenames. I can grab all the set values (which may be none) and write them out to that file.

By renaming "exit", I can trap any point in the program that is trying to exit. That way, I'm sure that the preferences are saved.

Wednesday, November 05, 2008

Improving C

A lot of programming languages have been inspired by C. I can easily list C++, Java, and D; there's probably more (Wikipedia lists Perl, I think Perl is a very different sort of C - and Python and Ruby feel more like cleaned up Perl. I always thought of JavaScript as more like VisualBasic, which is more Pascal-ish - Pascal being a sibling of C, both derived from Algol). There is a pretty cool family tree of programming languages, which shows Python as independent of Perl. I'm not too familiar with Python...

C is a pretty good language. Developed in 1972, it served as a sort of "cross platform assembly language". It allowed UNIX to spread to many different computer systems and provided fertile ground for thousands of hackers.

The main problem with C is the lack of support for object inheritance (you can actually do object oriented programming, but it is kind of a pain). But to implement object inheritance, you must relax pointer conversion warnings (I'm not sure how strict modern C compilers are on pointer conversion, C is classically very relaxed).

The other problem is the lack of generic programming, sometimes called template programming. This allows one set of code to work with various underlying types. The most obvious application is in basic data structures and common algorithms (vector, map, sort). Sorting through void* and size is kind of a pain...

Tuesday, November 04, 2008

Language is a Tool

Is it right to make fun of a programming language? I mean, "it's just a tool". That's what everyone says. You don't mock a hammer for not being a screwdriver (although screwdrivers can be usable hammers ;)

Of course, language is more than a tool.

It is also a means of communication, which means that you've got multiple entities involved.

The main communication is from the programmer to the computer. That means:
  • The programmer needs to be able to express himself efficiently (in a matter which makes sense to him, in a reasonable amount of time)

  • The computer needs to be able to understand (computers are really bad at English! and not just because English is a terrible language for specifications!)
But, programmers also communicate with one another. If I write all my programs in Tcl, not many other programmers can read them. That's a big part of the "more than a tool". If someone develops the "super monkey hammer" that can build a house in a day, but only super-monkey-hammer technicians can change the light bulbs; people are going to be frustrated.

Monday, November 03, 2008

Steam INNN SPAAACE!

So, I've been thinking about the space elevator, mostly about powering the climbers. Everyone seems to be backing laser power (using ground based lasers to shine on solar panels on the climber).

And, I've been reading Ken Macleod's "Fall Revolution" books, which have "steam launched spaceships". I read them completely out of order, so I never got any details. There is a little in "The Space Fraction".

After looking into it more, I found an excellent source. "Steam" propulsion is somewhat of an exaggeration. The recommended propellants are hydrogen and nitrogen. Water is possible, but not optimal.

But pretty cool, for small scale, high volume launch capacity.

Sunday, November 02, 2008

New Stars Status

Tada!


A lot of visual changes!
  • Fixed a bug in the defenses calculation (max at 100, please!)
  • Implemented hab view mode (circles represent current hab value, flags show ownership)
  • Fixed unexplored planets to show gray (both views)
  • Fixed the bug I knew would be there when removing too much
  • Fixed a bug when adding multiple items to the top of the queue (visual bug, data was ok)
  • Fixed the mineral labels to be colored (iron - blue, etc). I made the germanium one more gold than yellow. I find that yellow hard to read...
  • Added view planet window (shown, missing mining rates, capacity, hab value, and production queue right now...)

Saturday, November 01, 2008

Stuff I've read lately

"The Star Fraction" (Ken Macleod) - This is apparently the first in the "Fall Revolution" series. I didn't find anything new and incredible in here. It did give a little more insight into the "steam rockets" mentioned in the other books. That is worthy of its own research...