Installing Redis to Windows / Linux

I recently began adding support for a global leaderboard system to my latest Unity game and decided that instead of the huge overhead related to going the RDBMS SQL route that i would have a crack at implementing back-end storage using a NoSQL database instead, which whilst much faster than traditional RDBMS is much more restrictive in terms of query. In fact Redis is for all intents and purposes almost impossible to query in any kind of depth. That said, I am not particularly interested in its relational query features but more in its ability to store and run basic queries on data very quickly, which Redis does extremely well.

Note that I am writing this article with a view to using Redis from Node.js, I will cover using Redis from .NET Core in a later article. If you missed my article on installing node.js then look here.

What is Redis

Redis is a fast in memory key/value store that can be used like a database. It differs aainly to SQL in that complex queries cannot be ran on the data, but if you do not need to carry out complex queries on the data (for example a persistent game world map or a leaderboard) then something like redis is ideal for storing the data.

Installing Redis

Windows

For Windows download the MSI release from here then install it. Redis will be installed as a service. You can take a look in Task Manager to ensure that Redis is running. To confirm the install open up command prompt and run Redis command line interface redis-cli.

Linux

Installing redis on Linux is not so easy because you need to build the latest stable release, firstly lets get the tools you are going to need to build Redis:


sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install tcl8.5

Download and untar the latest stable build:


wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz

Now lets build Redis:


cd redis-stable
make
make test
sudo make install

Run Redis as a background daemon (a script has been provided to do this), note that you will be asked to set some options, just choose the defaults for the moment:


cd utils
sudo ./install_server.sh

The above script creates a script in etc\init.d called redis_6379 (the numbers represent the port that you selected during install).

To get Redis to run automatically on boot:


sudo update-rc.d redis_6379 defaults

Installing Redis client library for Node.js

This is actually very simple, run the following:


npm install redis

We can now reference Redis from Node.js by importing Redis in our Node.js code:


var redis = require("redis");

Testing Redis with Node.js

Create a new file called redis_test.js and add the following code:


var redis = require("redis");

// Create the redis client
var client = redis.createClient();
client.on("error", function (err)
{
console.log("Redis error: " + err);
});

// Try out a simple command
client.set("my_key", "some value");

For more information on Redis see the Redis website

The all new IndieDeveloper a social community for game developers

Do you love to make games?  Are you passionate about making games?  Do you want to find other developers just like yourself?  Well, I recently came across a new social community and resource for developers of all professional skill levels. You can join a community of independent game developers and find a collaborator, a team, a project, or just a new friend. Well what are you waiting for, see you over at IndieDeveloper, If you want to friend me, I’m user mrmop,.

 

Booty5 HTML5 Game Maker 1.9.2b out now – Web Audio API Support Added

Support for the Web Audio API has been added offering better control over audio playback. Using it is s simple case of ticking support for it in the projects properties (on by default).

Full list of changes include:

Game Editor v1.9.2b:

  • Added new use web audio export option to project settings
  • Added new auto play property to sounds which cause sound to automatically start playing once loaded
  • Added new export option force_round which will force all exported actors to use pixel rounding
  • Fix: Project property smoothing is now applied in exported code
  • Fix: Canvas centering on some mobile devices

Game Engine v1.4.8 and 1.4.9:

  • b5.Xoml.loadJSON now accepts 4th parameter which can be used to stipulate loaded data should be returned as binary buffer
  • b5.App.use_web_audio property added which can be used to switch on support for Web Audio if it is supported
  • b5.Xoml.loadJSON moved to b5.Utils.loadJSON
  • b5.Xoml.loadJS moved to b5.Utils.loadJS
  • Added support for web audio API to sound (default is enabled). To disable Web Audio set b5.App.use_web_audio to false. If web audio is not supported then it will fallback to HTML5 Audio
  • b5.App constructor now accepts a second parameter which enables / disables web audio support
  • Added b5.Sound.auto_play property to enable auto playback of sounds after they are loaded
  • JSDoc documentation added
  • b5.App.canvas_fill_window removed
  • Modified how the render scaling and canvas resizing works to make it easier to use.

Download the latest version of Booty5 HTML5 Gama Maker.

Booty5 HTML5 Game Maker 1.9.1b Available – Text preview and collision flags

