Thursday, October 04, 2018

An AI for Atlantis

I've been working on an AI for Atlantis for a while now. Finally have something to show for it!

I created a game with four players (all AIs). The nexus has no exits, so there are random jumps out. They are using pretty much the same strategy - find good hexes and ramp them as quickly as possible.

Friday, March 16, 2018

Rust Monster

Ok, so the more I learn about C++, the more horrors I find. I figure, I should give Rust a try.

Here's a simple program:
fn main()
   let x = { 2 + 2 };
   let y = { 2 + 2; };
   println!("Hello, world! {:?} {:?}", x, y);

% cargo build
% ./target/debug/hello_world
Hello, world! 4 ()
Now, what happened here? Semicolon is a statement separator, so "2+2;" means "two plus two, and null statement". The last statement in a block is the return value, so y gets the null type (called the unit type in Rust, it always has the null value - "()").

Not the friendliest behavior.

A slight change in style helps here:
fn main()
   let x = { 2 + 2 };
   let y: i32 = { 2 + 2; };
   println!("Hello, world! {:?} {:?}", x, y);
Now we get a compiler error, and a nice one:
% cargo build
   Compiling hello_world v0.1.0 (file:///usr/local/ned/dev/gitned/rust/hello_world)
error[E0308]: mismatched types
 --> src/
3 |   let y: i32 = { 2 + 2; };
  |                ^^^^^^^-^^
  |                |      |
  |                |      help: consider removing this semicolon
  |                expected i32, found ()
  = note: expected type `i32`
             found type `()`

error: aborting due to previous error

error: Could not compile `hello_world`.

To learn more, run the command again with --verbose.

I guess the takeaway is to give type definitions as much as possible, particularly when dealing with blocks...

Thursday, February 23, 2017

Atlantis Updates

Lots of changes with little posting!

In the new game, there is a sizable lake region.  The color difference versus ocean was not sufficient to differentiate them.  I've made oceans darker.

I've also gotten complaints about how unexplored territory is shown.  I've settled on this style, which has the underlying color, with a stippling of gray12 drawn on top.

Most of the development has been in order checking.  I now check the first word of all commands to make sure they are real.  I also check the targets of GIVE commands, and some inventory checking (making sure you don't give what you don't have).  I also check that units doing STUDY have enough silver (based on the skill table - the first turn of studying a new skill will not be checked).

I'm also showing the last seen foreign units in hexes without the current data.  I was having trouble remembering what monsters were where, and where I had seen enemy units.

Tuesday, August 09, 2016

The Palace Job

"The Palace Job" (Patrick Weekes) - An interesting blend of fantasy and steampunk / high tech.  Floating islands suspend by crystals which are changed by the sun (some sort of solar panel coupled to contra-grav?).  A golem which mumbles about its programming as it shuts down.

Impressive overall.

Friday, January 08, 2016

Physics of Star Killer Base

If you haven't seen the latest Star Wars ("The Force Awakens", episode 7), stop reading immediately! :)


Apparently, there has been some griping about the physics of Star Killer Base.

For example, if the planet can't move, and even one shot substantially drains their sun - then you've only got a few shots from your super-weapon (not to mention everyone on the planet will freeze).

Also, if the weapon drains the whole star, then it is really massive overkill (about 12 trillion times according to one site).

There is a much more reasonable explanation!

The photosphere is the region of the Sun which emits visible light.  The key idea is "It [the photosphere] extends into a star's surface until the plasma becomes opaque"

If you strip off the photosphere, then the star will appear opaque i.e. black (at least, until it regenerates).

Ok, so how much energy can you get from the photosphere (we'll assume the Empire, err, First Order, has sufficient tractor beam and shield technology to extract it quickly and safely).

All of my calculations are in a Google Drive spreadsheet.

Final result?  Yes - there's about 1700 times more power than you need to blow up one planet just from fusing the hydrogen in the photosphere into helium (you could get more power by fusing up to iron).

And how rapidly could you fire such a weapon?

I'm not sure of the fluid dynamics, but keep in mind the regions of the photosphere last about 8 minutes (they are upwellings of cooling plasma).  Which implies it might recharge very rapidly indeed!

Friday, November 20, 2015

KOL Edit

A blast from the past!
Knights of Legend was one of my favorite games.  It was immensely detailed in every way.  It might take an hour to fight out a single quest! :)

Main problem - it was expected that additional "region packs" would round out the game.  But they never happened.  So, you get trainers who are not good enough to get you to the next level where the more advanced trainer will talk to you...

Enter the KOL Editor!  It will (eventually) allow you to train yourself (subtracting AP, and maybe gold) to level up your skills.

Monday, October 12, 2015

libHexPlanet: Sphere 7

I got sphere 6 working using a texture for the vertexes and sending position indices (I didn't get a chance to post the screen shot).

However, both my machines have limits of 256 KB for textures, this works out to 16384 vertexes, which is sphere 6.

I'm going to give up on indirection, and just spam all the vertices.  It took a little doing, but it's working.

Sphere 7:

And I can now do sphere 10, which is so detailed, the individual hexes are turning into pixels: