Sunday, December 28, 2014

Inner System GIS

A diary of working with high detail inner solar system data to showcase graphics and UX chops.



Don't blame it on the sunshine, don't blame it on the moonlight, don't blame it on the good times, blame it on the boogie.


1. Raw Topography

Height maps will require 16 bits per pixel. Downloaded from the internet sources listed and converted to 16 bit single channel png files they look like this:




2. Normal Map generation

Experiments with unpacking local regions from these single world png files fails so I have moved to using 16bit source png files created above to generate some squared friendly resolution normal maps.


After adding Mercury and Venus to the list of sources we move on to some desktop friendly resolutions for our first test renders.


3. Initial Renders

More than some issues with my code and still some obvious issues to get from here:

to to  and


with some issues remaining in the mapping and normal departments...

MacMini 2010 is much happier when it is just bump map as texture fetch seems very expensive on big maps on little pootas...

And out on the red planet, one wonders what left the massive scar. And the shape of it's moons, what's with that? hmmm



4. Cartesian Topography

Closer to home, the local maunga (mountains) are a planned test case for eruption engine.


A new terrain engine that generates mesh from the blue iso lines is next...

Those blue lines look a lot more interesting if we head south a little bit


The fine print as always is read carefully:

Topo50 is the official topographic map series used by New Zealand emergency services. When using Topo50 data, please be aware of the following: 1. The existence of a road or track does not necessarily indicate public right of access. 2. Closed tracks are defined as being no longer maintained or passable and should not be used by recreationalists. The Department of Conservation or other authorities should be contacted for the latest information on tracks and huts. 3. Not all aerial wires, cableways and obstructions that could be hazardous to aircraft are held in the data. 4. Contours and spot elevations in forest and snow areas may be less accurate. 5. Not all pipelines including both underground and above ground are held in the data or shown on the printed maps. For the latest information please contact the utility and infrastructure agencies. 6. Permits may be required to visit some sensitive and special islands and areas. Contact the Department of Conservation to see if you need to apply for a permit.

I am not sure recreationalists is a word but 3.2 gigabytes later we have some data files ready for mesh conversion therapy.


5. ESRI shape files

Unfortunately our favourite language monkey is not yet able to handle 64 bit data types natively so today we are back programming in Java for the following processing step.

The shape file downloaded from LINZ in previous step now needs a parser based on the shape file specification here:

http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf

It may have been prudent to use KML but that format smells of google and we have some existing code in our personal Java repository that needs a refresh. Replacing some bit fiddling with ByteBuffer ByteOrder.LITTLE_ENDIAN would be a start...

6. Orbit Concrete


Shadow casting of earth onto moon should make for a nice lunar calendar.


After attempting a Google search on celestial bodies, and trying to remember the terms for the satellite location data types used to configure GPS chipsets (alamanac and ephemeris) had a small epiphany - it would be more educational to model moon light and tides and in fact entire project from here on in using observational data alone.


Data such as high tide being at a guess about 8pm tonight and the moon, ummm, from a search on Lunday evening, not present. Real world shadows and some basic sky mapping would certainly be real world fun addition to my "edu-tech" universe.


7. Contour lines

The LINZ data in shape file format has contours and coast line of entire country and it is currently being sorted so every segment of every contour line is added to a large pool and ordered using top point from North to South.

Release mode code on fast machine is taking over 30 minutes due to lazy insertion sort. I have to use Stacks not Lists otherwise I run out memory so slower sorting for the win. Increasing the number of buckets would speed things up but I only got it to not crash so a pass that writes to disk is underway.

OK, maybe more like an hour, the southern alps shown in previous image are going to slow this process down a little.

[many hours later]

Whew, finally got the isoline code running in x64 mode on PC (monkey says yes except for eof becoming broken and audio not linking) without blowing it's guts, memory usage went up to 6.5GB but at least I can now just plug in more RAM....

   

With road networks and mountaing contours passing initial tests gamification begins.




Appendix

1. Source Data

Available topographic mapping projects with maximum resolutions:

earth - etopo1 - 21600x10800
moon - lola - 368640x184320
mars - mola - 46080x23040
mercury - mdis - 61324 x 30662
venus - magellan - 8192 x 4096

Earth surface maps

  1:50000 Linz Topo Data  http://www.linz.govt.nz/data/linz-data/topographic-data


Saturday, December 20, 2014

in search of :poop:

in which Christopher Robin opens the Font Book application on his new Apple computer and discovers a colour emoji font


and sets about searching for more information on this happy pooh
hmm, something is starting to smell like Christmas on the Chrome context menu!
which generates the following scented URL:

and with a little more effort the low down is

  • emoji shortcut is :poop:
  • unicode name is PILE OF POO (U+1F4A9)
I'm off to tweet poop, hope it works💩💩💩

[edit]

and one last test, some poop in my code:






