Thursday, January 31, 2008

A* Algorythm in Java - Download

I wrote this code a while ago, and I've finally got round to putting it here for public use. It's the A* path-finding algorythm, nicely self contained and ready for use. It can run in a thread if required, and to use it, you can simply write:-

AStar my_astar = new AStar(mymapclass);
WayPoints route = my_astar.findpath(start_x, start_y, end_x, end_y, b_run_in_thread);

Your
mymapclass must implement the IAStarMapInterface (included), which has 3 methods: getWidth(), getHeight() and isTraversable(). This tells the algorythm where it can and can't go. The class WayPoints is just an ArrayList of Points, giving the route.

I've used this code in all of my games (that require pathfinding) like Nuclear Graveyard and TremulousHulk.

(For those not in the know, the A* algorythm basically finds the closest path from one co-ordinate to another, taking into account blocked points.)

Monday, January 28, 2008

Tiny Web Server

There seems to be a durge (if that's the right word) of web servers called "Tiny Web Server", all vying to be the smallest web server. And now there's another one! I don't think it's the smallest, but it is a full web server for delivering static pages and documents.

It's written in Java, and the source comes to 23K. It should be pretty easy to extend to make it write dynamic web pages, so it should be ideal for starting your own web server project, or just giving you an idea of how web servers work. Or how not to write code. Take your pick.

It's available via SVN here. (That's svn://www.onlinegameplanner.co.uk/TinyWebServer).

Wednesday, January 16, 2008

Originality is a Curse

...That's probably why most games companies still churn out mostly FPS's and endless sequels to those FPS's.

I've written a game called Nuclear Graveyard which (IMHO) has a bit of originality: it's what I call pseudo-realtime. This means that rather than be proper realtime, it uses action points (e.g. walking forwards costs 1AP) but unlike most games that use APs, the player's APs are replenished automatically as both sides use them up.



Unfortunately, when most people play it, they don't seem to read the instructions, and assume that it's either a normal FPS ("why can't I move?") or a normal turn-based game ("How do I end my turn?"). I can't blame people for not reading instructions - who does? - but I've tried my best to make it self-explanatory, and included a tutorial, but to no avail. What do I do?

Friday, January 11, 2008

Multiple Platforms, Multiple Databases

SQL Enterprise Manager (or SQL Server Studio, as M$ like to keep changing the name) isn't a bad program, but obviously it only works with MS SQL, and only on Windows. Since I use MySQL, PostgreSQL, Oracle and MS SQL on Windows and Linux, I've been looking for a single program that can handle all of these databases, and I've found one: Aqua Data Studio.

It's written in Java (though there are other versions available) so it runs on Windows and Linux, and it easily connects to almost every kind of database, allowing you to do all the impotant things that SQL Server Studio does, like view the tables, edit the data, run queries etc...

I'm not affiliated with Aqua Fold in any way, but I thought I'd mention a program that is really useful and pretty good. It's free for personal use as well.

Wednesday, January 09, 2008

Domain Name Front Running

I wondered if any companies do this (i.e. you search for a domain with the intention of buying it, and the company that you use to search for it buys it up, knowing that you want it). And yes! Of course it happens...

Friday, January 04, 2008

My New Language

I have finally abandoned my attempt at a new Lisp-like language. I don't think I realised how hard it would be. Converting a text file of my new language into an AST (an active syntax tree) was the easy part. The hard part was storing variables (globals v locals, scope, identically named vars overriding each other, etc...) and calling functions (i.e. replacing the params in the function) among other things.

I should have planned it all better as I was also going round in circles with my language definition: I was changing it to fit one circumstance, but then forgetting why I'd done that, and then I'd change it back again to fit the original circumstance.

However, the final nail in the coffin was my thought "what am I going to do with it when I've finished?" It obviously had no IDE, barely any libraries, no debugging facilities, probably lots of bugs, and probably lots of flaws in the design. Why would I, never mind anyone else, choose to use it when there's plenty of other better languages out there?

Still, it's given me a new insight into how languages (might) work, and hopefully made me a better programmer. Now onto my next project: a mega-multithreaded program, where every little aspect has it's own thread. It's how the human body (i.e. cells) work (I think) so it must be a step in the right direction. And with all this talk of parallel programming, it can't do any harm for me to fail at that as well.