Ludum Dare 24 [01] 11.00 AM First commit

The theme is Evolution.

Wow, it actually won this time. I didn’t brainstorm on any idea for this them because, well yeah, it never wins. So, after about an hour I got to writing some concept code in Groovy. Threw it out, started over. Threw that out as well. And then I went back to my original thought: do something with the mouse.

The idea is to have the mouse do actions and stuff, not sure on what exactly, and from there, you can upgrade your mouse. Eventually your mouse will have the arms of a bodybuilder. I’m not sure how I’ll show the upgrades (if I’ll show them at all). The main idea here is that I’ll be learning about mouse interfacing and collision detection.

Screenshot time!

 

Ok, that’s lame. The mouse pointer doesn’t show…

Anyways, my code repository!

https://bitbucket.org/mymilkedeek/ludum

Ludum Dare 24 – [00] Getting ready

Rejoice game devs, it’s Ludum weekend! And I’m entering once more. I’m nearly ready for my third participation. My “I’m in” post.

Things on my To Do list:

  • get some raw ideas in my head. The last theme selection went up and I’ll need to see if I can come up with some simple ideas based on those themes.
  • decide on which genre/game mechanic I want to go. I’m undecided between a board game approach and a more arcade approach using only a mouse as an interface.
  • stock up on food and drinks.
  • linux screenshots for my timelapse.
  • check out launch4j.
  • check out some music programs.

I learned quite a bit from previous ludums. First of all, keep going. Second of all, keep going. Third, stupid fixes to bugs/errors are usually the best. Fourth, keep the code clean as possible. The first Ludum was a pretty codebase gone ugly. My second Ludum was an ugly codebase gone even more ugly. I plan to make the codebase for my third entry a pleasant one. I’m stressing the verb “plan”.

I should also do a bit more on the preparations side beyond coding. Or at least not the night before it begins…

 

Things I’ll do better than last time:

  • collision detection. I figured out how to do it “elegantly”. Still not there yet, but a whole lot better than what i did for LD22 or for LD23
  • coding. Didn’t you hear? Groovy is awesome.
  • deployment. This time, it’ll work everywhere else.
  • making my game fun.

A fun game, you say? Why didn’t I think of that? Well yeah, last times I went with what I had. But this time, I’m going to go somewhere.

 

My planning:

  • Friday-Saturday night; try to wake up at 3 AM to read the theme. Go back to bed and dream about it.
  • Saturday noon; basic gameplay, placeholder art and sfx/bgm
  • Saturday afternoon-evening-Sunday morning; advanced gameplay
  • Sunday noon-afternoon; art and sfx/bgm
  • Sunday evening; submission

I haven’t planned it, but somewhere in between there should be a spot or two for some panicking, anxiety and tranquility. Isn’t Ludum Dare fun?

 

Have fun,
Eek.

Groovy and Tomcat, Pt4 – Groovy Servlet Pages

Groovy Server Pages (GSP)

Setting up GSP is as easy as setting up scripts.

Add following to the project:

– groovy.jar
– groovy-json.jar
– groovy-servlet.jar
– groovy-templates.jar
– groovy-xml.jar
– antlr.jar
– asm.jar

web.xml


<servlet>
 <servlet-name>GroovyPages</servlet-name>
 <servlet-class>groovy.servlet.TemplateServlet</servlet-class>
 </servlet>
 <servlet-mapping>
 <servlet-name>GroovyPages</servlet-name>
 <url-pattern>*.gsp</url-pattern>
 </servlet-mapping>

And then just create your .gsp file:


<html>
<head><title>Groovy Pages</title></head>
<body>
<p><% println "hello world" %></p>
</body>
</html>

Navigating to the gsp url gives me the following:

Still easy as 1-2-3.

The next part will be up later tonight as it’s under construction. It will feature a project that ties all the different groovy parts together into one project.

Until then, take care,
Eek.

Groovy and Tomcat, Pt3 – Groovy Scripts

In this part I’m going to show you how to use Groovy Scripts on a Tomcat. It’s very easy to do!

First add these libraries to your project:

– groovy.jar
– groovy-json.jar
– groovy-servlet.jar
– groovy-xml.jar
– antlr.jar
– asm.jar

You might need to add more to the project depending on the functionality of your scripts, but this is the minimum I needed to not encounter any exceptions.

Next, in your web.xmladd the following servlet;


<servlet>
 <servlet-name>GroovyScript</servlet-name>
 <servlet-class>groovy.servlet.GroovyServlet</servlet-class>
 </servlet>

<servlet-mapping>
 <servlet-name>GroovyScript</servlet-name>
 <url-pattern>*.groovy</url-pattern>
 </servlet-mapping>

Groovy will then compile your scripts and run them as requested. For a quick test, put this in your webapp root folder and have its name end with .groovy, I named mine script.groovy, but you should name it something more meaningful.


def ip = request.getRemoteAddr()

println """
<html>
<head>
<title>Groovy Scripts</title>
</head>
<body>
<p>Hello ${ip}</p>
</body>
</html>
"""

Navigate to the url of the script and you’ll get a warm welcome.

Wasn’t that easy?

Stay tuned,
Eek.

Groovy and Tomcat, Pt2 – Groovy extends HttpServlet

Continuing where we left off…

The jars you’ll need for this part are the same as the ones for part 1:

– groovy.jar
– antlr.jar
– asm.jar

GroovyHttpServlet


package net.mymilkedeek.tomcat

import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

class GroovyHttpServlet extends HttpServlet {

 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
 req.session.setAttribute("language", "groovy")
 req.session.setAttribute"sentiment", "awesome")
 req.session.setAttribute("message", JavaGroovy.message())
 resp.sendRedirect("index.jsp")
 }

 @Override
 protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
 super.doPost(req, resp)
 }
}

And add it to the web.xml

</pre>
<servlet>
 <servlet-name>GroovyHttpServlet</servlet-name>
 <servlet-class>net.mymilkedeek.tomcat.GroovyHttpServlet</servlet-class>
 </servlet>
 <servlet-mapping>
 <servlet-name>GroovyHttpServlet</servlet-name>
 <url-pattern>/groovyhttpservlet</url-pattern>
 </servlet-mapping>
<pre>

Now, navigate to the Servlet url and watch Groovy take care of everything:

So, in short, what we did was replace a Java HttpServlet with a Groovy HttpServlet.

For my next blog post, I’ll show you how to set up a Groovy Script in a webapplication.

Stay tuned,
Eek.