Friday, December 19, 2014

android lollypop refresh

Between jobs and refreshing my technology chops...

Which begins with a download of TADP (nVidia's Tegra Android Dev Pack) but Eclipse based dev seems to have been deprecated so over to Android Studio where switching to Vampire mode (night palette) puts us in a far more positive mood.


Yup, it's December 2014 and lollipop device users are rounded to 0.0% which I am going to pretend is actually a good sized market for an independent such as myself to target.

After mistakenly making things too complicated by creating a new app for both "mobile" and "tv" I restart and stick with "mobile" only.

After first diversion in which Google points us to stack overflow for some gradle discussion in which an expert uses the term "work in progress" I fail to discover what "Picasso" dependency is even doing in my first project and move on with my second, where a blank app is now waiting for some experiments with Full Screen to be added to the menu.

TBC

Friday, November 21, 2014

lines

I have always been interested in drawing lines on the computer. When I was first learning to code on Apple][, hlin and vlin were the fastest drawing commands in town.

On Amiga the Agnus chip needed some careful poking and lines could be drawn in any direction.

In OpenGL commands are available for drawing thick lines with anti aliased edges. 

The lowest common denominator of GL is Angle which won't do thick or anti aliased lines without some shader tricks from the developer.

Output from the code I have been working on:



Each line requires two vertex from which a quad is formed and rotated to face the camera. Features of the system include
  • a minimum width so lines in the distance are still drawn with accuracy
  • anti aliased edges without MSAA
Line direction and length are stored for each vertex and funky shader math added to produce eye facing quads with texture coordinates used to stretch map the following source.

The generous amount of alpha surround produces good antialiasing at all mip levels.
This is a work in progress using mak/gles20cube  as starting point from the monkey-x bananas folder.

I am interested in using a clipping plane at each end so multi segment lines can be drawn with out overlap and adding points with radius to the mix which could form the basis of a new editor project I am slowly formulating.

# skid lines (arrow keys to steer, a and z for up down)

The source code can be found here.

Thursday, October 2, 2014

Navman Terrain Prototype

Earlier this year I was involved in prototyping a terrain engine for an Android off-road prototype.


We had two weeks to prepare for a show and tell at the firm's annual international engineering meeting.


After building an OpenGL first person tile scroller large quantities of vertices were stored per tile in the form of an ordered grid of quads.

The performance of the resulting effort were surprising (in a good way) on both desktop and phone with texture and vertices both in dense quantities.


I often thought of the potential of taking the worlds road networks and adding car and traffic simulation from any location.


Unfortunately the software engineering department in Auckland is now no longer so my dreams of adding road geometry and vehicles to this particular map are of no concern.

Saturday, September 6, 2014

BlitzMax OpenGL 2...

OpenGL2 seems a lot more differenter than the OpenGL found in BlitzMax150.

Not ever getting my feet wet using OpenGL in BlitzMax (not ever!.!) I am going a bit slow.

First step was to update pub.glew to v1.08 featuring fresh glew 1.11.0 files. And the results of that mission, awaitin a home...

 http://sourceforge.net/projects/maxgui/files/glew.mod.108.zip/download

Mix that with some OpenGLES headers from brucey:

 https://github.com/bmx-ng/pub.mod/tree/master/opengles.mod

And my shader code that works on raspi.egl device should run on my laptop.

Not.

I will need OpenGL2 which MacOS and windows 7 says na-ah to GeForce 9400M. M obviously short for not a GeForce or Not OpenGL2 capable. Or I might be doin' something wrong. Following returns false:
Local err=glewinit()
Print "EGL test suite version 0.3"
Print "GLVersion2="+GL_VERSION_2_0
Which leaves me facing the alternative solution that is Angle, an Almost Native Graphics Layer Engine for DirectX9 and 11.

A good thing BlitzMax150 has new feature that lets me do this:

 ModuleInfo "CC_OPTS:-std=c++11"

However Angle also needs some extre help building on MinGW/GCC which QT5 eludes to when googled, caution to the wind I create axe.angle module here

 svn co https://max-edit.googlecode.com/svn/trunk/mod/axe.mod/angle.mod

and get this mission started...

This module is possibly 50% complete with I think only dx renderer classes now needed to build without errors.

As it is father's day and I have overeaten it may need to wait for another day.

Wednesday, August 20, 2014

tablet time

4 core 1920x1200 7" speed machine shipped directly from Nvidia with a little help from Nzpost is lovely,



oh, and some styluslabs software with stylus which is working out real well on the potentialometer of things to play with..


Yikes. but there's more.


Great ping times from native build of my nsynth client. The same monkey client is currently the welcome mat at nsynth.com itself. It's a bit void of life but I am very happy with the architecture so far.

and a photo of the evening sun




Saturday, August 9, 2014

recreational programming

there is no finer satisfaction in the world of recreational programming than banging out a shoot em up

home computers in my day may have had a joystick but there was no carpal tunnel solitaire controller, oh no

and after 6 months the space bar had lost it's bounce... but as long as the shift keys were in good working order, for code compile play cycles, the hands didn't need to go anywhere but the good old keyboard

the act of plugging in a raspberry pi seems to have provoked a search for my inner 13 year old,

back then the apple ][ assembler source was readable in the red book of woz and the 6502 instruction set had been reduced to a single photo copyable cheat sheet of hex codes and operand logic

my mate mark sibly had written a david bowie loader routine that instead of reading binary files from the tape backup system in apple ][ allowed you to listen to digitised music for the very first time, ever. bowie is so cool he survived conversion to square waves remarkably well

we also churned out a lot of shooters.

you could walk into the selwyn computer room some afternoons and everyone would be playing sibly's latest, first text based trs-80 inspired shooters, then williams inspired pixel based shooters

skool was apples, while at home was vic 20.

two friends sell bike, slotcars and get brand new $230 home computer system with games from place called England, games that broke all rules in recreational video game design. Similar to the invention of very loud rock music, the english had a talent for fostering genius in recreational software design.

and so, my young friends behaving so well, a slightly nostalgic adventure with Raspberry PI home computer begins...








Saturday, June 7, 2014

freeaudio streaming

or grrr bloody hell, old code should just work

The design of FreeAudio is based on limitless numbers of channel buffers being multiplexed by a very fast and simple accumulator with per sample rate and amplitude modulation.

Yesterday I failed to run some old code that wrote sample buffers during program execution.

Blitz audio is traditionally sound oriented, which is something that represents the channel that has been chosen from a limited pool, to be allocated to play your sample, which can then be modulated, or is that the channel? I always get a bit confused...

freestream.bmx

And not a few hours or is that days later on a Tuesday evening without a click on either win32 or macos the first release of freestream is ready.

' freestream.bmx
' mono 8 bit streaming example for 

Strict
Import pub.freeaudio
Const FRAG=1024
Print "freestream is free streaming..."
fa_Init(0) ' brl.freefreeaudio usually does this
Local buffer:Byte[FRAG*8]
Local writepos
Local sound
Local channel
sound=fa_CreateSound(FRAG*8,8,1,44100,buffer,$80000000)
Print "Sound:"+sound
channel=fa_PlaySound(sound,FA_CHANNELSTATUS_STREAMING,0)
Print "PlaySound:"+channel

Local streaming
Local lfo#
Local osc1#

While True
' Print "Status:"+fa_ChannelStatus( channel ) 
 Local readpos=fa_ChannelPosition( channel )
 Local write=readpos+FRAG*4-writepos
 Local frags=write/FRAG 
 While frags>0 
  Print "Write to "+writepos
  Local pos=writepos Mod (FRAG*8)
  For Local f=0 Until frag    
   Local t=writepos+f 
   lfo=Sin(0.001*t)
   osc1=Sin(t*(lfo+2))
   buffer[pos+f]=128+10*lfo*osc1
  Next
  writepos:+FRAG
  frags:-1
 Wend
 
 If Not streaming And writepos>=FRAG*4
  fa_SetChannelPaused( channel, False )
  streaming=True
 EndIf
 
 Print "." 

 Delay 50
Wend

The variable lfo refers to a low frequency oscillator, as BlitzMax is using degrees here the multiplier .001 is effectively 1 thousandth of a degree per 1/44100 seconds the suspected hz is ummm, errr... it seems to be oscillating at 5 seconds...

Latest version can be found here http://www.blitzbasic.com/codearcs/codearcs.php?code=3129

Friday, June 6, 2014

webmidi 9.3 not working in Chrome

It is kind of bullshit source, I should have smelt a rat. so Chrome doesn't conform to basic ins and outs and the code here fails:

http://www.w3.org/TR/webmidi/#listing-inputs-and-outputs

The example in section 9.3 is a bit shint, surely an ecma map like Chrome returns is better, whats with the odd looking containers and the abuse of the for in operator w3?

As for working code, Chrome likes the following better (with obligatory web midi enable in chrome:\\flags)

function enumMidiAccess( midiAccess ) {
 var inputs=midiAccess.inputs(); 
 for(var key in inputs) 
 {
  var input=inputs[key];
  console.log( "Input port " + input.name );
 }

 var outputs=midiAccess.outputs();
 for(var key in outputs)
 {
  var output=outputs[key];
  console.log( "Output port " + output.name );
 }
}

Google+ Chrome webmidi pre-announce https://plus.google.com/+ChrisWilson/posts/cs4J6sS9qmJ




Monday, June 2, 2014

nsynth site update

[updated]

homebrew holidays

The node based game server that starts and stops at nsynth.com is nearing 12 months old but the client code feels kind of new



There is a bug in portrait mode on my phone with an ominous button called Execute instead of my nice vector font terminal



[ All fixed in latest MonkeyX Release ]

The ping test bounces the same request, from Auckland to Sydney I am getting ~65ms turn arounds in chrome where as a standard icmp ping from the command line is reporting 34ms so research required....


the chat system is a simple relay running on a 1 hz refresh 

the shell login ignores everything you send it with a reply reporting the request headers

Client Side

The new Android monitor has no problem profiling the monkey game running on my ancient Ideos X5.



Replacing a glyph map with an array and the following keeps us happy, although ping is horrible compared to desktop. Hopefully a solvable issue.

#ANDROID_NATIVE_GL_ENABLED="1"

Swerver Side

To keep the ping numbers honest we need 3 servers, Sydney, Virginia and Dublin.



Two new instances of my server are running and testing has begun.

sydney

virginia

dublin

Nearly enough IT for one day...


TBC

Wednesday, May 7, 2014

ninja coding in monkey

In 2K9 I took a sabbatical from the GPS industry and signed up as a Ninja Kiwi game developer.

At that time there were 2 designers and 4 or so pairs of coder artists.

I was put on in house mobile conversions

Great Timing

It was great leaving behind Visual Studio 2005 and Windows CE 5 from my last job and jumping to iPhone development in xCode. Apple added iPad to the mix in 2010 and capacitive touch screen gaming platform had arrived big time.

My first two conversions were (Bloons) Super Monkey, Chad's crazy cool meditation on the vertical scroller:

and a port of Power Pool - Derek's ball breaking pool sim, note the shot streak multipliers:


Both releases were native C++ hand translations of the original Action Script source, using a freshly minted EGL driver and host stuff.

At Ninja Kiwi we also had a game jam week where I got to do some particle based art and sound for the rhythm game BeatStreak 3000.

.monkey

For Zombie Trailer Park I was able to switch to a programming language, coincidentally called Monkey from my good friend the independent compiler vendor Mark Sibly or BRL as he is known to his customers....

ZTP was awesome and a dream to develop.



It featured three 2Kx2K sheets of cell animation from Woric and some gifted design elements from the directors Chris and Stephen such as Priest incantations that could turn a horde back on itself and a Level 1 that separated those that know how to win at Monopoly from those that don't:


And then there was Hunt or Die, a web mashup deluxe (and very popular in Spain) with .monkey used inside a standard CS5 flash stage.

This was another in house game jam production with art, titles, overlays and polygon level and rendering done by Lee using CS5 and me using .monkey for the game engine, sprite drawing and box2d physics.



And last but not least Driller Bunny, a tilt phone game in .monkey.


a bit more info on that one here:

http://www.monkey-x.com/Community/posts.php?topic=1034



Saturday, April 19, 2014

histronics


C64 Tokasm

Back in 1984 I did a lot of programming in assembly language using Tokasm a 6502 assembler from local programming god and good friend Mark Sibly.

Tokasm was a light weight hack that replaced the C64 BASIC token table with 6502 mnemonics allowing an elegant inline assembler to exist in a small corner of the 65536 bytes of RAM that was the Commodore 64 home computer.

Source code for the music player used in my unpublished game Space Flowers is attached. Note the tightly packed assembly allowing a large amount of logic to be viewed on the screen at once and the line number management system inherited from the hacked BASIC environment.


The 6502 CPU has three 8 bit registers A, X and Y. The first 256 bytes of RAM are known as zero page and double as 16 bit pointers.



Interesting story, Space Flowers was originally and naively called Castle Kingdom and a sale was attempted to none other than Commodore themselves. 


Unable to avoid being deported to the South Island, hacking got replaced with musical drinking games and my 8 bit coding years were over.

TBC

Saturday, February 8, 2014

.Windows monkey target

.xna monkey target

In the year 2014 some things stay the same, some things change very slowly..


After all the Windows 8 hoo-ha it is nice to find after recently upgrading myself that Games for Windows is alive and well if not a little hidden on the new OS.


To get developing using monkey xna target, the following installs were required:

Install Games for Windows Marketplace from here

Install Microsoft Visual C# 2010 Express from here

Install XNA Game Studio 4.0 from here

A discussion on monkeycoders.co.nz on such things has begun here

This sequence worked for me on a pretty clean Windows 8.1 setup with the caveat that I removed XBox and Phone7 targets from the monkey generated solution so I could focus on a Games for Windows desktop target.

To get an old  prototype working I'm wiring up a new target that will depend on

System.Net - for http(s) requests
KinectSDK for playing with sensors - here
Midi IO here -

TBC

Umm, thanks NVIDIA but ALLCAPS aside, free sounds like a better offer 2me...

Thursday, February 6, 2014



Weekend development on Maze Race has already started...

nsynth.com/static/mazerace.html

TBC