Booty5 the HTML5 Game Maker v1.9.1b is now available for free download.

Editor Changes:

  • Scale and angle are now affected in multiple actor selections
  • Editor export properties now supports smoothing property that will enable / disable anti-aliasing during rendering
  • Added support for rounding pixels to actors, if disabled then pixel coordinates will be rounded to integer values, can improve performance but at a cost of lower precision rendering
  • Removed some currently unused options from sprite and label
  • Font size and face separated in labels
  • Font weight added to label
  • Editor now shows text preview
  • Exported collision flags are now used by engine
  • Added vertices snap to shape editor
  • Added new Collision Flags example
  • Fix: Convex shapes were not exporting correctly
  • Fix: Some properties such as actor scale were not exporting correctly with an export precision of 0

Engine Changes:

  • Added new property to Actor called round_pixels, when set to true vertices will be rounded to integer which can speed up rendering significantly
  • Added support for collision flags to physics fixtures (category, mask and group index)

The Booty5 HTML5 game manual ebook has also been updated.

Booty5 HTML5 Game Maker 1.9 Available – Tiled Maps

Booty5 the HTML5 Game Maker v1.9.0b is now available for free download. Support for tile map rendering has been added to the engine, whilst support for tile map editing has been added to the game maker. A quick screen shot of the new tile map editor is shown below:

Booty5 HTML5 tile map editorBooty5 HTML5 tile map editor

Full list of changes include:

Game Engine v1.4.6:

  • Added new actor type called MapActor which can render tiled maps
  • Support added to Xoml for loading Booty5 game editor exported tile maps
  • Fix: Actor.vr wasn’t updating transform

Game Editor v1.9.0b:

  • Added support for tile maps (any sprite actor can now be changed to a tile map by changing RenderAs type to Tile Map)
  • Added pretty print export options that will export JSON in a tidy readable format

The Booty5 HTML5 game manual ebook has also been updated.

You will also need to replace all examples which can be downloaded from Github.

Free Booty5 HTML5 Game Maker Manual e-book now available

The first version of the Booty5 HTML5 Game Maker Manual e-book is now available for free download. Find out more on the Booty5 free e-book page.

Booty5 v1.8.9b now available – Code restructure and Actions Lists

Booty5 1.8.9b out NOW

Booty5, the HTML5 Flash Like Game Maker
Booty5, the HTML5 Flash Like Game Maker

Booty5 1.8.9b represents a big shift towards making the Booty5 JavaScript engine more modern, a number of major changes have taken place to the engine including:

  • Code restructured
  • All classes moved into the b5 namespace
  • TheApp class renamed to App
  • window.app replaced with b5.app
  • Added new property to App called canvas_fill_window which when set to false will prevent the canvas from being resized to fit window
  • Added support for sequential and concurrent actions to app, actors and scenes via ActionsListManager and ActionsList classes
  • Large collection of pre-defined actions added:
    • A_ChangeActions
    • A_CreateExplosion
    • A_CreatePlume
    • A_ChangeTimeline
    • A_AttractX
    • A_AttractY
    • A_Attract
    • A_Sound
    • A_CamStopMove
    • A_CamGravity
    • A_CamMove
    • A_CamMoveTo
    • A_CamFollow
    • A_CamFollowPath
    • A_CamFollowPathVel
    • A_CamLimitMove
    • A_Wait
    • A_SetProps
    • A_AddProps
    • A_TweenProps
    • A_Call
    • A_Create
    • A_Destroy
    • A_FocusScene
    • A_StopMove
    • A_Gravity
    • A_Move
    • A_MoveTo
    • A_MoveWithSpeed
    • A_Follow
    • A_LookAt
    • A_FollowPath
    • A_FollowPathVel
    • A_LimitMove
    • A_SetLinearVelocity
    • A_SetAngularVelocity
    • A_ApplyForce
    • A_ApplyImpulse
    • A_ApplyTorque
  • Actor.setPositionPhysics() deprecated, use setPosition instead
  • Actor.setRotationPhysics deprecated, use setRotation instead
  • Moved getResFromType() out of App and Scene classes into common Utils class
  • Added new Utils.findObjectFromPath() and Utils.resolveObject() which can be used to find actors, scenes, action lists and timelines from a path such as gamescene.actor1.timeline1
  • Added new Utils.findResourceFromPath() and Utils.resolveResource() which can be used to find resources from a path such as gamescene.sound1
  • Added new _atlas, _bitmap, _clip_shape properties to Actor that can use resource paths as well as instances of resources
  • Added new _clip_shape property to Scene that can use resource paths as well as instances of resources
  • Added new _focus_scene and _focus_scene2 properties to App that can use resource paths as well as instances of resources
  • Added vx_damping and vy_damping to scene camera
  • Updated Xoml.js to load new actions lists from Booty5 editor exported JSON format
  • generateExplosion, generatePlume and generateRain now also accept string version of type
  • Logic and rendering decoupled. Logic (app.mainLogic) now ran on timer at default 60 fps whilst and rendering (app.mainDraw) at max frame rate
  • New Actions example added
  • Fix: Animation.Update() locks up when only a single key frame is specified
  • Fix: “none” rescaling method was not working correctly
  • Fix: Box2D forces applied in Actor OnTick were not being applied

