LODESTAR

Showing posts tagged lodestar game

Improved error handling for the networking and scripting. Known errors that can be handled are displayed while everything gracefully saves and terminates in the background, returning the player to the title screen. The client no longer bombs all the way out when a minor exception is thrown.
http://cloc.sourceforge.net v 1.56
---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
PHP            308          10266           5858          26710
Java           354           9468           3860          24074
CSS              6            641             68           3242
GLSL            54            407            111           1579
Javascript      14            262             89           1192
XML              9            111             12            574
HTML             3              8              0             42
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           749          21163           9998          57414
---------------------------------------------------------------

Improved error handling for the networking and scripting. Known errors that can be handled are displayed while everything gracefully saves and terminates in the background, returning the player to the title screen. The client no longer bombs all the way out when a minor exception is thrown.

http://cloc.sourceforge.net v 1.56
---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
PHP            308          10266           5858          26710
Java           354           9468           3860          24074
CSS              6            641             68           3242
GLSL            54            407            111           1579
Javascript      14            262             89           1192
XML              9            111             12            574
HTML             3              8              0             42
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           749          21163           9998          57414
---------------------------------------------------------------
Here’s a sneak peek at what the scripts look like. This code, exposed through the ‘scripting’ API, generates the rudimentary biome that you’ve seen in all my screenshots.
I refer to the files as scripts, but they’re really just Java source files.
I’m currently employing Janino as a lightweight run-time compiler that generates Java bytecode from .java files. The scripts are loaded and compiled whenever a game is started. Additionally, the scripts are sandboxed, allowing only a select whitelist of packages to be imported, and run server-side only. The API exists simply as a collection of interfaces, enums and statics.
The current API allows you to define blocks and biomes. When defining a biome you can register different value map plugins and test against those within the registered processing plugin. At this point the value maps consist of layered value noise combined in different ways.
The goal is to allow players to script their own unique experience and share that with other players without the need for all players to have the same files. The API is documented and will be available as a compiled library and source package for easy integration into your favorite Java IDE. I will find an online home for the JavaDoc as well.
---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
PHP            308          10266           5858          26668
Java           356           9439           3839          23690
CSS              6            641             68           3242
GLSL            54            407            111           1579
Javascript      14            262             89           1192
XML              9            101             12            510
HTML             3              8              0             42
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           751          21124           9977          56924
---------------------------------------------------------------

Here’s a sneak peek at what the scripts look like. This code, exposed through the ‘scripting’ API, generates the rudimentary biome that you’ve seen in all my screenshots.

I refer to the files as scripts, but they’re really just Java source files.

I’m currently employing Janino as a lightweight run-time compiler that generates Java bytecode from .java files. The scripts are loaded and compiled whenever a game is started. Additionally, the scripts are sandboxed, allowing only a select whitelist of packages to be imported, and run server-side only. The API exists simply as a collection of interfaces, enums and statics.

The current API allows you to define blocks and biomes. When defining a biome you can register different value map plugins and test against those within the registered processing plugin. At this point the value maps consist of layered value noise combined in different ways.

The goal is to allow players to script their own unique experience and share that with other players without the need for all players to have the same files. The API is documented and will be available as a compiled library and source package for easy integration into your favorite Java IDE. I will find an online home for the JavaDoc as well.

---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
PHP            308          10266           5858          26668
Java           356           9439           3839          23690
CSS              6            641             68           3242
GLSL            54            407            111           1579
Javascript      14            262             89           1192
XML              9            101             12            510
HTML             3              8              0             42
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           751          21124           9977          56924
---------------------------------------------------------------

LAN host auto-discovery is working smoothly now.

---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
PHP            308          10266           5858          26668
Java           340           9478           3707          23564
CSS              6            641             68           3242
GLSL            54            407            111           1579
Javascript      14            262             89           1192
XML              9            101             12            510
HTML             3              8              0             42
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           735          21163           9845          56798
---------------------------------------------------------------

Total Count

Thought I’d share my stats on the entire project so far. This count includes the web api, web app, web core, web backend, game client, game server, game pre-launcher, and game launcher. I took care to exclude the PHP libraries that I did not write.

The web core is code shared between the web app and web backend. The web app handles player registration and account maintenance. The game pre-launcher updates the launcher and the launcher handles player authentication and game file updates; both use the web api. The game client and game server authenticate to each other and to the web app via the web api.

You can visit the web app here: https://lodestargame.com/home

---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
PHP            308          10266           5858          26669
Java           330           9317           3682          22777
CSS              6            641             68           3242
GLSL            54            402             86           1565
Javascript      14            262             89           1192
XML              9            101             12            501
HTML             3              8              0             42
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           725          20997           9795          55989
---------------------------------------------------------------

The networking code is up and running!

When a player starts a game, single or multi-player, the server application launches in a separate thread and generates an asymmetrical encryption key-pair. When a remote client connects, after the handshake, the server sends the public key and a challenge. The client generates a symmetric, secret key, encrypts both the secret key and challenge with the server’s public key, and sends them back. The server then decrypts and verifies the challenge, verifies some other stuff, assigns the secret key to the player’s connection, and tells the client that all is well. The client switches to encrypted mode and all further communication between the client and server is encrypted after serialization.

If the connecting client is local, as in single player or multi-player host, the server and client switch transport mechanisms. This allows them to bypass the 7-layer burrito, bypass the encryption and serialization, and directly deliver packets to each other internally.

