Friday, December 31, 2010

Stuff I've read lately

"The Reenchantment of Nature" (Alister McGrath) - Reviewed on my faith blog.

Tuesday, December 28, 2010

Stuff I've read lately

"The Best of the Best" (ed. Gardner Dozois) - A collection of science fiction stories from 1981 to 2002. I was surprised that several of them were not very good. It is unclear whether the selection criteria is "this is representative of the year", rather than "this is a pleasure to read". I was also surprised that two of the stories were very similar (life in a virtual world).

Sunday, December 26, 2010

Stuff I've read lately

"Guards! Guards!" (Terry Pratchett)(audio) - I hadn't realized Discworld did not have dragons. A lot of characterization of the night watch, which I don't recall before.

Wednesday, December 15, 2010

Stuff I've read lately

"J is for Judgment" (Sue Grafton)(audio) - Meh. Kinsey did manage to avoid killing anybody this time. The ex-cop red herring totally fooled me. I figured he had to be the murderer. The jilted girlfriend didn't seem capable of it.

Saturday, December 04, 2010

Stuff I've read lately

"Valkyrie" (Philipp Freiherr von Boeselager)(audio) - This is (somewhat) about the attempt to kill Hitler by German army officers. Most of the story is about Boeselager's experience in the war (the book is short, and the war frames the events).

The interesting points:
  1. Initial thoughts came from Hitler's mismanagement of the war
  2. Discovery of atrocities by the SS added fuel
  3. There was no attempt until summer 1943
  4. Matters were complicated by the realization that Himmler also needed to be killed, and a total coup arranged to prevent further Nazi dictatorship
There is a nice bit near the end, when the Russians are driving west. While retreating, they meet British troops. After surrendering (gladly), they tell the British about the Russians. The British offer to let them help fight the Russians. Boeselager says, (something to the effect of) "I prefer not to".

Thursday, December 02, 2010

Stuff I've read lately

"Black Bodies and Quantum Cats" (Jennifer Ouellette) - I was disappointed by this book. Popularizing advanced physics is hard, and Ouellette does a good job of making it accessible to the layman. That said, I was looking for more technical details, at least some of the problems driving solutions. The metaphors were well chosen (I think I learned more about modern culture than physics), but metaphors can only go so far.

Tuesday, November 30, 2010

Stuff I've read lately

"Finding Darwin's God" (Kenneth Miller) - Reviewed on my faith blog.

"The Last Centurion" (John Ringo) - Only Ringo could make a disaster which eliminates 50% of the world population funny. It's basically a fantasy scenario where liberal ideas and policies selectively kill themselves off, leaving conservatives to rule the world. I expected more action scenes. He probably needed to leave out one scenario and go into more detail in the remainder.

Monday, November 22, 2010

Stuff I've read lately

"The January Dancer" (Michael Flynn) - I am really enjoying Flynn. This story was really well done. In this universe, FTL is done via regions of space with higher local c (to enter the "Electric Avenue"). The main problem I saw is that Flynn required ships to approach local c to enter these regions. The ending was a little anticlimactic, but understandable for a short book (350 pages). I'm not going to encourage 800 page monstrosities.

Sunday, November 21, 2010

Stuff I've read lately

"I is for Innocent" (Sue Grafton)(audio) - Grafton didn't have me fooled. Well, I was fooled for a little while. Going in, I knew the obviously guilty guy had to be guilty (despite the title). But, near the end, it looked like he really was innocent (the most suspicious guy haven't picked up some hapless mook for obvious en-murder-ation).

Of course, the obviously guilty guy really was guilty. The suspicious guy was just suspicious.

Body count: we had:
  1. the original murderee
  2. the detective who Kinsey replaces
  3. hapless mook on the night of the main murder
  4. main bad guy (courtesy Kinsey, of course)

Friday, November 12, 2010

Stuff I've read lately

"Pride and Prejudice and Zombies" (Seth Grahame Smith)(audio) - It's funny, the book is actually listed as "by Jane Austen and Seth Smith". It's really a good idea; take an old stuffy book and add in a bunch of scenes with zombies.

A similar book was Philip Jose Farmer's "The Other Log of Phileas Fogg" (based on "Around the World in 80 Days"). In that book, Farmer created a whole story in between the breaks in the original.

Here, Smith took the original text, then made slight changes. It actually had me going for a while. I considered going through the original to find the differences (did Wickham really get crippled?). Then I realized, wait "Pride and Prejudice" was one of the worst books I ever had to read! (The worst being "The Illustrated Man" and second worst being "Where the Red Fern Grows")

Sadly, the book did need more zombies. It is a hard trade off - keeping the original text, and adding enough zombies to make it interesting.

I almost want to grab the text for "Old Man and the Sea" and make "Old Man and the Sea and Zombies" (Zombie fish? Drowned?).

Thursday, November 11, 2010

Software Updates

A NewStars update!

Surprise, surprise, the first executable didn't work (at all). The second executable mostly worked, the third executable should work (haven't heard any complaints!)

Each executable is about 3 MB, which takes several minutes to upload (no FIOS for me right now).

But, there is a way to update a Starkit piecemeal! Just make a list of files to check for updates, then foreach s in that list:

if {[file exists $s]} {
file rename -force $s [file join $starkit::topdir $s]
}

So, I can update one file and just drop it in the runtime directory, and it will slurp it into the archive.

Of course, Windows becomes extremely angry if you try and update an exe while it is running!

This is going to require me to drop from a Starpack back to a Starkit and ship Tclkit. I'll also need a batch file to couple everything together.

Irritating, but worth it to reduce update sizes.

Tuesday, November 02, 2010

Stuff I've read lately

"The Wreck of the River of Stars" (Michael Flynn) - The first book I read by Flynn ("Fallen Angels") left me full of meh.

It was a strange set of circumstances that led me back to Flynn.

Imonk had a post about aliens and Christianity (what with all the talk r.e. Gliese 581g). There, someone had a comment about dogheads, and linked to Flynn's blog. His blog interested me enough to try another of his books.

"Wreck" is a tragedy. It seems like a lot of current SF is depressing, Wreck still manages to be enjoyable.

The story entails the series of accidents which lead to the loss of the River of Stars (a hybrid magsail/fusion torch ship headed into Jupiter). It is very much like the old story of the man who sells his watch to buy a braid for his wife's hair - while the wife sells her hair to buy a new band for the watch.

Many people think SF is all about technology and science. Really, it is about people. The science and far future settings allow the author to strip away the conventions that the reader is accustomed to and reveal aspects of raw human nature.

Flynn excels at this. The wreck is due to the conflicts of human nature; the science behind the events are secondary. The ruined careers, the last chance for glory, the longing for the good old days, interpersonal squabbles, simple hatred and jealousy.

A sad story, but well done.

I particularly like Flynn's snarky comments:
Twenty-four DeCant (to the sail master): "Then, if you're staying... I'm staying."
Captain Gorgas: "We don't seem to have gotten this 'abandon ship' thing quite right."

Monday, November 01, 2010

Titanic

