"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)
Showing posts with label Fun-Programming. Show all posts
Showing posts with label Fun-Programming. Show all posts

Monday, 17 October 2016

LibGDX: The “Swiss Army Knife” of Java Games Programming


My few readers might remember I sometimes explore, and play with, game engines and libraries. I suppose it's a sort of “compensation” for my everyday work with not-so-exciting middle-ware and web-services projects. I already posted about Slick2D libraries for Java games but I was looking for something more complete and, most of all, that would allow me to develop also Android applications.
LibGDX is a Java game-engine that provide a vast variety of features for developing games. It's mostly aimed to 2D games development but it even provides some 3D features. In addition LibGDX can deploy games on different platforms like Java desktop or Applet, Android, HTML5 and IOS (with some extra requirement due to peculiar Apple developing policies). Last but not least a LibGDX project can include additional extension libraries helping to develop different aspects of game programming like AI, physics or networking (and this is the why of this post title).

First project creation

You don't have to download the whole LibGDX project in order to start to develop. LibGDX people suggest using the handy utility they provide, LibGDX Project Setup, in order to generate a skeleton project. The generated project will be based on the Gradle building tool that will think about downloading from the Internet all needed libraries and their dependencies.

Saturday, 15 November 2014

The quest for new languages: Scala

As a programmer I try to keep track of the new tools are continuously made available to my work. It's a hard task, almost impossible, since every day new languages, framework or libraries are proposed on the Internet. I usually follow a conservative strategy by leaving novelties to “grown up” a little in order to see it they are more or less widely used.
I've been recently reading this article, among the many languages and technologies cited one particularly awakened my interest: Scala.

Why Scala?

Three things about Scala caught at my attention: first it runs on a standard Java virtual machine this means an easier integration with the programming ecosystem I'm mostly used to work with. Then I learned that Scala implements the functional programming paradigm. I really know little about functional programming but the idea of learning a new programming paradigm really enticed me. Last, but not least, Scala is nowadays widely used in big and complex software projects like Twitter or LinkedIn.

Scala on Eclipse (Luna)

A good Eclipse plug-in is available for Scala named Scala IDE for Eclipse. I fist tried downloading the one available at Eclipse Marketplace but I soon discovered it didn't work with Eclipse Luna. After some searching in the Internet I discovered the only working version for Eclipse Luna is version 4.0 release candidate 2. Installing the plug-in has been only matter of copying the update address into Eclipse “Install new software” window, agreeing to licenses and following instructions.

Wednesday, 4 December 2013

Fun programming: Andengine


Here I am back on the “Fun programming” theme: finding ways to have some fun while programming. A way I use to detach myself from daily routine while seeking for new techniques or languages to learn. While visiting back this blog I noticed many articles about Andengine: a promising 2D games engine for Android developed by Nicolas Gramich.

Setting-Up Andengine

The starting point so set-up a working Andengine environment is to have a working Android development set-up based on Eclipse and Android SDK. I had prepared it before during my previous Android experiments. Also is needed a Git plug-in for Eclipse, like EGit.

Andengine is available as a Android library project it can be easily downloaded from its GitHub page by selecting Eclipse import wizard (Choosing the “File → Import …” menu first then the “Git → Projects from Git” option).
After copying the project URI in the wizard request …
The project branch must be selected, I did choose the GLES2 branch the latest and the one currently under develop.

Thursday, 2 May 2013

Slick2D on Netbeans (and the EEEPC)


This post is sort of a corollary at my previous post: after trying Slick2D on my desktop computer, and Eclipse, I decided to port the demo projects to Netbeans, on the EEEPC, where I do many of my programming experiments.
The use Slick2D with Netbeans is covered, in the site wiki, as well as the Eclipse case. The first step is creating a Java application project
once the project has been created Slick2D and LWJGL Java libraries must be added to the project class-path. This can be done by selecting one-by-one the needed JAR files but, if you're going to make more than one project setting-up a custom library will be handier.
So I, from the project properties, I selected the libraries folder then the “Add Library ...” button.

Thursday, 25 April 2013

Fun programming: Java and Slick2D


Many may not believe me but programming can be fun. If you really love programming even watching a XML file going to, or coming, from a remote server can be fun but, of course, if your program produces something funny then programming is also more fun. So, while looking for something to relax after watching too much XML files, I decided to experiment with some 2D game engine. 2D gaming has been for many years confined to the Adobe Flash or J2MEmini game” context. More recently , with the ever wider smart-phones diffusion, 2D games have known a real revival.
Among the many 2D games engines available I first restricted my choice to the Java-based ones. After a short examining of available features and documentation I decided to try first the Slick2D engine.

Slick2D

Slick2D is a Java game engine mostly based on the LWJGL (Light-Weight Java Game Library) library. The aspect of Slick2D the more appealed to me, and triggered my interest, is the ability to begin coding a simple game by just extending a class and writing three methods.
Slick2D offers in fact an abstract class BasicGame, once this class is extended just three methods have to be implemented:
  • init() : is called once when the game is started
  • render() : is called every time the screen is refreshed
  • update() : is called when controls (keyboard, mouse, joystick, ...) are read
The programmer can mostly ignore the other aspects of the game and concentrate on these three events.
Of course writing a complete game will still be a complex task but, Slick2D makes very simple the initial approach to game programming easing a lot the learning curve at the beginning.

First project

To prepare my first project I first downloaded Slick2D jar file and LWJGL zip archive, I then extracted it in a convenient folder in my home directory. In Eclipse I first made a standard Java application project