• ### Blog Entries

• entries
24
31
• views
17318

(May not be suitable to low bandwidth connections)

## Guess where.

This is a really original entry ;)

The Gang, getting ready to drive back to Seattle

Early morning at Whistler

A mountain view (from Blackcomb)

Kevin Showing off:

End of day at BlackComb:

## Eastsidekistan

Well, power is finally mostly back up in the Redmond/Bellevue.

I'm so glad I was at Whistler this weekend :)

This journal is less and less about programming :)

Anyway, the common theme here is icy roads - Went up to whistler over thanksgiving:

Lots and lots of snow - the day they opened the peak the line to get up was humongous. We did get to watch the first few guys coming down:

Crazy, right?

Here's the approximate trajectory:

And here's the run I actually did:

That was a tiring day, but the most fun I've had in a while.

And why Icy roads? I've finally bought a new car:

We drove from Whistler down to Seattle with snow on the road down to Mount Vernon - took us 6 and a half hours, and I'm bloody glad I had the Subaru - that thing handled so much better than the old mazda did in snow (and elsewhere). Turns out that a co-worked actually took 10 hours and 45 minutes (!) to drive from Seattle up to mount vernon this monday night.
The funny thing is, driving in the Canada side was quite easy - the snow was smooth, and people knew what they were doing. The second, and I mean the second you cross the border, all hell breaks lose - the road now resembles gruyere cheese, but made of ice, and everyone seems not to know how to drive on slippery conditions. Accidents followed accidents, and apparently snow plows are unheard of north of bellingham. Basically, it's like we crossed the border to a third world country.

The driving exam should include driving in low friction surfaces.

## Trek Tri Island

An alaw organized event. 140 miles of bike riding across islands and rural Washington and into Victoria, B.C.

## That's it, then

Off on vacation, back to Portugal for a couple of weeks.

Enjoy your work, I know I'll enjoy my vacation :)

## Track Day II

Getting better at this - Second track day, with Nesba. A surprising ammount of coworkers showing up, and there was a crash on each session of the day (not for me, thankfully - my precious darling still has the same number of scratches as the day I bought her)

Also, on a mix of sad and good news, win9x is dead. Lots of good memories (and lots of innoportune crashes). The best part is that I don't have to test on it anymore :)

## VB code dom expression evaluator

The following uses the codedom to compile and execute vb expressions on the fly. Thought I'd share.

Module Module1    Sub Main()        Dim Expressions() As String = {"2*args(0)+3*args(1) <= 20", "5*args(1)+7*args(0) < 10", "6*args(0)+2*args(1) < 50"}        Dim c As New ExpressionEvaluator        Dim AllTrue As Boolean = True        Dim X As Integer = 0        Dim Y As Integer = 1        For Each expression As String In Expressions            AllTrue = AllTrue And c.EvaluateExpression(expression, X, Y)        Next        If AllTrue Then            Console.WriteLine("All expressions are true")        End If    End SubEnd ModuleClass ExpressionEvaluator    Private Compiler As CodeDom.Compiler.ICodeCompiler    Sub New()        Dim c As New Microsoft.VisualBasic.VBCodeProvider        Compiler = c.CreateCompiler    End Sub    'evaluates an expression and returns the result    Public Function EvaluateExpression(ByVal Expression As String, ByVal ParamArray args() As Object) As Object        Dim results As CodeDom.Compiler.CompilerResults        results = Compiler.CompileAssemblyFromSource(CompilerParameters, CreateSource(Expression))        If results.Errors.Count > 0 Then            Dim ExMessage As String            For Each e As CodeDom.Compiler.CompilerError In results.Errors                ExMessage &= "Error " & e.ErrorNumber & " at " & e.Line & ": " & e.ErrorText & vbNewLine            Next            Throw New Exception("Errors were found while compiling: " & vbNewLine & ExMessage)        End If        If args Is Nothing Then            args = New Object() {}        End If        Return results.CompiledAssembly.GetType("Module1").InvokeMember("Foo", Reflection.BindingFlags.InvokeMethod, Nothing, Nothing, args, Nothing, Nothing, Nothing)    End Function    Private Function CreateSource(ByVal expression As String) As String        Return "Public Module Module1" & vbNewLine & _        "Function Foo(ByVal Paramarray args() as object) as object" & vbNewLine & _        "Return " & expression & vbNewLine & _        "End Function" & vbNewLine & _        "End Module"    End Function    Private Function CompilerParameters() As CodeDom.Compiler.CompilerParameters        Dim parameters As New CodeDom.Compiler.CompilerParameters        parameters.CompilerOptions = "/t:library"        parameters.GenerateInMemory = True        Return parameters    End FunctionEnd Class