Booty5 game maker editor changes v1.8.9b include:

  • Added new property to project section called Fill Window which when set to false will prevent the canvas from being resized to fit browser window. Setting to false is useful if you have a canvas that fits in vertically with other page content as no borders will be shown.
  • Updated events editor
  • IsPath added to Shape properties, which can be used to mark shapes to be used as paths
  • Added actions system and Action List editor to Actors and Scenes
  • Project property Frame Rate now exported
  • Fix: Proportional origins were not working
  • Fix: “Wait for resources” project option not saving correctly
  • Fix: Attempting to export a project that has a brush that points to an image that is not present on disk crashes

Build Flash Style HTML5 Games with Booty5

The latest version of Booty5 the free HTML5 game maker now has support for creating Flash like animations, enabling web developers to create Flash like games across mobile and desktop browsers using an easy to use WYSIWYG game editor. A screen shot of the editor in actions is shown below:

Booty5, the HTML5 Flash Like Game Maker
Booty5, the HTML5 Flash Like Game Maker

View a demo that was creating in less than 30 minutes here.

More details about this release of Booty5 and to download go here.

Booty5 1.8.6b out now – audio fallback, templates, merged caches

Engine Changes:

  • Added new property to Actor called merge_cache which when set to true will attempt to merge the actors rendering into a suitable parents cache. Note that once an actor has been merged into its parent its visual properties cannot be modified
  • Add new property to TheApp called focus_scene2 which sets a 2nd scene as focus, this scene will be used for touch events if the first main focus scene does not respond to them
  • Added support for fallback sound to Sound class via location2
  • Added new min_panning property to Scene. This will prevent panning being marked as true if the movement distance squared is below this value
  • Sound now supports looping via Sound.loop
  • All Xoml parse functions now return the created object
  • New Xoml.findResource() added which searched a Xoml resource collection for the named resource
  • Fixed issue where Actor.current_frame was going out of bounds
  • Fixed polygonActor gradient fill
  • Examples updated
  • New “Create Objects from Template” and “List Menu” demos added

Editor Changes:

  • Added new property to Icon / Label called merge_cache which when set to true will attempt to merge the actors rendering into the a suitable parents cache
  • Scene Current property has been renamed to the more appropriate “Has Focus”
  • Scene has new property called Secondary Focus which sets a 2nd scene as focus, this scene will be used for touch events if the first main focus scene does not respond to them
  • Added new “clone to all scenes” menu action which will clone an Icon / Label to all scenes
  • Added new “delete from all scenes” menu action which will remove all Icons / Labels from all scenes that share the same name as the selected item
  • Added new “copy to scene” menu action which will create a copy of the selected actor and copy it to the selected scene
  • Added new “bring to front” and “send to back” commands to resources tree view
  • Added new resource view text size change buttons which can be used to increase / decrease font size
  • Added new Disable Shadows property to project properties. Setting to true will disable export of all shadows for all actors
  • Added fall back audio file to sound properties, this file will be loaded if original one fails to load
  • Added new loop property to sound which enables audio to be looped
  • CocoonJS added to list of additional API’s (see project properties)
  • Fix: Stopped menu appearing when pressing right mouse button on canvas
  • Fixed bug that generated invalid JSON when exporting label children

more details about these changes can be found at the Booty5 blog