Friday, December 12, 2008

Stuff I've read lately

"Ghost" (John Ringo) - I wasn't happy with this one. More Tom Clancy than SF. Also, the whole middle of the book is like a weird ad for kinky sex. Not sure what Ringo was trying for. But, I guess you have to give extra points for the main character killing Osama Bin Laden and sending his head to President Bush...

Wednesday, December 03, 2008

Stuff I've read lately

"Von Neumann's War" (John Ringo) - This is a standalone novel. It covers an invasion of the solar system by self-replicating robots (ala a proposal by Von Neumann for a method for us to explore the galaxy). Fortunately for us, the probes programmers didn't expect concerted, intelligent opposition - humans are able to reprogram them just in time to prevent our extermination. Think "Independence Day", with more marines and less Jeff Goldblum.

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

Friday, October 31, 2008

I Love Tcl

So, I have been grinding through a lot of GUI code (NewStars update coming soon!)...

In the process, I have been shifting code from C++ to direct XML access. Part of this involves something called "XPath" (which I had never heard of before).

The key is, you can query an XML document like a database (including wildcard and logical test patterns). So, if I want the node with the planet with object id stored in variable 'pid', I can do:

set n [$nsGui::turnRoot selectNodes //PLANET_LIST/PLANET\[OBJECTID=$pid\]]

'//' means a relative search (not necessarily from the root). I need "PLANET_LIST" because there is another list of planets, called "UNIVERSE_PLANET_LIST". The outer square bracked "[]" are part of Tcl (execute this part, and resolve it to the string that is returned). The inner (escaped) brackets are part of XPath (return nodes which satisfy "[logical_condition]").

Of course, any language can support XPath. But, in Tcl, I can open a console session, source the stars.tcl, and start issuing XPath commands against the turn file. That allows me to rapidly tune my request to get the results I want (eliminating the compile/re-run steps). Especially since the W3C XPath docs are unreadable...

Then, once I have the planet node, I can pick off attributes:
set concs [$n selectNodes string(MINERALCONCENTRATIONS/text())]

That replaces:
set planXML [xml2list [newStars $::ns_planet $id $::ns_getXML]]
set mainXML [lindex $planXML 2]
set cargoXML [findXMLbyTag "CARGOMANIFEST" $mainXML 2]
set tuple [lindex $cargoXML 1]


Especially since that used "xml2list", which can't always parse some XML...

Thursday, October 30, 2008

Const Fail

I only recently discovered an oddity in the C++ "const" feature. Consider this code:
class Foo
{
int *i;

void foo(void) const
{
*i = 4;
}
};
(I've left out some boiler plate)

Anyone see it? A const function is changing the state of the object!

Oops, turns out C++ const is not "transitive" (the D docs call it "head const").

This bit me big time on my previous project. To the point that I developed a "const pointer" class to wrap all my pointers (only got partially deployed into the project).

D 1.0 lacks const (because it is hard to get right, witness C++). D 2.0 wants const done right.

Also, there is a great slam on Java and const. (I can't help myself when it comes to slams on Java! :) Yea, no const for you Java-kins!

Sunday, October 26, 2008

New Stars Status

I've been struggling with whether to extend the regression, or to get things into shape for a pre-Beta test. I like the regression (being repeatable and all), but it takes as much work as playing the game (more, since I have to play both players).

Of course, shaping things up for a live test requires different sorts of GUI programming...


Here we can see the major changes:
  • I added the icons for two of the planet views (ship view - mostly implemented, and planet value view - next to be implemented)
  • Lots of production queue stuff...
  • Shift and control with Add/Remove (10 and 100 respectively, 1000 together). 889 = 1000 - 100 - 10 - 1
  • Added "End of queue" (add is "add before", so we need end - original Stars uses "add after", oops!)
  • Fixed quirks in selection (previously, I deleted the queue and reconstructed it from the current orders - now the C++ code communicates queue changes and the GUI selectively rebuilds the view)
  • Added a binding to the "q" key
  • Fixed a bug related to pressing "Change" queue button multiple times
Fixes that can't be seen here:
  • Fixed a bug in the max usable factories calculation (population was divided by 1000 instead of 10,000 before multiplying by race factory operation factor)
  • Fixed a typo in the component map for Interspace 10. This caused a Tcl error when opening the Ship Design Wizard for players with that access to that component.
  • Fixed key bindings for '-' and '+' on the numeric keypad (linked to zoom) for Linux. On Windows, <plus> and <minus> catches both versions. On Linux, the keypad keys generate <KP_Add> and <KP_Subtract>. May be an X server thing...
  • Fixed transport amount carrying over between different fleets (and players!). The most confusing thing was - a player could order a load 2500 colonists, save and load another turn, and see that load 2500! Except, the order wasn't given, so they'd launch with no colonists! Ops!
  • Unlinked open file command from "Find" operations (it was intended as a place holder, I find "" makes a better one!)
I'm pretty sure there is a bug in "Remove" multiple, when there are not enough to satisfy the remove (for example, remove 1000 - when there are only 999). The remove will probably remove more stuff, until the count is satisfied! I will fix that...

I also need to implement the hab view.

And fleet split/merge. Fleet numbers. Fleet (friendly and other) and planet list.

Thursday, October 23, 2008

Stuff I've read lately

"The Sovereign Grace of God In Salvation" (John Roden) - Reviewed on my faith blog.

Sunday, October 19, 2008

New Stars Status

BOOM!



Further work on the battle VCR.

First, I ran through this battle in the original Stars, and noticed that the Warmonger Armed Probe should be crossing the board faster. I found that the Warmonger did not have his +.5 move bonus. Fixed.

That gave me a test case for a "FIRE" token in the battle report (missles still not supported).

I also updated the selection logic, so that changing the current event (next and previous buttons) selects the acting token.

Wednesday, October 15, 2008

Stuff I've read lately

"Murder in the Solid State" (Wil McCarthy) - Interesting pun. When you think of "solid state" you think of "state of the art" and "cutting edge". But, in the age of nanotech (full of tiny machines and their moving parts), "solid state" is the failure mode (your tiny machines have jammed)!

This book is a murder mystery. Things go pretty well (very suspenseful) for the most part. Although, the ending was a little confusing and unsatisfying.

Friday, October 10, 2008

Stuff I've read lately

"The Sky Road" (Ken Macleod) - Wikipedia says that this book presents an alternate time-line in the "Stone Canal", "Cassini Division" series. I'm not so sure. It's certainly not obvious. One character, "Ellen May" seemed younger than I remember, but I can't be sure. The "Sheenisov" are still marching across the earth, and the "tinker" society seems a believable precursor to the communes in "Cassini". Overall, ok. I still like "Cassini" the best.

"Why I am So Wise" (Friedrich Nietzsche) - Reviewed on my faith blog.

Saturday, October 04, 2008

Aluminum + 1000 resources

= Space Elevator! (thank you Civ 4). Of course, if you build in in the city with the Iron Works (excellent Texas barbecue results in double resource output!), it's only 500 resources; a good city can do that in ten or eleven years.

I've been following discussions on building a space elevator for some time now. I was surprised to see CNN discussing it!

There are two primary challenges connected with building a space elevator:
  1. The cable (or tether) - Spans 100,000 kilometers from the surface of the earth, up past geosynchronous orbit (the center of mass is at the geosynch point)
    • This cable need not be one single piece. This is a confusion many people have ("We can't build a carbon nanotube that long!!111eleven!").
    • The cable need not be of super materials (100% carbon nanotubes, positronium, etc.) You can make it out of bubble gum, although you'd probably need enough to alter the center of mass of the earth-moon system :)
    • Better materials translate into less mass for the initial tether. That means fewer rockets to get all the materials into space.
    • Once the initial tether is up, the first cargo can be more tether, to increase the capacity of your elevator (and build new ones).
  2. The cars (or climbers)
    • The tether does not move, instead, the cars pull themselves up or down.
    • The climbers are actually the hard problem!
    • They must travel the hundred miles or so into the edge of space, and possibly, the 36,000 km to geosync orbit (especially if they are going to be used to add on to the tether).
    • It is unlikely we will want to carry enough fuel for a 36,000 km journey (at 200 mph, that's about a five day trip - one way).
    • That means we need a means of power distribution to generate power on the ground, and get it to the climbers (most likely lasers and solar panels).
The dangers of the space elevator (terrorist attacks on the base, the tether, or the geosync station) are largely exaggerated. Breaking the tether would cause pieces of it to burn up or fall to earth. It is relatively small, and would do little damage. If the base were destroyed, the tether would slowly rise (there is slight pressure up, to keep the tether tight).

The hazard to lower orbiting satellites is more than offset by the increased launch efficiency. (There would need to be a workforce assigned to pushing satellites out of the way, or a way to shift the tether around them - such a shift might even be useful in dodging meteors or terrorist suicide attacks).

The good news is that the space elevator used to be considered a tech level 9 or 10 achievement. It appears, it will be completed easily within the tech 8 time frame.

Tuesday, September 30, 2008

C-piphany

(rhymes with epiphany)

At some point, I realized why C++ is so unwieldy.

It is really three (or four) different languages:
  1. Macro preprocessing language. #define, #include, etc. Mostly deprecated in C++, except for #include, and #ifndef protection in header files. Except when someone drops 300k lines of 15 year old code on you, and it is filled with all sorts of "horrors man was not meant to know" (TM).

  2. Base C language (and C++ extensions, which can be considered a language unto themselves). What we normally think of as the language, with declarations and operators. I think this is where C++ shines, with lots of tools to wedge things together (operator overloading, references, etc.).

  3. Template programming language. This is needed for the standard library (arrays, etc.). Except, it becomes all to easy to start coding everything in templates. Then, you're hardly using C at all. It's all bizarre template stuff. It's all in header files, and it's all ugly and hard to understand...
Hopefully D fixes this. I know the macro preprocessing is gone (integrated into the language). The D template syntax looks much cleaner.

Monday, September 29, 2008

Stuff I've read lately

"The Stone Canal" (Ken Macleod) - This is the precursor to "The Cassini Division", which I read first. I find it didn't add much, although it was ok.

"Why God Won't Go Away" (Andrew Newberg, Eugene D'Aquili, Vince Rause) - Reviewed on my faith blog.

Monday, September 22, 2008

New Stars Status

Big landmark! The Battle VCR!



It also includes the battle report window (very small, just left of the top of the VCR). This allowed me to find an interesting bug. Scan was comparing pointers, so the same ships were getting scanned over and over.

I also added the detailed scan for ships in battle (still need to make this the behavior for WM scans).

This check-in also includes a top level Tcl XML DOM. That's a complicated way of saying Tcl now has access to the parsed XML file at any point. Previously, it required C++ to parse the XML, and could only query the XML for individual objects. This should allow me to migrate to an all Tcl client (or at least one independent of server code).

Sunday, September 21, 2008

The Horror, the Horror

(Continuing my rant on g++ 4, which is a part of my musings on D)

Ok, take the code from last time, and add this after the "class Par" definition:

template<typename T>
class Child : public Par<T>
{
public:
void fun(void)
{
x_ = 4;
}
};
This code should compile on on gcc 3.4 or in Visual Studio. g++ 4 gives the following error:

main.cpp: In member function 'void Child::fun()':
main.cpp:22: error: 'x_' was not declared in this scope

Err, excuse me! x_ is inherited from the parent. Just look, it's 'int x_'. It's protected, that means it's visible to any children! How can I fix this! I don't know what to do!

After about five minutes of careful Googling, I found a site that seems to understand what's going on. They say:
"The C++ standard prescribes that all names that are not dependent on template parameters are bound to their present definitions when parsing a template function or class."
There is actually a good reason behind this. People were having problems where templates were full of buggy code, but no one knew it until you tried to use them (because the compilers were just turning off error checking when interpreting template code). So now, compilers are trying to understand the template code, and check it for errors. The only problem is good code is now wrongly flagged as erroneous code. Oops!

There is a fix:
this->x_ = 4;

Ok, I can see how that helps the compiler figure stuff out. However, it hurts my brain... If somebody else sees this code (and isn't familiar with this change in the compiler, like say they've been programming C++ for the last ten years and never seen it - like I was until this week) they are going to say, "Oh, that 'this' isn't needed. I'll just remove it." Let's say it's in some utility header (like a good template should be). And that it takes an hour to recompile (like my project does). And they change a lot of other stuff before starting a full recompile (because you don't want to wait an hour between every one line change). And then they get that bizarro error. Yea, they're gonna be mad. And they're going to have to back track through all the changes they've made, google for the page above (assuming they can find it, I only found it by looking for "two stage name lookup" - yea, that's intuitive), and recompile another hour or two.

Enjoy! :..(

Note: apparently, it went into g++ 3.4, only 3.2 is safe!

Saturday, September 20, 2008

c++->fail()

(Continuing my musings on D)
(that code actually works, try (assuming C has a method fail):
C cAry[2];

C *c = cAry;
c++->fail();
)

I got bit by several very ugly bugs in g++ 4 this week. This is about code that works in gcc 3.2, 3.4, and Visual Studio. But breaks in g++ 4.

This is because g++ 4 is more closely matching the C++ spec!

See below for the exact code.

The first problem is mixing implementations of template member functions. This might be because you need to specially handle certain types (like strings), while having a generic implementation for the standard types (int, bool, float, etc.).

The notation in pre g++ 4 is straightforward (if ugly)

returnType ClassName<SpecificType>::functionName(args) { specific implementation }

and

template<args>
returnType ClassName<args>::functionName(args) { generic implementation }


When I compile under g++ 4, I get this error:

main.cpp:16: error: too few template-parameter-lists


In the code below, line 16 is:

void Par<std::string>::fun(void)


Well, there is the template parameter! Right there! "std::string", it's string! What more do you want from me!

Here is the working code:

template<>
void Par<std::string>::fun(void)


Oh! Of course! Duh! I should of known that. The earlier code was obviously so ambiguous that only every compiler before g++ 4 could figure it out. I'm so glad they fixed that for me!

Here is the total code:

#include <cstdio>
#include <string>

template<typename>
class Par
{
protected:
int x_;

public:
Par(void) {}

virtual void fun(void);
};

void Par<std::string>::fun(void)
{
printf("String ver\n");
}

template<typename T>
void Par<T>::fun(void)
{
printf("Generic ver\n");
}

int main(int argc, char **argv)
{
Par<std::string> p1;
p1.fun();

Par<int> p2;
p2.fun();

return 0;
}

Friday, September 19, 2008

Stuff I've read lately

"The Cassini Division" (Ken Macleod) - This is actually the third book in a series. I am really enjoying Macleod. His writing is reminiscent of the "good ole days" of science fiction; with big ideas and epic happenings. And there is a good amount left to be mined here (Cassini is from 1998). Stross is writing too much fantasy (Merchants), and horror (Atrocity Archives). Scalzi has just gotten started.

The Cassini Division is a military unit stationed near Jupiter (and, apparently, a gap in the rings of Saturn). They are charged with protecting Earth (and the orbital settlements) from "post-humans", a group of people who uploaded themselves into computers and set off runaway technological progress (the "singularity").

Macleod has an interesting take on the STL/FTL problem. He uses the "hard" sci-fi notion of wormholes (paired creations, which must be moved apart at STL). However, he also allows that the moving end of the wormhole keeps its own time frame - thus, you can travel 10,000 light years (to a point 10,000 years in the future) fairly soon after the wormhole is created. Interesting stuff.

Thursday, September 18, 2008

Decoys

(Continuing my musings on D)

Garbage collection:
  • Although it's always fun to mock people who fail due to memory leaks while using a garbage collected language...
  • I think D simultaneously defeats C++ and Java/C# here...
  • But, but, C++ has garbage collection libraries! Yea, in ten years of programming I haven't used a C++ garbage collection library. I have used Purify, Valgrind, and even overloading new and delete; looking for memory leaks (not to mention the NewStars code is loaded with memory leaks...)
  • Java has garbage collection, and only garbage collection - unless you use Embedded Java, then you get no garbage collection! Enjoy!
  • D "makes the easy case work". The default is garbage collection, with overrides for self-managed memory (of various forms).
Built-in documentation:
  • Doxygen ('///' and '/***/') works on C++ and Java (it's an extension of JavaDocs)
  • However, it needs to run as a separate step of the build.
  • This can be confusing. For example, I ran the debug build, and didn't see Doxygen (although it might be in there, with make spewing thousands of pages of output...). Some of the code uses it, some doesn't. So, I started converting everything to not use it (it's ugly and confusing, if you're not going to generate the docs). Until I discovered than there is a build that does use it (and the code not using it, needs it)
  • Less ugly Doxygen style comments are built into the D spec. There is a compiler switch to do the docgen run.
Design by Contract (DBC):
  • Programming is all about assumptions. When writing new code, you've got some idea of what's going on in the program, and what the inputs will be, and what sort of outputs you can create.
  • Of course, assumption are made to be broken. That's why I'm always sprinkling my code with plenty of 'asserts'.
  • DBC formalizes all of this. 'assert' is part of the spec (rather than being an ugly macro). Also, there are 'in' and 'out' blocks for functions (to check inputs and outputs). Classes have 'invariant' statements, which are processed before and after functions (to ensure class invariants are maintained).

Wednesday, September 17, 2008

Duck Hunt

(Continuing my thought process for considering a new language)

Nine to five, I hack C++. Not just any C++. Imagine hundreds of thousands of lines of code, spread across dozens of directories in a twisty maze. Make takes from twenty to thirty minutes (that's a parallel make, serial is over an hour), and sometimes fails in odd ways.

The program has to run on about five different compiler/platform environments (Windows, plus various forms of UNIX - including a Sparc).

Over the past few weeks, I've been running into all sorts of nasty C++ problems (weird template problems, compiler mismatches, spaghetti recompilation).

As I've been looking for solutions to the problems on the Internet, the C++ Frequently Questioned Answers keeps coming up.

The guy makes a lot of good points. And I started to wonder, does he have some constructive recommendation (besides, "Don't use C++").

It's called D.

I think, what I'm looking for isn't Python or Ruby to replace Tcl. I need something to replace C++. With features like Python or Ruby (rapid development, functional programming).

That's D.

Things are still a little fresh (spec is rapidly moving, environment issues). But considering that, it is working remarkably well. I mean, C++ is way older, and still has issues!

A good place to start is with the overview.

Tuesday, September 16, 2008

New Stars Status

Finally getting to the point where I can start on the battle VCR!



It took a lot of bug fixes to get to this point...
  • Implemented ship to ship scanning
  • Fixed bug causing battle messages between fleets the player owns
  • Fixed a bug where planets could not see enemy ships in orbit
  • Added a speed spinner to fleet move orders
  • Fixed a bug when right-clicking on mixed friendly and enemy fleets in one point
  • Fixed a bug where some fleet GUI items would appear in view planet mode
  • Fixed widths of some widgets to fix jumpy universe view size
  • Added previous and next buttons to the message pane
  • Removed ship object id from ship names (just in fleet)
  • Improvements to the scripting interface
The JOAT player is pretty well into colonizing a second planet. The War monger has no orders beyond scanning...

The battle was really anti-climatic. The current battle engine has the JOAT scout escape without a shot fired. I will need to investigate that outcome...

Friday, September 12, 2008

Need a New Duck

And show me how to get down
How to get down baby
Get it?!

Quack, Quack, Quack!
I've probably forgotten more about programming languages than most people know (since most people know zero programming! :)

Basic, Pascal, Visual Basic, C, C++, Perl, Verilog, Java, various assembly languages (including PipeWrench, don't ask), Awk, Tcl, Lex, Yacc, ML (which we all thought stood for "My Language"), VHDL.

At this point, I've pretty much settled on C++ and Tcl. (plus Perl for text processing).

Tcl is great for rapid development, and GUI design.

C++ is great for interface definition, large projects, and general hacking. I don't know Bjarne's background, but it must include a lot of hacking.

But I've been getting the feeling I need a new language.

I tried Ruby. But "everything is an object" doesn't seem any better than "everything is a string" (Tcl).

I've played with Python, but again, it doesn't really replace Tcl for me.

I've used Darcs, which is the poster child of Haskell. That's pretty much turned me off that... The other functional languages are even more obscure.

Erlang seems to have potential for the multicore future. But it seems to be different in annoying ways, "just cause".

Tuesday, September 09, 2008

Stuff I've read lately

"The Birth of Christianity" (John Dominic Crossan) - Reviewed on my faith blog.

"Patriots" (David Drake) - Not your typical Drake. Ok, but more character focused. He should stick to tanks and such :)

Saturday, August 30, 2008

New Stars Status

Trying to work up to a battle in the two player game. I am trying to actually walk the players through their turns as they would be doing them (i.e. spending a lot of time micro-managing).

Part of that is implementing the "accelerated BBS" option (so I don't have to generate 30 turns before reaching colonization pop).

Then, I added the research tax option (visible in the dialog below). This uncovered several bugs in communicating this information from the player file to the server.



I also fixed the scanner pane so that it resizes itself to fill up the window. There is a somewhat annoying flicker as you click from explored to unexplored planets (due to different widths on the left)...

I also found/fixed a bug for JOAT w/o IFE getting Quick Jump 5 instead of Long Hump 6 (IFE properly gives the Fuel Mizer).

As well as a bug in the growth formula when planets exceed 25% capacity (aided by AccBBS).

Interesting note, on Linux, the two players are right next to each other. That means I can use it for some quick battles (and I need to fix the homeworld placement logic...)

Wednesday, August 13, 2008

Stuff I've read lately

"Dark Light" (Ken Macleod) - Sequel to "Cosmonaut Keep". Very short, but pretty good. Follows the adventures of the previous characters on a planet some light years from the last (they got their light drive working). The libraries here don't have the third book...

"In My Place Condemned He Stood" (J. I. Packer and Mark Dever) - Reviewed on my faith blog.

Tuesday, August 12, 2008

New Stars Status

Started in on more bugs:




Here we can see the new universe caused by fixing the randomization of the hab distributions. I also added the player relation dialog, and changed the underlying implementation. With those changes done, I can revamp the battle engine - in preparation for the battle VCR.

I also fixed some of the automation, to improve fuel consumption during scouting missions.

I looked into the fails during generation huge universe (dense and packed). They are running out of planet names. We will need to generate another 1k names...

Friday, July 18, 2008

Stuff I've read lately

"Cosmonaut Keep" (Ken Macleod) - This is some of the best space opera I've read in a long time. Really what I've been looking for lately. Reminds me more of Asimov, and the like. The story is a little confusing at first, because it covers two time frames: the first is in the future on a distant planet, where humans and aliens live together; the second is the near future, where humans make first contact with the aliens.

I look forward to the next book, "Dark Light".

Wednesday, July 16, 2008

New Stars Status

I started in on some of the bugs:


Here we can see the new fleet composition pane. I still need to connect the "battle plan", "estimated range", and "cloak" areas. Also, I need to add a drop down with other fleets in this location (for fleet to fleet transfers). I also need to implement the Split/Merge buttons.

I also fixed the "close enough" check when adding waypoints. That was one of the first features in the GUI, when the canvas had a lot fewer things floating around. At some point, all the new canvas objects threw off the logic. It should work much better now. I also fixed the "redraw paths on delete" bug.

Then there is the production queue. I fixed the "remove all" problem mentioned, and improved the checks which combine nearby items. Also, the production queue and waypoints list should behave better when adding multiple (always inserting at end, rather than sometimes at the beginning).


I looked into the research tax. It is a top level XML thing, so I may want to adjust that through the C++ interface. I also gathered some data on the hab distribution. It is looking fairly flat. I want to gather a few more data points to be sure... I also started on handling shift and control down, but that will need more effort.


I'm not entirely happy with where this check in is (should have a few more features), but the code has been this way since Saturday (IIRC) and I haven't had a chance to work on it, and might not for a few days...

Monday, July 07, 2008

New Stars Status

Some more operative bugs (and much needed new features):
  1. Floating-point exception while generating a huge universe (names underflow?)
  2. Need a redraw of paths on delete waypoint
  3. Waypoints always insert at 0 (should be end)
  4. Fix close enough on shift-click (canvas is returning a list?)
  5. Feature - drag waypoints
  6. Need to clear the current filename on open (fixed locally)
  7. Feature - recent files, remember working directory (.ini)
  8. Production Queue (PQ) - shift/control click, hot keys
  9. Generate player files automatically on new game
  10. PQ - "Remove" removes all on a multiple item!
  11. Messages on planetary build (will need filter!)
  12. Research tax in GUI
  13. Ship Designer - delete needs a refresh
  14. PQ - collect ships above and below on add
  15. Messages for fleet complete orders and new planet scans
  16. Feature - View all fleets (F3)
  17. Feature - Fleet composition and split/merge
  18. Scanner pane focus arrow, update on next (fleet/planet)
  19. Hab distribution is uniform
  20. Speed and fuel in fleet orders

Wednesday, July 02, 2008

Stuff I've read lately

"God and Religion" (Bertrand Russell) - Reviewed on my faith blog.

"Surprised by Hope" (N.T. Wright) - Reviewed on my faith blog.

"Introduction to Christianity" (Joseph Cardinal Ratzinger) - Reviewed on my faith blog.

"Agent to the Stars" (John Scalzi) - I'm running out of Scalzi and Stross to read at the local library. I had actually seen this book. But the cover art is really bad. I didn't even realize it was science fiction. I found the text online, and read a bit, and realized it is sci-fi, and classic Scalzi. Very enjoyable.

Friday, June 06, 2008

New Stars Status

Trying to crush off the bugs from the last bug report...


Here we can see the main fixes. I've added a player command to the Tcl interface, mainly to implement player relations. However, I think the main player relation code will need to be reworked...

I also fixed the mining rate calculation, and max defenses calculation (and the resources now say max/max instead of 0/max).

I also added some menus (view race - previously only accessible through F8, research - ditto/F5, battle plans - stub, change password - stub).

I fixed a bug where using the race wizard would break viewing your current game race, and another where planetary resources display as 0 on the first turn.

Wednesday, June 04, 2008

Stuff I've read lately

"Halting State" (Charles Stross) - This is very near future fiction, about 10 years out. It is basically a mystery/spy thriller featuring a nerdy programmer and an accountant. I found it pretty well done. The zombie flash mob at the end was a nice touch.

Tuesday, May 20, 2008

Stuff I've read lately

"Nebula Awards 26" (James Morrow ed.) - I guess 1990 wasn't a very good year for short stories in science fiction. I didn't like any of them, at all. There was one by Ursala Le Guin, which was just ok. I read "Left Hand of Darkness" about three years ago, and couldn't remember the specifics. The novella by Haldeman was kind of interesting, but was very Hemingway specific, and I didn't really get it.

Thursday, May 15, 2008

Stuff I've read lately

I finished the Simak book, the last stories were:

"All the Traps of Earth" (1960) - Very reminiscent of Asimov's "Bicentennial Man", which I guess, wasn't written until 1976... so a point for Simak, there.

"Death Scene" (1957) - Very short, somewhat ominous feeling, but ends well.

"Reunion on Ganymede" (1966) - War heroes overcome their differences by blasting robot animals.

"The Money Tree" (1958) - Alien botanists help out a local thug.

"Party Line" (1978) - Interstellar communication via psychic hot-line/chat room.

"The Answers" (1953) - Man loses his drive to expand after learning life has no purpose.

"The Thing in the Stone" (1970) - Ironically, I picked up Simak because he is listed as a Christian author. The previous stories weren't exactly pinnacles of Christian doctrine. This one at least had a touching ending. The "thing" in the stone is some sort of universal war criminal. The main character meets an energy being attendant, which he first takes as a sort of "loyal pet". But, in the last paragraph, this being is revealed as a "shepherd", waiting for the redemption of the "thing". So, not all bad.

Thursday, May 08, 2008

Stuff I've read lately

"Inheritor" (C.J. Cherryh) - The third book in the "Invader" series. It feels like Cherryh has slowed things down a little. The story is taking longer to progress, and the stress for the characters isn't quite as challenging. But, the story is still pretty compelling, and the universe is interesting.

I've also started a collection of short stories by Clifford D. Simak. The collection is called "The Creator amd Other Stories".

The first story (from 1935!) is called "The Creator", about a couple of guys who meet an energy being who claims to be the creator of the universe -- and kill him. Not a high quality story.

"Shotgun Cure" (1960). This is shorter and punchier, but the ending falls flat. Aliens cure the human race of all disease, but we get kind of dumber. How much dumber? Do the aliens come back to harvest us for lunch? It doesn't say...

Thursday, May 01, 2008

Stuff I've read lately

"The Last Colony" (John Scalzi) - This is the last book in the "Old Man's War" trilogy. I think it ended strongly. Scalzi's humor remains, and there is some good action. I thought it was interesting that the base colony size is 2500 colonists, the same as Stars.

Wednesday, April 30, 2008

New Stars Status

Started in on the bugs from last update...


  • Fixed names with spaces (caused planet names in the test bed to shift... which required an update to the orders.tcl)
  • Added display of max infrastructure (which is stored in the turn file). This caused me to realize that turn 0 does not have a max infra calculation. I also realized we did not factor in OBRM and JOAT...
  • Added display of defenses (including max)
  • I moved the "bottom right" frame (which shows planets, fleets, minefields, etc.) over to the left. This makes more room for the starmap. I also changed the display to 800x600, and shrunk the hab bars to make things fit better, and fixed the hab pluses to use a brighter color.
  • Fixed message display when you have no messages.

Thursday, April 24, 2008

New Stars Status

Bug report:
  • Planet names file stopped at first space (no multi-word planet names)
  • No max calc for planetary mines, factories, and defenses
  • No mining rate calc
  • Missing pop-ups on population, resources, scanner, defenses
  • Missing gui cargo transfer (work-around: use waypoint 0 load/unload)
  • Missing clear planetary queue button (work-around: manually clear, who ever uses this button?)
  • Missing route button (not a big usage, it adds a move order on newly constructed ships, basically automation)
  • Missing starbase display panel
  • Missing mineral display in bottom right
  • Missing message display
  • Need menu commands for Research (dialog is done, use F5), Generate (done, F9), Planet/Fleet view (not done, F3), battle plans (not done, F6), Player relations (not done, F7)
  • Battle engine improvements
  • Report menu
  • Scanner pane filters/options
  • Starbase and fleet icons in bottom right
  • Pop-ups in bottom right
  • Should probably disable add to queue from empty/unowned planets... (server will reject the commands... I hope...)

Sunday, April 20, 2008

New Stars Status

A few more minor improvements, but they're the sorts of things that are important for playability:
  • Implemented slot compatibility checks (no engines in weapon slots!)
  • Implemented slot moving (used to have to discard and re-add)
  • Implemented cost and design feature labels in ship designer
  • Fixed a crash when the production window is not open, and a new design is created (tried to update the production list with the new design...)
  • Improved zoom-in/zoom-out behavior (less shifting of the center point)


Here we can see the path highlighting I added last time. It also shows a ship with no engine being rejected. I also made the ship designer window a default size, which should reduce window resizing jitter. You can also see the cost/feature labels below the ship layout.

Wednesday, April 09, 2008

Stuff I've read lately

"The Faded Sun: Shon'Jir" (C.J. Cherryh) - This is the second book in the Faded Sun universe. I hadn't realized there was a trilogy here. In the first book, "the People" (mri) were reduced from millions to two (and brother and sister at that). The second book focuses on a human sent with the last two mri on a journey to their homeworld. Not the best Cherryh, but pretty good.

Saturday, April 05, 2008

New Stars Status

Ok, sorry, been a long while... things are pretty close now, and it is sometimes hard to be motivated to finish :)



I've fixed the clearing of private information from enemy scans. This was a lot more intrusive than I had imagined.

We have to clear the fleet and design names from enemy scans. So what do we put there? I'm leaving it blank (so players can't name their designs "War Pig Scout" and confuse people...). But then, I had to update the client to fill in "War Pig Scout" when it sees a scout with a blank name. Except, where does "War Pig" come from? Seems, we never added a place to store the names of known enemies (players start without knowing the names and ids of other player races).

So, then I had to update the PlayerData structure, and the toXML and parseXML, and the regression files...


In other news, I added a highlight to the path of the currently selected ship (not shown).

I also fixed the next turn generation in the client. Note, it just goes ahead and generates a multi-player turn when any one player hits generate...

Tuesday, April 01, 2008

Stuff I've read lately

"Old Man's War" (John Scalzi) - This is the first book in the series including "Ghost Brigades". I didn't mind reading them out of order, there is not much overlap. Scalzi has an interesting universe here, it will be interesting to see where he takes it.

Monday, March 31, 2008

Card Game Client

The client is now usable. Here we can see a game of Texas hold-em. The cards can be moved around, and the movement is reflected to the other clients. I also have added the code to pop up more information on more complicated card sets.

Friday, March 28, 2008

Stuff I've read lately

"Manifold: Space" (Stephen Baxter) - This is a continuation of the Manifold: Time "manifold universe". It is basically an alternate history (near future), where now there are many alien intelligences (thanks to our hero's efforts in the first book). Baxter attempts to deal with the Fermi paradox by claiming galactic catastrophes. I'm not familiar with the physics involved, but it wasn't real satisfying. I liked the first book better, but this one had some touching points, and some interesting tech.

Sunday, March 23, 2008

Card Game Client

I've gotten the hello protocol working. Here you can see a jumble as three clients connect to each other on my machine.




The network topology is arbitrary. That is, any client can act as a server for new players to join. In my example, the client on the left started serving. Then the client on the right connected. The first stopped serving, then the second started. The third client connected to the second. You can see the third client sees welcome from both when it connects. The original two only see the new player when added.

I need to add the in-game messages. And I should probably handle clients quitting gracefully...

Saturday, March 22, 2008

Card Game Client

I haven't forgotten NewStars! I'll have another update soon...

But I have also thrown together a card game client (modeled after Apprentice). My client allows any card set, and will support any number of connected players (eventually). I have shuffling, drawing, and playing cards (including moving cards around) done.

Here is an odd nine card hand (and I forgot to shuffle until after drawing about six cards):



The main thing I need to add is the network messages for starting the game, and reflecting playing and re-arranging cards (I have the network connectivity [listen and call], as well as the code to reflect messages to everyone).

Friday, March 14, 2008

Stuff I've read lately

"Manifold: Time" (Stephen Baxter) - I was very curious where Baxter was going with this book. He starts with solid premises: the promise of off earth expansion and the inevitability of entropy (heat death of the universe). This theme peaks about halfway through (~page 206), as the main characters watch a video stream from the end of time.

Turns out, Baxter is bootstrapping himself an alternate history series (not that there is anything wrong with that). I have started the second book (Manifold: Space). We'll see how it goes...

Friday, February 29, 2008

Stuff I've read lately

"Invader" (C. J. Cherry) - Second book in the "Foreigner" series. It picks up right where the last left off. Cherryh is always rough on her poor characters. But Cameron (the guy in this one) spends a lot of time struggling with a powerful sense of loneliness. Kind of unusual for Cherryh, but very well done.

"The Ghost Brigades" (John Scalzi) - Apparently this book is a sort of sequel to "Old Man's War". At least, it is set in the same universe. I will have to read that one, because it is a pretty interesting universe. Scalzi does a good job with building deep characters.

Saturday, February 23, 2008

Stuff I've read lately

"The Android's Dream" (John Scalzi) - This is the first Scalzi book I've read. I find his humor to be unique, and I like it a lot. I found myself laughing out loud frequently (first book to do that to me was the Hitchhiker's Guide).

Friday, February 08, 2008

Stuff I've read lately

"The Far Side of the Stars" (David Drake) - This is the third novel in the Lt. Leary series. It is classic Drake, classic Lt. Leary. I was surprised to see an all-knowing tree, though. Don't normally see something so mystical from Drake. Of course, Leary uses it to find a bauble for his current employer, and protect his country from a sneak attack :).

Wednesday, January 30, 2008

Stuff I've read lately

"Diamond Dogs, Turquoise Days" (Alastair Reynolds) - This is two novellas bound together, set in the "Chasm City" universe. I found the first to be way too much "Cube" (although Reynolds is at least gracious enough to give Cube a nod). The second story, about an ocean of biological computers storing personalities, was much better. Although Reynolds tries to tie it back to the first in one line, which seemed a stretch.

"Foreigner" (C. J. Cherryh) - Classic Cherryh. Although the main character doesn't start his stress time until about one hundred pages from the end (of 373). The subtitle is "a novel of first contact", which I find an overexploited topic. Actually, it is a "novel about how first contact can seem to go well at first, then later it turns out the parties were talking past one another, leading to lots of misunderstanding and tragedy." Of course, that is too long for the subtitle :)

"Why the Ten Commandments Matter" (D. James Kennedy) - Reviewed on my faith blog.

"The Selfish Gene" (Richard Dawkins) - Reviewed on my faith blog.