I have almost finished "The Wreck of the River of Stars". It got me thinking a lot about the Titanic (which I'm sure was the parallel the author had in mind).

As I remember it, there were a number of factors involved, any one of which might have reduced the magnitude of the disaster:
  1. Ice cube tray effect - the bulkheads should have run higher, but were shortened for aesthetic effect
  2. Running too fast (trying to break a speed record)
  3. Reversing engines (their rudder design worked better in forward)
  4. Poor utilization of lifeboats
  5. Poor communication with other ships
Of course, Wikipedia is the wet blanket on many of these ideas:
  1. "The height of the bulkhead deck above the water line in flooded condition was well above the requirements"
  2. "Captain Smith to increase speed in order to make an early landfall... There is little evidence for this having happened"
  3. "The Olympic using the same semi-oval shaped rudder as Titanic's was able to turn in a virtual moment's notice"
  4. "The White Star Line actually exceeded the regulations by including four more collapsible lifeboats" (although regulations were out of date). Lifeboats were not intended for carrying everyone at once, but for ferrying to a rescue ship (so 1/3 capacity means three round trips).
  5. "The closest ship to respond was Cunard Line's Carpathia 58 miles (93 km) away, which could arrive in an estimated four hours—too late to rescue all of Titanic's passengers"
Ahh, well.

Saturday, October 30, 2010

Stuff I've read lately

"H is for Homicide" (Sue Grafton)(audio) - I was surprised. Kinsey actually managed to get through the book without plugging anyone. It was a close thing; she had her chance but preferred not to, apparently. It was interesting to hear all the details for auto insurance fraud. Seems like more work than regular work.

Sunday, October 24, 2010

Stuff I've read lately

"Quantum Generations" (Helge Kragh) - This is a history of physics in the 20th century. It covers quite a lot of territory, and attempts to give a little taste of everything. This means there is a lot of material that isn't as interesting as other parts (but everyone should find something interesting).

I particularly liked learning more about some of the personalities behind the discoveries (especially people I didn't know much about like Dirac). Also, I like hearing about what problems people were trying to solve when they made a discovery (like how investigations into blackbody radiation led to quantum physics).

Thursday, October 21, 2010

Stuff I've read lately

"U is for Undertow" (Sue Grafton)(audio) - Here we are some twenty books in, and only a few left (unless she is going to go Excel on us "AA is for Aardvark", "AB is for Abbey Someone - Abbey Normal", through "BB is for BB Gun").

Grafton is definitely getting better at creating a real mystery (if that's what these books are for). We had several suspects, and it all started to come together slowly. You eventually figure out who done it, but not why or exactly how. Until it all makes sense and the book is over.

I must complain about the "undertow". Yes, there was a mention of it (the hapless mook's mother died in an undertow). Still, pretty weak.

Wednesday, October 20, 2010

A Starkit of Stars

I just sent out the first user-ready version of NewStars!

The main concern I had with using Tcl was that when it came time to distribute, every player would need to install Tcl.

However, there is a handy technology called "Star kit" (or in this case, "Star Package").

There are three components:
  1. Tclkit
  2. Starkit
  3. Star package
Tclkit is the program that does all the work. It is a single file Tcl/Tk interpreter.

A "Star kit" is a single file archive (like a jar) which contains all the Tcl files and DLL's needed, in whatever directory structure you like.

The Star package is a star kit, with tclkit wrapped in with self-extraction and execution.

I had used Freewrap before (which is another single file Tcl interpreter), but couldn't make it work.

Tclkit is very easy.

Starting from the base stars.tcl (in a scratch area):

sdx wrap stars.tcl
This creates a skeleton kit, with just the main script.

sdx unwrap stars.kit
Expand the kit virtual directory structure into a real directory structure - which we are going to populate and experiment with.

tclkit stars.vfs/main.tcl
Try and run from the real directory structure (for testing)

sdx wrap stars.kit
All done, make the kit (can test the kit with tclkit stars.kit).

sdx wrap stars -runtime tclkit
Bundle Tclkit into the Stars star kit, making a star package - which is executable on its own.

Mail out the executable!

Friday, October 08, 2010

Stuff I've read lately

"Bloom" (Wil McCarthy) - McCarthy is fast becoming my favorite current SF writer. I need to check the library for more of his work.

Bloom is a near future universe dominated by grey goo. Survivors are in two groups: one in the Belt, and one at Jupiter.

The story follows a reporter aboard an Immunity (who are charged with fighting goo invasions) ship. Their mission is to deploy sensors on Mars and Earth (both covered in goo).

McCarthy does a good job with characterization, and tension (some survivors believe the goo to be sentient).

The major technology is called "ladder down". It is basically alchemy, allowing the conversion of matter to energy (iron being the cusp of the reaction). Minerals are valued based on reaction products, making uranium the most valuable.

Tuesday, October 05, 2010

Stuff I've read lately

"T is for Trespass" (Sue Grafton)(audio) - Trespass was probably chosen because it sounds better than "T is for Torn-off arm". Best to let her have it, not wise to upset Kinsey.

Friday, October 01, 2010

Slope

(continuing my review of Facebook games, particularly the phenomenon of "open ended" games)

Most people think of games in terms of winning and losing. Even the longest games, like Axis and Allies or the Russian Campaign, eventually end. There are objectives along the way, by which one can measure progress.

In an open ended game, these objectives are illusory. People might complain about some group receiving a special item, or even getting it first.

However, in the long run this is irrelevant.

The most important aspect of an open ended game is your "slope". Slope is the rate of change.

As long as your slope is higher than your opponents, you will eventually get ahead (there is no winning or losing, only ahead or behind). If your slope is lower, even if you are currently ahead, you will (eventually) always be behind.

Even special items have only temporary value. Inflation will eventually degrade them. As long as your slope of acquiring new items is good, you will have new and better items.

Monday, September 27, 2010

Table Driven Madness

I've contemplated further work on NedOS, but the current barrier is pretty high. In order to enable interrupts (new style - ACPIA, not legacy PIC) I need to parse the AML tables. Retrieving the code isn't hard, but parsing it is a nightmare.

I have the source code of the Intel reference parser. It reminds me of some code from an earlier project - the table driven state machine.

Instead of a human readable handler (say for a FPS):
void onEvent(type)
{
switch(type)
{
case KEY_A: move_left();
case KEY_D: move_right();
case KEY_SPACE: fire();
}
}

you have this:
while( curState != END)
{
get_input(&input);
output = table[curState].out;
curState = table[curState][input].nextState;
}

On our project this made at least some sense. The hardware under development had the same tables, which allows you to fix bugs by patching the table ROM.

For pure software, I don't see the point. Now, instead of being able to read through some code and figure out what is going on, I get to state at tables like this:
/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */

/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),

Oh yea, that makes total sense. I see exactly what's happening here...

Tuesday, September 21, 2010

Stuff I've read lately

"G is for Gumshoe" (Sue Grafton)(audio) - I was surprised by this one. It was kind of hard to believe someone would care enough about Kinsey to put a hit on her. Harder to believe someone would take the offer for $1250 (actually $5000 for four people, including a judge and a DA). The story is somewhat confusing when the gunman ("G is for Gunman"?) shows up at the home of someone Kinsey is investigating. Who turns out to be a mass murderer, who is killed by the gunman. At least Kinsey managed not to kill anyone...

Sunday, September 12, 2010

Stuff I've read lately

"M is for Malice" (Sue Grafton)(audio) - I was surprised, this story actually had a character with a credible Christian testimony. I suddenly realized, "this guy is so dead". I was right. Again, it was impossible to determine who the murderer was. Not for lack of suspects:
  1. The older brother - work-aholic, possibly upset over money, bitter about past wrongs
  2. The younger brother - going through hero worship disappointment
  3. The youngest brother - always in need of more money
  4. The cook - feelings of disappointment to the family honor
  5. The nurse - who is so nondescript, even the other characters forget she's around most of the time
For a while, I figured it was #1. #2 gets arrested, and evidence points at #3. #4 really seemed to have some potential. So, of course, it was #5.

The worst part was there was a family which had been wronged in the past (mentioned briefly in the beginning, with no detail until near the end). But they were all supposed to be dead. Of course, one member had faked her own death, and set herself up as nurse so she could murder them. Of course.

Saturday, September 04, 2010

Stuff I've read lately

The Great Courses: Famous Romans (Rufus Fears)(audio) - This was not what I was expecting at all. It was more like a performance than a lecture. People were clapping at the end of each session...

Monday, August 30, 2010

Stuff I've read lately

"F is for Fugitive" (Sue Grafton)(audio) - I'm reminded of the old TV series "Murder She Wrote" (or, as I liked to call it "Murdered She Was"). Every week Jessica Fletcher (who was also the mother of the "Manchurian Candidate", aka John McCain) visits a relative (she had a lot!). And every week, that relative gets framed for murder, and Jessica needs to find the real killer.

I began to realize the incredible improbability of such events. It was far more likely that Jessica was the murderer. She was also skilled at framing people, as she would frame her relative (sloppily) while actually framing a third party so well (and tormenting them the whole episode - Columbo style) that they would confess!

This time, Kinsey shows up in a small town to investigate a murder from 17 years ago. By the time she is done: the accused murderer's friend and mother are dead, and the original murderee's mother is dead!

Not safe to be around Kinsey!

Friday, August 20, 2010

Stuff I've been reading

"E is for Evidence" (Sue Grafton)(audio) - Should be "E is for Explosions". Kinsey gets blown up (reeal goood!) twice. I don't think she's blown up at all in the other books...

I'm not sure what category these books fall into. They can't be "Whodunit". It's nearly impossible to figure out before the end. Half the time, I have to replay the ending just to figure out why the killer did what they did.

Thursday, August 19, 2010

Stuff I've been reading

"Zoe's Tale" (John Scalzi) - I really enjoy the "Old Man's War" universe, and Scalzi's style. That said, I am rather disappointed with this one.

Zoe's Tale is basically a retelling of "Lost Colony" from the point of view of Zoe. In the Acknowledgments, Scalzi tells how he thought this book would be easy - but it turned out very hard. Given his rather low bandwidth (one per year, which is typical for authors), I'd much rather see a new story.

I don't like to reread books. This one was different enough, and it has been long enough since I read LC, that I wasn't bothered. It was somewhat engaging; although it is more characterization, where the other OMW books focus more on events.

Wednesday, August 18, 2010

Since You've Been Gone

I couldn't hurt anymore
if you dropped a two-ton bowling ball on my toes

Since You've Been Gone
(O Since You've Been Gone)

You know I've been in a butt-load of pain
Since You've Been Gone


I feel almost as bad as I did
When you were still here!

Friday, August 13, 2010

Stuff I've been reading

"Claws That Catch" (John Ringo) - It's been a while since I've read any SF. Ringo comes through again!

The main thing I like about Ringo is brevity. This book is 343 pages long, compared to 600-800 for somebody like Stephenson.

Ringo captures the "hurry up and wait" and "long stretches of boredom, followed by moments of terror" of military life. There is no encounter with the enemy until page 278 - yet, he makes the "boring" parts interesting and funny (along with providing good characterization).

The closing action is as good as any you will find (with boarding actions, giant space battles, and fighters).

I hope Ringo keeps writing lots of books!

Thursday, August 12, 2010

NewStars Status

Whew, been a while... I have been putting off work on NewStars. I was afraid of "GUI load/unload", that is, the shuffling of cargo using the GUI. These orders have a separate order type from "Waypoint 0" (both happen before move). I was worried I would need to evaluate these orders in order to show the current levels on planets and in ships. Then, I would need to hide the orders in the order box, yet update the orders when the GUI instructs.

I figured out a way around all that. I left the GUI orders in place (visible and not evaluated) for loading/unloading to a planet. For ship-to-ship, I edit the XML (the reconciler handles edits in the XML).

The basic GUI is now ready:

Here we can see a transfer between the medium freighter and colony ship for player 1. The orders are executed when the window closes (I should add Cancel and Ok buttons...)

With that, everything needed to play is in the GUI!

Tuesday, August 10, 2010

Stuff I've been reading

"S is for Silence" (Sue Grafton)(audio) - I should gather statistics on how many people are killed in California. It seems like all of them are near (or killed directly by) Kinsey Millhone...

Monday, July 26, 2010

Stuff I've been reading

"N is for Noose" (Sue Grafton)(audio) -Meh.

Monday, July 19, 2010

Robot Builder

(continuing my review of Facebook games)

I previously mentioned a group that made several good games. The best of these is Robot Builder.

Robot Builder originally suffered from the same Add Me effect that most games have. Then some sort of bug caused them to remove it (this was before I started). They never did re-enable it, which turned out to be a great decision.

Game play is pretty simple. You have several resources to manage: energy, money, and robot tokens (RT, this is how they raise money, you can buy RT - although you can also find them in the game).

Energy is refilled at 10 per 15 minutes (as opposed to the typical 1/4 or 1/5). This is somewhat irritating early in the game, when you only have 10 or 11 max.

Your goal is to build robots. There are many different areas to salvage through (which take energy and money, sometimes RT). You can also do different "fights" in the arena - but these are basically different areas which can only be explored once per hour (or four hours, I forget).

You mainly raise money by selling parts, energy refills automatically, and you find RT. Different robots allow access to different arena fights, new areas, or give you additional energy storage.

Not a lot to see.

The hidden gem in this game is the market system.

The market allows players to trade items for RT. You can sell your rare parts (any parts really) for RT, and buy the parts you need. Or buy parts to sell for cash (giving RT a value in cash).

Being a market, there are tidal effects (as players sign off for the night, or sign on in the morning). This creates timing opportunities. You can buy parts when there are many players online as an investment, then sell them off when the market is short. You can also try to corner the market (by buying all the parts others supply, and holding out for higher prices).

This gives the game a lot of playability - even when there is no new content. It does require a large number of players to support the market. Sadly, total abandonment by the developers has pretty much killed this game.

Tuesday, July 13, 2010

Stuff I've read lately

R is for Ricochet (Sue Grafton)(audio) - It's interesting to bounce back and forth in the series (as library availability allows). The last book was from the 80's (or early 90's) and was 6 CD's. This book is from 2004 and is 10. There is not >50% more story...

I was especially disappointed that there was no ricochet. It is funny to hear a story about old time computers (carried in rolling luggage) and handfuls of floppy disks.

Monday, July 05, 2010

Frontierville

(continuing my review of Facebook games)
A quick word of warning about Zynga games (Mafia Wars, Farmville, Frontierville, among others). They are pretty public about how evil they are. They will sell you email to spammers, and do anything to spread to your friends and install toolbars on your browser. If you play their games (and I can't recommend any of them), make sure to use NoScript, Adblock, etc. and don't give them your email, make sure you block them from your wall and friends, etc...

So, continuing on the massive failure that is Farmville, there is now Frontierville.

The game mechanics (and engine) are basically the same - you have a set of land, on which you place buildings, crops, trees, and animals.

There are a number of changes, most of them bad: energy, wilderness, varmints.

Energy
In Farmville, you could plant your whole board in a 4 hour crop, come back in 4 hours and harvest it all (assuming you had the money). In Frontierville, every action takes 1 energy (like the energy in Mafia Wars). Of course, in Mafia Wars I have 1900 energy (at 1 energy per 5 minutes, that is 8 days). In Frontierville, I have 15 energy.

This does introduce some interesting strategy changes.

Now, you must pipeline out some crops in order to maximize experience. You can't just look at xp/hr, you must include energy as well (since all actions are 1 energy, this amounts to xp/crop). So, 3 day crops are the best, but you can't just fill the board with them. You have to stage them out, say 1 hour apart, 9 at a time (not 12, more later). This creates some interesting effects, when you start with a blank board, and want to scale up to a big harvest in 2 or 3 days (say over a long weekend). You lay down 9 of the 3 day jobs, and 9 one hour jobs (for when you come back). Then, in an hour, harvest and lay down 9 more of the 3-days. Rinse and repeat.

Wilderness
The wilderness is a huge pain. Your board is not open like in Farmville. It starts covered with all sorts of junk, which you have to expend energy to clear. Worse, the stuff grows back.

Varmints
This is probably the worst feature of all (especially when compounded with the other two). Every action has a chance to spawn a varmint (different ones for different actions). The varmint will block the 8 adjacent squares, forcing you to deal with it or pay 2 energy for actions. It takes 3 or 4 energy to remove a varmint (hence the 9 crops for a 12 energy period). If you luck out with no varmints, you need the energy for maintaining the wilderness anyway.

The game's isometric view is especially painful here. One time, I was clearing some trees, and a bear appeared. It was hidden behind a big tree, so I had to pay 2 energy times 12 to clear that tree!

Co-op Play
There is one nice new feature. In Farmville, you could visit your friends' farms. There you could get some extra xp and money by "helping out" (which actually did not help them at all). In Frontierville, you can actually help. This makes things a little better, but is not usually reliable enough to impact planning. You usually have more things than you have energy for, and friends can help there.

The game has just started, so it might get better - but probably not.

Saturday, July 03, 2010

Farmville

(continuing my review of Facebook games)

Farmville is a really bad game. Shockingly bad - especially considering how many people play it (Wikipedia claims 80 million installs).

The game mechanics are very simple, you have a set of land (which gets bigger as you progress) which you can fill with crops, trees, animals, and buildings. Buildings serve no point, except to give you experience points (and look pretty).

There is an interesting trade-off between crops and trees/animals.

Every unit of production has some cost, and produces some experience points and money. Trees and animals produce repeatedly, while crops are one-shot. Also, crops will expire (wither) if they are not gathered after reaching term - while trees and animals will keep indefinitely.

The optimal strategy is to maximize your return in money and experience (money can buy experience) for the land you have, and the time you have. If you can dedicate lots of time, you can make a lot of money and experience very quickly.

Higher levels give access to new crops, etc. but this is of limited effect. You have your spreadsheet of $/hr and xp/hr, grouped into time groups (4 hours, 8 hours, 1 day, etc.). Based on your schedule, you put down some crops. If you aren't sure when you will be back, you can invest more in trees or animals.

At some point they added vehicles, which reduces the tedium of plow/plant/harvest some (a vehicle can do 4 at a time). Not really worth the time, though.

Friday, July 02, 2010

I'm a Wiener

(continuing my review of Facebook games)
I got style, I got grace.

Perhaps the saddest part of Facebook games is the lack of winning.

For some reason, game designers think that if they don't have an ending, and don't declare a winner, people will just play forever.

Of course, this requires a steady rollout of new content. So really, you're just playing new games with a steady increase in gear - which leads to massive inflation (old gear becomes useless).

Usually, the developers can't keep up with the rate of consumption, and the game dies anyway.

So, ironically, the very attempt at creating a unending game ends the game (there's a sermon in there).

Friday, June 25, 2010

Stuff I've read lately

"D is for Deadbeat" (Sue Grafton)(audio) - This book actually covers some of Grafton's view of Christianity, and its not positive. Still, the book was moving in a way that these usually aren't.

Monday, June 14, 2010

Stuff I've read lately

"C is for Corpse" (Sue Grafton)(audio) - It was ok.

Friday, May 28, 2010

git rebase /home/you us

(That's "all your base are belong to us" in git-speak)
I think I am starting to get the hang of git.

The key is not to think of "versions" of the codebase, but rather, in terms of "patches". Git is not "version control" it is "patch management".

The rebase command is an excellent example of this, and it is really unusual and powerful (which can make it dangerous).

The best thing about it, is that it allows you to avoid the "shoulda syndrome".

For example, imagine you are working on a new feature. You spot a bug, and fix it on the spot.

In cvs or subversion, you have violated the "shoulda" policy dictated by these tools. You "shoulda" put your current changes somewhere else (or used a new area, I have about 4 local copies of my svn work project).

Now, in order to commit just the fix, you are going to have a lot of pain and suffering to split things out, test it, and commit it, then merge back.

But in git, there is no "shoulda". You can fix that bug, and carry on with life.

How so?

First, you need to get all your changes into patches. Use "add -i" (interactive) to get everything in (add interactive allows you to commit individual lines from a file, if necessary). Then you can use branches to test just the patches you want to commit.

The real power comes from rebase.

Rebasing is confusing (and potentially dangerous), because it allows you to edit the history of the repo.

It is also two different commands in one.

The first command is plain rebase (git rebase <relativeHead>). This is used in place of "git pull" to update a working branch (keeping it relative to that branch, rather than merging).

The second command is editing history (git rebase -i <relativeHead>). This allows you to shuffle the order of patches, and merge patches.

So if the patches to your working area are:
trunk
Start of new feature
Additional feature
More stuff
Bug fix

You can shuffle the bug fix up to right after the branch from the trunk. You can then push that patch into the trunk. Your working area is clean, and you don't have to bother the trunk with all your intermediate commits.

Thursday, May 27, 2010

Stuff I've read lately

"B is for Burglar" (Sue Grafton)(audio) - Much better than the previous book. Grafton stays away from the romance novel feel, and the narrator is much better. My only complaint is that the ending is over the top (especially in light of the last book).

Friday, May 14, 2010

git clone harrier

Well, I've started to get a feel for git, and it is not a good feeling.

It is the sort of, hollow, cold feeling you get when you see a Pat bus driving down the street.

I have been reading a lot, trying to figure out what is going on.

For personal projects, it is fine. If a little weird. "git commit -a" (not recommended, but sometimes you want to save some typing) misses new files. git diff doesn't always work right (show me what I've changed), sometimes you need to say "git diff HEAD".

At work, it has been more disastrous.

I admit, the first time, I gave it the hardest possible problem. I branched, then reformatted all the code. The next merge was totally hosed.

Ok, that was a hard problem, I can forgive that (although git seemed even more confused than svn - I find svn merge to be very good, git feels closer to the old cvs merge).

Then, I made some straight forward changes on another branch.

Still I get all sorts of weird merge conflicts.

Ugh.

I have had some success messing around with rebase. Still not convinced it is a good idea...

Wednesday, April 14, 2010

The Tcl War

Weird thing came up twice on the web in the past two days. First was a search for "Tcl nntps", the second was on Reddit.

I've always been an admirer of Richard Stallman. Although I prefer vi to emacs, and GNU Hurd seems like total vaporware, you have to admire the impact Stallman has had, and his consistent application of his values.

But now, I'm afraid I will have to charge him with heinous war crimes against humanity!

His objections are pretty weak (no linked lists?, slow adds?). And to suggest Lisp as a replacement is just silly. Tcl syntax is weird, but Lisp (from Wikipedia)?

(let loop ((n 1))
(if (<= n 10)
(begin
(display n)(newline)
(loop (+ n 1)))))

I have no idea what that does. I think it prints the numbers one to ten...
In Tcl:
for {set i 0} {$i <= 10} {incr i} {
puts $i
}

A lot closer to C. Actually, Tcl has gotten a lot easier for me once I started thinking of it as a prefix type language (like Lisp). Just with [] and {} instead of ().

Saturday, April 10, 2010

Delight

(Continuing my experiences with the D programming language) Hmm, missing some back links before this.

I have been looking into what it will take to program my video card (Nvidia GeForce FX 5200). It's embarrassing how little information is out there. Nvidia used to maintain an open source driver - which only supported 2D. Given their refusal to support 3D, I have to wonder about the quality of the 2D support. There is a project to develop 3D support, but their focus is newer cards (and they are short-staffed).

I've been itching to write a cycle based processor model, and it seems now would be the best time. To mix things up a little, I've decided to write in D.

I've been working (on and off) about a week now, and I must say that programming in D is quite delightful.

Best parts:
  • No IDE needed - I use vi and make, and its no problem at all
  • Enums auto-namespace - all the enums are like RegBytes.BH, no need for crazy C++ kung-fu
  • Built-in array - being able to write:
    mem_[startAddr..startAddr+img.length] = img;

    with auto-bounds checking is a lot nicer than fighting with the dangers of memcopy
  • Writefln - writefln("Null in decoder for byte: ", "%x", op); (format as needed)
I haven't had any real negative experiences. I need to figure out how dependencies work. I'm not sure when I need to recompile a module based on what it imports. I've had to do some make cleans.
There are some gotchas for hardened C++ users, but they are related to improvements:
  • struct and class are different - this is a good thing, but it can be easy to forget. A struct is plain-old-data (like an int), so it is allocated automatically. A class is a pointer, so it defaults to null. You need "ptr = new Class" before you can use it. I ran into this once.
  • Circular import dependencies - you have to avoid them. Sometimes this means you need to break some stuff into a separate file. C++ solves this by using includes to toss everything into one big stewpot and doing multiple passes.

Friday, April 02, 2010

Hello, Graphics World

Of course, a screen shot can make it look like you are much further along than you really are...

I don't have interrupts (so no disk, or keyboard) and I can't create processes, but I can (almost) print "Hello world".

Except, I can't print capital letters, or spaces...

Monday, March 29, 2010

Bugs

With all these successful screenshots, you might think this stuff just turns out correctly on the first try... here is a good example of how tricky it is to get everything right:

I am trying to print the 'H' in "Hello world". It should line up in the upper right of the black box. Instead, there are sets of white pixels spread out in the middle of the screen (look closely, they come in pairs spread apart, with one solid line - the bar of the 'H').

This tells me two things:
  1. My starting point into the video memory is short by about one xterm height
  2. My next row code is off, by maybe 6 or so

Sunday, March 21, 2010

Console Coming Soon

This was a lot of fun!

I am supposed to be enabling interrupts (which will require turning off the PIC, configuring the IOPIC, and enabling the local APIC - a lot of boring and complicated stuff).

So instead, I thought about drawing console windows!

I got to think about fill_rect, and I have enough of the fixed width font ready to print Hello world.

Thursday, March 04, 2010

NewStars Status

Cool little bug managed to waste a week of John's time...

I had noticed a difference in surface minerals for player 1 in 2401. Examining the mining code indicated it was probably due to scrapping the JOAT remote miner.

The code which calculates ship cost and scrap value is pretty complicated, so it seemed natural the bug would be there.

After digging into it, it became apparent that the bug was due to the miner being on a destroyer hull!

This is due to a copy/paste bug in the code which gives players their initial fleets:
In function makeInitialJoatMiner (copied from the make destroyer code)
Ship *design = new Ship(*(pd->gd_->hullList[destroyer_hull]));

Oops.

Sunday, February 28, 2010

Tcl Alarm

Alright, I have laid the ground work for our helper program, now let's see what Tcl can do:

First, we might have multiple things to wait for, and we want to see how much time is left, not just rely on a single sound to notify us:
set $var $tm
lappend ::dl $var
lappend ::al $var

pack [frame .tMain.f$var] -side top -expand 1 -fill x
pack [label .tMain.lT$var -text $tx] -in .tMain.f$var -side left
pack [label .tMain.l$var] -in .tMain.f$var -side right

This is actually a function (proc addLine {var tm tx}), so I can add lines programmatically.

The "lines" are placed in the window, each one representing a timer counting down.
You have parameters:
  • var - the variable which will hold the time, this is displayed elsewhere, so it can be descriptive, and is used inside functions, so it needs the global namespace like "::zombies" or "::arena"
  • tm - the time (in seconds) until the event
  • tx - the text description for the window
al and dl are global lists. dl is used for decrementing the timers, al is all the timers available (for listing the timers to reset)

Now, when we want to decrement all the timers:
proc decList {il} {
upvar $il l

# foreach variable in the list
foreach iu $l {
upvar $iu i

# decrement it
incr i -1

# update the GUI
.tMain.l$iu configure -text [tformat $i]

# check for timer expire
if {$i == 0} {
# remove the timer from the list
set idx [lsearch $l $iu]
set l [lreplace $l $idx $idx]

# flash the text
after 1000 ".tMain.lT$iu configure -fg #008800"
after 5000 ".tMain.lT$iu configure -fg #000000"

playSound
}
}
}

The upvar may not be needed, I was trying to work around not using globals...

tformat is my "time format". It converts a number of seconds into a nice "35 m 0 s" or "1 h 0 m 50 s" string for pretty display. It is left as an exercise for the reader.

Saturday, February 27, 2010

Better Games

(Continuing my treatment of Facebook games)

Given the number of * Wars games there are, there is sadly little content of interest. There is some adventure in exploring new content, but no staying power. They eventually devolve into a treadmill of grinding through new content, and waiting for new content. More jobs with different names dropping equipment with higher numbers and different names.

However, there is one group developing interesting games, and another with one good game (Nitrous Racing, and several boring games: Monster Defense and Fish Life, among others).

The first single-handedly developed five games that I was willing to try. Three of those were pretty good.

The games are Mad Scientist, Robot Builder, Robotico, Star Conquest, and War Machine.

The first three are good enough, that I will break them out separately. Star Conquest was a good try, and worth discussing. War Machine is actually one of the best * Wars games, but, ultimately, is not enough better.

I wanted to give a peak today of a tool I developed to help with the timers (in Tcl of course!).

Let's say you have some zombies cooking in 14 minutes for Mad Scientist, or you need to wait 45 minutes for more energy. You're in the middle of New Stars or NedOS programming, so you might get distracted and forget to look at a clock for an hour or two...

Enter Snack. Snack is a Tcl package for generating sound. It is really easy in wish:

$ package require snack

Now you need to load an alarm sound to notify you that it is time.

$ snack::sound s -load $path_to_file

Then set the alarm:
$ after [expr ($hour*3600 + $min*60 + $sec)*1000] {s play}

That's it. Just set the variables {hour,min,sec} and up-arrow to the after, and hit enter.

Friday, February 26, 2010

PvP

(Continuing my treatment on Facebook games)

I've mentioned PvP a couple times now, and for those who don't know (and haven't googled it yet), it is "Player vs. Player".

Now, some might think the purpose of a game (especially a game on a social network) would be for players to compete. The alternative is PvE (environment), sometimes called AI (which is too generous), or simply computer players. This is how Civilization and a lot of other games work, and work well.

All Facebook games are competitive, in that you can see what your friends and other players have accomplished, and use that to drive you to do more.

In the * Wars games, the PvP aspect is an in-game effect where you improve and the other player is set back (some games lack this PvP aspect, while being similar in most other ways. e.g. Metropolis)

This might seem to be the main focus of the game (it is for some), but in most cases, it is a simply a small annoyance.

In most games, your PvP power is proportional to the number of people in your network (which is usually capped at 500).

Now, no one has 500 friends, much less 500 friends all interested in playing the same game.

This leads to huge "Add Me" threads on the forums, and giant email chains.

If you're not interested in that (and I'm not), there is a simple precaution to avoid serious setback - bank (or spend) your money at the end of a session (and ignore the "defeated" statistic in your profile).

Thursday, February 25, 2010

* Wars

(Continuing from last time)

The biggest part of Facebook games is resource management. Usually, the biggest resource is your own time (micro-management). This is because Facebook is looking for ad impressions, so every time you load a new page, they get revenue.

Still, most games place some limit on your activity. This is usually referred to as "Energy" or "Fuel" or some other stat. It recharges at a flat rate (often 1 point per four minutes). Usually there is a recharge benefit which you can send to your friends.

The * Wars games all have the following character attributes: attack, defense, energy, stamina, health. Stamina is energy for PvP.

Advancement is experience point based, with experience given for jobs (which consume energy). Each level you gain 5 points which can be spent into your attributes. Also, when you level up, your ablative attributes (health, energy, stamina) are recharged

There is a virtuous cycle here.

Energy -> jobs -> experience -> level up (energy refilled) -> spend on energy attribute

In Mafia Wars, there were several times I was able to level up multiple times in a row (especially when coupled with the daily free energy recharge). The experience cost per level grows linearly, and there is a bonus for the first time you "complete" a job (do the job a lot).

So where do the spreadsheets come in?
Not all jobs are created equal. Your spreadsheet should include Xp/Energy and $/energy (money is needed for equipment, which is used in PvP and in enabling new jobs, usually it is not a limiting factor). Some jobs also drop special equipment. You will need a spreadsheet to track what equipment you have and need, and which drops are best (some games have wikis, but it is good to have a local copy).

Most games also have a notion of "investment" (current cash goes into giving cash per time). You can make a spreadsheet detailing the various return rates, but I haven't seen a game where it wasn't easier to just get money through jobs (which you are doing for the xp anyway - that is, high xp/energy and $/energy usually go together).

Wednesday, February 24, 2010

Add Me

A while back, I promised to tell all about Facebook games.

It has been a hard road, full of sacrifice.

I can say there is something new about Facebook games - the "add me" effect.

This is largely by design. Facebook encourages developers to incorporate some social aspect into games.

It's also apparent that this is often done with little or no thought or effort.

The net effect is that "Add Me" games can vary from annoying to unplayable - based on your willingness to add yourself to huge chain lists of email addresses on the forums.

Most games are built on a single dynamic - building. The other distinguishing feature is PvP.

When I say "building", it is basically grinding on your character/empire/whatever. There is little or no danger of loss. It is just a matter of you putting in the time. It can still be fun, especially when there is a wide variety of things to optimize for, and you can build spreadsheets to determine the optimal path (because a good game leads to building spreadsheets! I'm serious!)

The most popular games fall into what I call * Wars (pronounced Star Wars). That is the glob *, meaning "match everything". You have Mafia Wars, Mob Wars, Dragon Wars, Vampire Wars, Fashion Wars. I have played a handful of them, and they all play the same. A lot of other games use the same dynamic, but don't have Wars in the name - Street Racing, War Machine (now called War Metal), Star Conquest, even the RPG Hammerfall is really the same.

More later...

Tuesday, February 23, 2010

OS Info

I must say that Bochs is really a wonderful tool for OS development. The debugger is great: with breakpoints, single step, and full state inspection. It supports command history, and editing the command line.

That said, some stuff just needs to be printed at run time for inspection (particularly anything with loops).

With that in mind, I have forked the CD boot code into a program to dump the relevant structures for inspection. It keeps the screen in text mode, and is printing from 64 bit mode.

Monday, February 22, 2010

NewStars Status

Turn 2!

Here we can see some problems, although nothing earth shattering.

There is some difference in mining or scrapping (the JOAT miner was scapped on turn 1). But the pop growth looks good, as well as resource calculation, and production. I've also checked the resources going into research, and they match.

The x resources out of y is a known Tcl bug. I just put "x of x", and don't bother to include the research tax...

There should be a WM scout visible, but I need to create the P2 orders to make that happen...

Monday, February 15, 2010

Aqua Screen of Life

Oooh, aahh.

No, I didn't just change the pixel color.

The red screen is now part of the kernel panic function (which is now well tested - remind me to tell the story about the difference between step and next in the debugger, and how I spent an hour trying to figure out why call stopped working in 64 bit mode). If everything goes well, you get the aqua screen, else BOOM! red screen.

Under the covers, the code is now searching memory for the ACPI tables. Find them, you get aqua (actually alternating blue and green pixels, I write two pixels at a time 0x0000FF00_000000FF).

Sunday, February 14, 2010

Red Screen of Death

Check it out!

That beautiful red screen is brought to you by the NedOS boot loader, and the NedOS kernel (which is currently just a rep stosq and an infinite loop).

I was able to fit all the boot loader functionality into one 512 B sector.

It has to:
  1. Retrieve the memory map from the BIOS
  2. Enable A20
  3. Get a list of video modes, pick one, and set it
  4. Transition the system into 64 bit paged mode
The memory map code is kind of a hog. Together with the logic for picking a video mode, the boot loader is nearly 500 B. That is after a lot of effort to minimize code size.

That is too big for a harddrive boot sector (which has 64 B of partition tables and a 2 B signature). I have a version where I strip out all the error checking, that brings the size of the memory map code down significantly. Still, it is currently 433 B - leaving about 10 B to actually load something. Not enough to walk the partition table and figure out on its own what to load. I will have to load something from a hard coded location.

I'd like to be able to draw a text window, and put some text in it...

Saturday, February 13, 2010

New Stars Status

Another day, another bug!

This time, it looks like a bug (or bizarre algorithm) in Stars!

John was kind enough to fix the previous bug.

Now, our Long Range Scout has picked up a ly in the X direction.

The relevant X,Y pairs are:
Finale 78, 80
New Stars 101, 108
Stars 100, 108

The distances are 36.24 ly for New Stars, and 35.61 for Stars. It's really not clear why Stars didn't give up that last ly...

I'm tempted to call "Will Not Fix".

How can our lock step hope to succeed with bizarre bugs like this :(

Friday, January 29, 2010

HTML Canvas

Interesting development. The guys behind FreeCiv have developed a client using the HTML 5 canvas.

I remember looking at a proposal for canvas a while back. It was sorely lacking from the Tcl canvas (if only Tcl had made it as a web standard!).

But, if you can implement FreeCiv in it, maybe it has gotten better (or maybe FreeCiv doesn't use circles...).

Probably worth looking into. A NewStars web client would be nice.

Tuesday, January 26, 2010

NedOS on CD

Booting from a floppy is a good start. But there's just not much you can do with 1.44MB.

I looked into bootable CDs, and they are really nice!
  • You get >600 MB of storage for your OS and app code + read-only data.
  • Writable CDs are cheap and portable, potentially allowing you to run on any machine
  • You don't risk messing up your hard drive (particularly the boot sector)
Best of all, the boot CD spec (El Torito) allows you to load multiple sectors immediately. That means no messing with BIOS read disk routines in the boot loader.

Of course, switching my boot floppy code to CD ran into multiple problems (all stupid ones).
  • The boot code can load into any address. 0 will get you the default (7c00), but just to make sure I could write whatever I want when I need to, I set it to 7c00.
  • Of course, it is a segment address, so I got 7c000, which is near 512K, not 32K, so I was executing uninitialized RAM.
  • Then, when I fixed the segment, I forgot that my makecd program only writes those sectors for new disks, so I still had the old values.
  • The boot floppy code is org 7c3e (to skip the Bios Param Block), but the CD code needs org 7c00.
It took longer than it should of, but I can now boot from CD!

Monday, January 25, 2010

New Stars Status

Hopefully things will pick up...

Here we have our first turn gen, and our first bug!
Our move code has place the destroyer and the probe in the same location, while Stars has them one light year apart. Bizarro. Must be a rounding problem...

I also had to fix the recent file LRU yet again. Hopefully it is correct now.

Tuesday, January 19, 2010

New Stars Status

Not exactly a blitz, but moving along...

Here is player 2. Note, I have fixed the title bar. I did the Stars turn by hand, but the New Stars turn was generated from Tcl!

$ cat orders_P2_2400.tcl
set owd [pwd]
cd ../../../gui/tcl
load ./nstclgui.so
source nsCli.tcl

set nsGui::playerNum [newStars $::ns_open $owd/tiny_sparse_P2_Y2400.xml]
buildMyPlanetMap
set hwPID $nsGui::myPlanetMap(0)

set fid [findFleetByName "Armed Probe #2443026239740"]
sendFleetToPlanet "Armed Probe #2443026239740" [findPlanetByName Pervo]
sendFleetToPlanet "Armed Probe #2443026239740"
sendFleetToPlanet "Armed Probe #2443026239740"

# get a useful scout
newStars $::ns_design $::ns_loadPre scout "Smaugarian Peeping Tom"
newStars $::ns_design $::ns_save

# build it
newStars $::ns_planet $hwPID $::ns_addAtIndex 0 0 1 $::designMap(3)

# set orders for max growth
for {set i 0} {$i < 100} {incr i} {
newStars $::ns_planet $hwPID $::ns_addAtIndex 1 1 3
newStars $::ns_planet $hwPID $::ns_addAtIndex 2 1 4
}

newStars $::ns_save $owd/tiny_sparse_P2_Y2400.xml


Pasting Tcl code is so much easier than C++, a lot fewer < and >!

I had to override the logic for "sendFleetToPlanet" auto-pick. It picks the closest planet, but I wanted to send the Armed Probe on a one-way trip to cover a specific set of planets. The Smaug will cover closer planets.

I had to adjust the speed of the probe in Stars, but the New Stars auto-pick got the speed I wanted, very nice!

New Stars does not show what will finish, that is a very hard problem. I will have to address it at some point, though...

Saturday, January 16, 2010

New Stars Status

Let me start by saying the gcc maintainers are jerks.

I have heard this accusation often on comp.arch, but I was skeptical. Now I know it's true.

If you doubt, read this.

That was back in October, there is still no solution for Cygwin (as far as I can tell). My latest updates pulled down the latest versions, and now I can no longer build NewStars.

I had to back rev to gcc-3 (as mentioned in the post).

Which brings us:


Ahh yeah! Stars versus New Stars, head to head!

Turn 1, player 1 of the test game.

Obvious differences:
  1. Stars and New Stars have the origin of their graphics inverted. This creates a "mirror" effect when looking at the universe (not going to fix)
  2. Stars puts some useful info in the title bar (will fix ASAP)
  3. I am missing the planetary mineral concentrations (will fix, eventually)
More soon!

P.S. Interesting factoids
  1. Stars adds 1000 to x and y
  2. I used Tcl to verify the structure of the master xml
package require tdom
set doc [dom parse -channel [open tiny_sparse.xml]]
set root [$doc documentElement root]

set univP [$root selectNodes //UNIVERSE_PLANET_LIST/PLANET]
set playP [$root selectNodes //PLANET_LIST/PLANET]
puts "#\tX\tY\tName"
foreach p $univP {
set name [$p selectNodes string(NAME/text())]
set id [$p selectNodes string(OBJECTID/text())]
set x [$p selectNodes string(X_COORD/text())]
set y [$p selectNodes string(Y_COORD/text())]

incr x 1000
incr y 1000
puts "$id\t$x\t$y\t$name"
}

That creates the "Universe Definition File" (Report->Dump To Text File->Universe Definition). I have a longer version which checks the integrity of the player maps against the global map.

Saturday, January 09, 2010

We're On Pluto

I have been catching up on the newsgroup rec.arts.sf.science. There was an interesting interchange on Project Pluto.

Now, when some people think of Pluto, they think of the ninth planet (yes! a planet! My Very Excellent Mother Just Served Us Nine Pizzas). More, probably think of Mickey Mouse's dog.

Of course, Pluto is the Greek god of Hades/Death/the Underworld. That is probably the inspiration for this thing:
  • 75 foot long; 60,000 pound
  • nuclear ramjet, cruise missle bus
  • 26 nuclear warheads
The second point needs some explaining.
  • ramjet - flies by compressing incoming air, this requires a fair amount of air to work at all - end result - it cannot fly slower than the speed of sound (it would be launched using solid rocket boosters, and could never land)
  • nuclear - the incoming air is heated by being directly exposed to an unshielded, operating nuclear plant. This means the exhaust is highly radioactive.
  • cruise - designed to fly close to the ground (about 1000 feet)
  • missle bus - a missle that carries missles (the 26 warheads)
This thing (designed circa 1960!) would follow terrain using pre-constructed radar maps, shattering glass and damaging walls and roofs as it flew to its target - all the time irradiating everything it flew over. It would then pop out a nuke, which would detonate seconds later (Pluto flies just under one mile per second, so it is already miles away). Once it was out of nukes and losing power, it could be crashed into a secondary target (60,000 pounds at Mach 4, plus highly radioactive).

Magnum 360 said: "Thank you very much thats exactly what I was looking for. Wow thats amazing it had the possiablity of staying up in the air for months, to bad the project was stopped."

To which, Mike Ash says: "Too bad the unshielded and unfiltered airborne nuclear reactor with no ability to land after launch was stopped??!!"

This is pretty incredible work (terrain following using vacuum tubes?). Also, the sheer gall of the thing (spewing out radioactive exhaust). Of course, this was the same age which planned to blast a mountain into space using nuclear bombs!

You have to admire their sense of scale and boldness. Today, we are so safety conscious - we'd never do anything approaching this scale. It seems like there should be some middle ground...

Friday, January 08, 2010

New Stars Status

Well, looky here!



Here is the "Merge Fleets" dialog! (I know the spacing is off) It works! You can merge ships between fleets. I still don't have "Split All" and "Merge All", but they are basically macros that should be easy. All the core functionality is done.

I also fixed the "Goto" button in the "Other Fleets" area. It was really bugging me...

We are now ready to play! (except for fleet to fleet cargo transfer, but who ever does that :)

Thursday, January 07, 2010

Git 'er Done

I've finished looking over the "Why Git is Better Than X", and the propaganda pages from Bazaar and Mercurial (propaganda is good, you need to say why you think your system is better).

I think I had previously decided on Bazaar. I was really worried about Git on Windows, and Git's main features "Cheap Local Branches" and "The Staging Area" didn't impress me at the time. Bazaar has some really nice support for implementing different sharing schemes on top of the distributed model.

But now, I think Git is the way to go.

In my day-to-day work, I have at least three "local branches" in svn. They are:
  1. the working trunk - attached to the trunk, with all the changes I am thinking about making
  2. a clean trunk - this is my "Staging Area" where I copy changes in before commit
  3. an old copy of the trunk - for comparing really old revs (because history is not available offline in svn)
  4. a personal branch - for long term projects to make major changes
  5. a release branch - for when we are doing a public release
Each local repo can take up to 2 GB (if I need to build the executable). Wasting disk space isn't the biggest worry. It takes a long time to set up these repos, and a lot of work to keep them all in sync and up to date.

I really overlooked the Staging Area.

My concern was that I wouldn't be able to use it, because I need to test any changes before pushing anyway. Of course, I realized that I just need to push to my clean area, test there, then push to the "main" repo (as much as any repo is main in a distributed SCM).

Wednesday, January 06, 2010

Stuff I've read lately

"A is for Alibi" (Sue Grafton)(audio) - This is the first in the "Alphabet Murder" series. It's interesting to see how Grafton has developed as a writer.

And it is good they replaced this narrator.

She is terrible.

She has two tones - monotone and slightly deeper monotone. For an audio book, you need at least two distinct tones, so you can figure out when the speaker changes in a dialogue (basically, to denote the paragraph breaks). Distinct voices for each character and one for actions is a plus, but not absolutely necessary.

A lot of the time, I couldn't figure out who was talking - even if I was paying attention. And if distracted (say, by a crazy MD driver), it was easy to get lost. Sometimes it was hard to tell if someone was speaking or if something was happening.

That said, the story was ok. Grafton drifted some into "romance novel" territory, which she is obviously terrible at. Good to see she has dropped it in the later novels.

Tuesday, January 05, 2010

New Stars Status

So close now!

It's been a while since we had a Windows screen shot. See, it still looks the same! :)

I had to scp over the turn file from Linux for debugging, because I don't have a split case on Windows, and debugging through VNC can be a pain...

This looks like the normal split case, but look carefully...

The original fleet id is 234806..., now the fleet id is different. I did a split, where all the ships move into the new fleet (and the old fleet gets deleted). That was to test the fleet deletion code, which is needed for merge to be useful.

Now I can do merging.

Monday, January 04, 2010

Give in to the Darcs Side

Continuing from my last post, I did want to talk about SCM I will not be considering:

Darcs
  • Written in Haskell, considered the poster-program for Haskell. Haskell is a functional language, similar to ML. Given the horror of ML, and the behavior of Darcs - I am not motivated.
  • Operates on a "theory of patches". Finding the right set of patches, and applying them in the right order. I don't believe it is possible for a machine (currently) to handle this level of complexity. Heck, I don't know that I can handle the complexity!
  • Ate our repo, twice. Losing the repo is an unforgivable sin for SCM.
  • Was really slow. They are supposed to have fixed the number of "exponential merges" (nice). But it was slow all the time. The exponential merges were just insult to injury.
BitKeeper
  • Commerical software. No way I am going to pay for software for my personal projects.
  • Also ate the repo. Maybe twice.
SVN
  • No distributed model
  • Logs and history are not available offline
  • While creating branches is now easier than CVS, merging them back is still just as hard (this is a hard problem, so I don't blame them)

Sunday, January 03, 2010

Source Control to Major Tom

To a coder, nothing is more precious than his code. Source control management (SCM) is all about keeping your code safe. Not against disk failures, so much as against bad edits ("what was I thinking!" !). It's also a good place to stash some forms of comments (not what the code is doing, but why it was written). Mixing this into the code can be distracting. SCM also provides a nice log of when features were added ("it's been two years!?").

I had my first encounter with source control as an intern at Intel. Our files were under CVS (concurrent versioning system), with some binary files directly managed with RCS (CVS started as a wrapper around RCS - all those funny ,v files).

CVS is ancient (1990), and works really well. You have to be careful with merging conflicts, tagging takes forever, and branching is so confusing no one ever used it. You have to stretch the meaning of "really well"...

Eventually (about ten years ago), some people decided to improve on CVS. That project is called Subversion (svn). I didn't use Subversion until about two years ago. SVN is a big improvement over CVS. The main thing - being able to do a diff against a network repo while not connected to the network. Also, SVN is much better with merging. Tags and branches use the same mechanism, which is cheap and easy. Very nice.

I used CVS professionally until about 2003. That was when I was exposed to the Great SCM Wars - between minions of Darcs, and keepers of BitKeeper. I will have to rant about them sometime. Suffice to say, that no man has ever fought with them and lived! The bones of many projects lie strewn about their lairs. So if you do doubt you courage, come no further. For death awaits you all; with nasty, big, pointy teeth.

Ok, so I still use CVS for my personal projects. I would like to switch over to something new, probably "distributed". There are three alternatives:
  1. Git - created by none other than Linus of Linux fame. He too was a victim of BitKeeper, so he is familiar with pain. He is a really smart guy who churns out quality software at a prodigious rate. He also tends to be a little quirky, and he is (ultimately) writing software for himself, so there is no guarantee I will get the same returns...
  2. Mercurial (hg) - apparently started about the same time as Git (2005), for the same reason (holding the Linux kernel tree)
  3. Bazaar - the newbie in this line up (2007, and new is bad, like in compilers - new means buggy and untested). But, I am willing to give it a shot.
I had previously compared these three and decided on a winner. Sadly, I can no longer remember which one I picked. And things have changed some since then. At the time, Git was basically Linux only (there was a Windows hack by some guy who was trying madly to keep up). Now, I can get Git as a Cygwin package.

I will have to go through again and compare. I don't think SVN is in the running, as it does not have a distributed model. I like the distributed model, because it allows me to push code from one machine to another without having to worry about which one is the "master".

Saturday, January 02, 2010

The Bootstrap Problem

When you turn your computer on, it just boots. You take it for granted. It says "Windows loading" or "Grub", or "L..I..L..O".

But a lot of work goes into getting your computer to boot.

The main problem is the processor just runs programs. And it needs a program to tell it how to load programs. But you need to load a program, to run the program...

The solution is a program which lives at a particular address in permanent memory (ROM). This program is called the BIOS, and it has a really remarkable history going back to the original IBM PC.

The BIOS finds a boot device (usually floppy, harddrive, or CD-ROM, but now usually includes USB). It then loads the "boot sector". This is a 512 byte block of memory containing code which is placed at address 0x7c00. It then jumps to 0x7c00, and you're off!

In my NedOS musings, I considered using Grub as a boot loader. It handles a lot of stuff, and allows you to build your kernel like a regular program. In the end, I rejected it, because:
  1. I wanted to learn how to do a bootloader
  2. I didn't want to be bound to ext2fs and Elf (or worse, FAT32 and PE)
  3. You really need to build a cross compiler to use it
  4. Grub seems bound to 32bit kernels
  5. Grub is 3 stage, I wanted to see if I can get into 64bit mode in 1 hop
The fifth point is the most interesting. Your first stage is the bootsector (512 bytes, really 448 on a boot floppy). That's all you've got to get going, it is really cramped! But loading a second stage requires disk accesses and some sort of file system. I don't want to think about file systems right now, and I don't want to pick an existing one and get stuck with those assumptions.

After most of the day hacking, I have a minimal 64bit bootloader, in 170 bytes!

Now I need to figure out what BIOS info I want to extract before kicking into protected mode, and how I want to find the kernel.

Ugly/cool tip:
You cannot get to 64 bit mode in one step. You have to go through protected mode (because the bit for long mode is in a different register than the register used to enter protected mode - jerks). Further complicating things, the code descriptor for 32bit code is incompatible with the descriptor for 64bit code (nice work guys).

So what I do:
  • set the descriptor for 16bit protected mode code (yes, the original 286 style)
  • kick into protected mode
  • set for long mode (I'm now in a really tenuous position, but interrupts are off)
  • flip the descriptor bit for 64bit code
I could switch to 64 bit mode now, but I turn on paging first, just for good measure. Then with a far jump, I'm into 64 bit/paged mode!

Friday, January 01, 2010

Debacular

When something turns out really bad, you say it was a debacle. If you're in the middle of something that you know is going to end badly, you say the whole process is debacular.

So, a post on comp.arch led to a Google search, which led to a website called OsDev. Now, I have a directory in my projects area called NedOs, which I have been trying to figure out what to do with. There's really not much stuff in there, but it seems a shame to delete it. So, why, not, you know, write an OS? It's not like I'm hugely busy in every dimension, right? (mmm, debacular already)

I broke out my Intel software developer manuals, but they are all so old, they don't have 64 bit stuff. I downloaded the new one, and was greeted by this:

Now, that is debacular!

For anyone who is thinking of writing their own OS, this is the flow chart for enabling "Long Mode" (that is - X86-64, AMD64, EMT64T, or as Intel has now started calling it IA32e mode!) (technically it handles all the modes)

After staring at it for a while (I just want 64 bit mode with paging, is that so wrong!), I realized this could be three sentences:
  1. Enable PAE
  2. Enable LME
  3. Enable PG
You could have an optional fourth sentence - "The first two steps can be done in any order."

So, this picture is worth, like, -994 words.