Both transports use the same packet protocol and it’s easy to switch the local mode to use the remote transport on localhost for testing and debugging. When using the remote transport, packets can be encrypted and/or compressed after serialization. Structuring the code this way means that as I develop, I will be forced to use the protocol and think in terms of server <-> client architecture at all times.

The offline mode indicator at the bottom is displayed when playing the game in offline mode. Go figure. You can choose to play in offline mode if you cannot connect to the server to verify your account. Unfortunately, you will not be able to enjoy multi-player or some extra perks, like rewarded titles and custom player sprite, when playing in offline mode.

http://cloc.sourceforge.net v 1.56 T=1.0 s (369.0 files/s, 34135.0 lines/s)

---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
Java           312           7896           3506          20464
GLSL            54            402             86           1565
XML              2             34              4            177
DOS Batch        1              0              0              1
---------------------------------------------------------------
SUM:           369           8332           3596          22207
---------------------------------------------------------------
Scrollbars are done&#8230; kind of a pain in the ass.
Features:
click the arrows to inc/dec by smallStep
click the empty track to inc/dec by largeStep
hover and scroll mouse to inc/dec by smallStep
click and drag thumb to directly set value
thumb size proportional to data displayed
optional Skynet uplink for enhanced scroll precision

Scrollbars are done… kind of a pain in the ass.

Features:

  • click the arrows to inc/dec by smallStep
  • click the empty track to inc/dec by largeStep
  • hover and scroll mouse to inc/dec by smallStep
  • click and drag thumb to directly set value
  • thumb size proportional to data displayed
  • optional Skynet uplink for enhanced scroll precision
I think everyone should have to code a text input control. It builds char[].
I&#8217;ve come to a point where I can no longer put off the text input. Inspired by the recent text input adventures of Hume over at humespeaks.tumblr.com, I decided to buckle down and handle it.
The current iteration has most of the amenities you look for in a text box. Things like a movable, blinking horizontal and vertical cursor, key repeat with adjustable delay and repeat rate, accepted character filter, home, end, backspace and delete. It also supports arbitrary fonts, font sizes, and kerning.
I imagine this is much more difficult with a lack of string abstraction.
Also, this:
http://cloc.sourceforge.net v 1.56
T=2.0 s (160.0 files/s, 14882.0 lines/s)
---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
Java           264           7373           3309          16808
GLSL            54            402             86           1564
XML              2             35              4            183
---------------------------------------------------------------
SUM:           320           7810           3399          18555
---------------------------------------------------------------

Not sure why it says only 160 files and 14k lines in the top part. That is obviously not right.
As it turns out, during the creation of this control, I discovered a substantial bug in my text renderer. The renderer was using glBufferSubData to buffer new VBO data into the eldest VBO in the cache. Note: This doesn&#8217;t work when the VBO data you&#8217;re replacing is smaller than the data you replace it with.

I think everyone should have to code a text input control. It builds char[].

I’ve come to a point where I can no longer put off the text input. Inspired by the recent text input adventures of Hume over at humespeaks.tumblr.com, I decided to buckle down and handle it.

The current iteration has most of the amenities you look for in a text box. Things like a movable, blinking horizontal and vertical cursor, key repeat with adjustable delay and repeat rate, accepted character filter, home, end, backspace and delete. It also supports arbitrary fonts, font sizes, and kerning.

I imagine this is much more difficult with a lack of string abstraction.

Also, this:

http://cloc.sourceforge.net v 1.56
T=2.0 s (160.0 files/s, 14882.0 lines/s)
---------------------------------------------------------------
Language     files          blank        comment           code
---------------------------------------------------------------
Java           264           7373           3309          16808
GLSL            54            402             86           1564
XML              2             35              4            183
---------------------------------------------------------------
SUM:           320           7810           3399          18555
---------------------------------------------------------------

Not sure why it says only 160 files and 14k lines in the top part. That is obviously not right.

As it turns out, during the creation of this control, I discovered a substantial bug in my text renderer. The renderer was using glBufferSubData to buffer new VBO data into the eldest VBO in the cache. Note: This doesn’t work when the VBO data you’re replacing is smaller than the data you replace it with.

Implementing screen-space ambient occlusion (SSAO) using a normalized hemispherical sample kernel oriented with the fragment normal. This technique is similar to the Crysis technique, except that the re-oriented kernel reduces the self-occluding artifacts produced by Crysis’ spherical kernel method. This means that flat surfaces are not ~50% occluded, or grey.

The SSAO implementation has two quality settings: high and low. The high setting (top right) performs all operations full-screen, while the low setting (top left) downsamples the g-buffer depth and normal components and performs the operations at half resolution, or 1/4 of the pixels, then upscales back to full resolution.

For the blur passes, I use a version of cross-bilateral filtering coupled with a separable gaussian blur to preserve edges. The gaussian coefficients are weighted based on sample distance and magnitude of normal variance. During each pass, the weights are totaled and used to normalize the result. Each pass samples only six times, taking advantage of hardware accelerated linear filtering, reducing the samples needed for a 5x5-tap, edge-aware blur filter from 75 to just 18 samples. The high quality mode blurs three times for a total of 18 source, 18 depth, and 18 normal samples per pixel. The low quality mode blurs only twice for a total of 12 source, 12 depth, and 12 normal samples.

The bottom image illustrates the artifacts that occur when using guassian blur (left) and the elimination of those artifacts when using cross-bilateral filtering (right).

Which tone mapping operator do you like better, left, middle or right?