In other news, having a cold on the fourth sucks.

## Force sample

Someone was asking about how to use F=m*a to determine where to draw object, ended up creating a small sample, though I'd share. VB 2005 solution, get the zip here

## Tic Tac Toe Sample, V1

Well, I've got a computer oponent. It's not very smart. In fact, it's not smart at all. More like random.
Should be easy to improve upon though - it was a bit messy to reorganize the code to make it a bit more OO like, but now it should be a matter of improving the computer side algorithms at will, and everything should still work.

Without further ado : Tic Tac Toe Project, in vb 2005

Next: this is v1, but I do want to get some more challenging computer players - I'm thinking of building one that just follows simple rules (try to play where it can complete a line, and where it will get the most marks in a row for this play; if it can't win in this play and oponent is one spot from winning, play in that spot) and another learning player (stores all (maxed number?) the games it's been into, picks up the play that has the best average result), and a variant of this last one would pick a play targeting a difficulty level. (dificulty level would be directly associated with the average result of the plays chosen.).

Should be interesting to see how fast the pure learning player would reach an optimal play sequence (always leading to a tie or a win against an experienced player)

Bonus image:

## Tic Tac Toe

My life story on programming games has been one of starting projects, then letting them fall by the wayside.

So for once, I'm starting a project so simple, I can shame myself to finish it.

Gentlemen, I'm unleashing upon the world Tic Tac Toe. In VB 2005.

The following will not self destruct after 5 minutes. It is the full project, if you just want to run the executable you can go to the bin folder under the tic tac toe sample project.

Tic Tac Toe>Tic Tac Toe, with full project

Currently is human players only, playing alternately.
V1.0 should have a computer oponent, and I'll call it completed then.
And then I might improve it a bit. Maybe mixing a bit of remoting for the Human vs Human story, or better graphics. Using Tic Tac Toe as an excuse to get a Managed DirectX interface going sounds attractive to me for some reason. Probably the insanity of it all.

## More Whistler

4 shall go, and four shall be the number, not 3, not 5, but 4. And of those four, one shal shatter his shoulder, and one shall have to spend the day amongst the healers atending to the first, and shall not ski. And a third shall also twist his knee on the first day, and have to receive care from the followers of Hippocrates. And after the first day, only one shall have done a full day's efforts against nature's white mantle, and at the end of the first day only two shall be uninjured. Those two shall apply themselves to the consuming of generous quantities of alcohol, which will lead to one purging his insides several times before the ride of the flaming star, and lead to his frolicking with morpheus for most of the day. At the end of the second day, only one shall have continued the war on powered water, and two shall decide to flee the mountain earlier than expected. And by the third day only one shall have kept the struggle, and he shall be bloody tired.

And now what you came here for, pictures:

Seventh Heaven 1

Seventh Heaven 2

Mostly fresh snow

Nice trees all around

It's cold at the top

Elevation, three hundred meters

P.S. This time, no skis were injured during the filming of this journal.

## Thanksgiving for snow

Whistler, BC - almost mythical landscapes

and great snow in some spots

But not without its consequences:

And if you find yourself renting skis because you broke your own, be sure to get insurance

It can save you 40-50\$ worth of skis fairly easily.

P.S. Wear a helmet, specially when there are hidden rocks beneath freshly fallen snow.

## The End

No programming news. Finally made it to the end of the Burke Gilman trail with a working camera (start point: Marymoor park, Redmond)

After either forgetting the camera, being out of batery and having forgotten the memory card at home, I finally have a photo of the plaque.

I do hope the trail gets extended to the golden gardens park soon - right now the end is really anticlimatic.

~28 miles one way, average 2:20:00 each way with one to two stops.

## Backups

Got some free time.
Went to code some more on the walker project.
Realized while I had backed up the physics library, the main project was on a machine that got reimaged.
Killed a random number of .
Concluded that backups are only a good thing, if they're thorough, mkey?

It's a good thing I had the actually physics library stored elsewhere, but all the 3d visualization code went the way of the dodo - now I'm thinking of just doing a d3d engine, but it's going to take a while to get it set up, and I ran out of free time searching for copies of the original project. Next post in two months.

## Smileys!

Due to the nefarious influence of a thread on camping and happy faces, I ended up creating a little tool that transforms images into gamedev icons:
Source for the smilelizer
(VB 2005 beta2 project, you can find .exes under the bin directory. the bottom textbox is the width in smileys of the resulting picture.)

PHEAR TEH POWR OF SMILEY RHINO

## Moore's Victorian approach

Got a simple floor working, and collision springs.

Added a tripod for good measure, irrespective of Moore's opinions.

The problem now is that my dampnening mechanisms work fine for linear forces, but when they start producing torque, it tends to unbalance itself :) - after a while, my tripod turns the legs upside down - I need to get some friction going on.

