Rabbit Escape (a bit like Lemmings) v0.1 released for Linux, Windows and Mac

Today I am releasing the first version of my new game, Rabbit Escape.

It’s an arcade puzzle game inspired by Lemmings and Pingus, but intended to be simpler and easier to control on a mobile device.

Your task is to guide a party of rabbits from the entrance to the exit by dropping tokens in front of them that give them special abilities such as building bridges or climbing walls.

Here’s what it looks like:

Rabbit Escape

An Android version will be coming soon, but for now I’m releasing the desktop version for Linux, Windows and Mac.

There are 60 levels, and I’m hoping people will be sending me lots more soon!

I plan to write a level editor, but for now you can create your own levels by editing text files.

The game is Free Software under GPL v2, and the graphics, levels etc. are released under the non-commercial Creative Commons BY-NC-SA licence. The choice of a non-commercial license for these parts is intended to prevent people copying the game wholesale onto an app store and making money from it. If you want to use it under a different license, please contact me.

I plan to charge the minimum price on the Android store, and offer the desktop version for free (providing an opportunity for donations).

Please try it out and let me know how you get on. It’s a bit rough around the edges, but the game mechanics work, and it seems like it might be fun.

If you’d like to contribute, I’d be very excited! You can find the code at github.com/andybalaam/rabbit-escape.

Snake in Groovy

Series: Groovy, Ruby, BASIC, Dart, Elm, Python3+Qt5

I’m starting a series where I write the game Snake in lots of programming languages.

I almost always use writing Snake as my way in to understand a new language, so I’ll share my thoughts about each language as I go.

Slides: Snake in Groovy

If you want to, you can Support me on Patreon.

Programmatic equivalents of web.xml sections for Tomcat

Most documentation for J2EE configuration is based on having a web.xml file, but I want to configure my Tomcat programmatically. Here are some of the things I have found out.

Please use the comments below to correct what I got wrong, and mention equivalents for other parts of web.xml.

Getting started

<web-app ...

in code becomes something like:

import org.apache.catalina.Context;
import org.apache.catalina.startup.Tomcat;
...
Tomcat tomcat = new Tomcat();
Context context = tomcat.addContext( "", "WebContent" );

Adding a Servlet

<web-app ...
    <servlet>
        ...
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>com.example.MyServlet</servlet-class>
        ...
    </servlet>
    <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/foo/*</url-pattern>
    </servlet-mapping>

in code becomes something like:

...
Class servletClass = MyServlet.class;
// MyServlet extends javax.servlet.http.HttpServlet 
String servletName = servletClass.getSimpleName(); // Or something else if you like
Tomcat.addServlet( context, servletName, servletClass.getName() );
context.addServletMapping( "/foo/*", servletName );

Adding a filter

<web-app ...
    <filter>
        <filter-name>MyFilter</filter-name>
        <filter-class>com.example.MyFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>MyFilter</filter-name>
        <url-pattern>/bar/*</url-pattern>
    </filter-mapping>

in code becomes something like:

...
import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.deploy.FilterMap;
...
Class filterClass = MyFilter.class;
// MyFilter implements javax.servlet.Filter
String filterName = filterClass.getSimpleName(); // Or something else if you like
FilterDef def = new FilterDef();
def.setFilterName( filterName );
context.addFilterDef( def );
FilterMap map = new FilterMap();
map.setFilterName( filterName );
map.addURLPattern( "/bar/*" );
context.addFilterMap( filterMap );

Adding a Listener

<web-app ...
    <listener>
    	<listener-class>com.example.MyContextListener</listener-class>
    </listener>

in code becomes something like:

...
context.addApplicationListener( MyContextListener.class.getName() );
// MyContextListener implements javax.servlet.ServletContextListener

This is for a ServletContextListener: it may be similar for other listeners, but I’m not sure.