Next up:
friction - ideally I'd determine what horizontal speed the point of contact has, determine the force that would be required to stop it in a small predetermined amount of time, and cap it, but that seems like a lot of processing. Other alternatives seem to me like they won't have a very realistic behavior.
Direct3D drawing?
In any case, start thinking about moving drawing routines to a library.
Clean up springs to use interfaces instead of the blocks directly.
Merge spring and dampner into a single instance, and simplify the calculations.

Guess where

Dim i As UInteger = 42

## Tarzan

might like this rope:

- The Dampener seems to be working correctly
- Decided not to draw the spring (Yes, I'm being lazy) - drawing the forces applied does the same effect.
- Got the backbuffer bitmap in place

Next:
- Collisions
- creating a test world (flat floor)
- start thinking about getting a dx drawing engine

daily photo

P.S., does anyone care to guess where was my avatar taken from?

## expressionism to cubism

Had some progress with the dampener - although I ended up cheating a bit and bleeding speed artificially from all objects on the scene, I still need to thoroughly debug the dampener code.

On the meanwhile, got a little improved wireframe drawing of the blocks in GDI - first attempt:

Obviously in need of some work - had several small bugs that were causing different components of the corners to be centered differently, and was projecting it on both sides of the Z axis, causing perspective inversion of one side of the cube - weird stuff.
Also, Here I had a simplified drawing scheme - I just drew lines from each corner to all others :)

and finally, the two blocks, spining around each other - added the numbers while trying to figure out the issues with the previous screen shot:

Next:
-Cleaning up the dampener, and see if I can do without the artificial friction.
-Draw the spring?
-GDI backbuffer - flickering like heck right now
-Start thinking about implementing collisions, and actual friction.

## Walker (no, not the texas one)

For a while now I've been thinking of developing a small physics simulator that would allow me to play around with bypedal objects - I've finally had some time to start it up, and I'll be posting progress here.

Current status: I've got a linear and angular physics processing library, with a working spring which I'll be using to connect the blocks, and I'm currently tunning a dampener.

One thing I'll say is, last time I attempted this, I tried to develop all the matrix math by myself - the result being more bugs than I cared to count, and ending up quitting. This time I'm just referenced Microsoft.DirectX, and I'm using all their 3d math stuff. It's amazing how much easier this is :)

Oh, yeah, the project is in VB .Net, the library on 2003 and the test projects in VB .Net 2005 (will probably migrate the library to 2005 later on, when it gets shipped.)

first screen shot - this is a non background clearing (I could have called it path showing :)) drawing of two blocks linked by a spring and dampener, where the second block is being pulled upwards by an invisible force, and the first one is fixed on the center - the color varies with time.

## There's never time at all

I've been trying to develop a physics simulation engine to experiement with two legged robots for a while.
Started several projects, but never actually went anywhere usefull.
One thing usually happens, which is the complexity of the project at some point takes over the time I can spend on it - at subsequent sessions, I spend all the time relearning what I've done before - lack of documentation is a big issue.
So I'm trying a different approach - I'm using this journal to document my thought process for the project - hopefully, having to write down what I'm doing will not only allow me to pick up the ideias faster later on, but it will also cause me to remember better what I've done.