Small Code Updates

AI Space Game, General, Misc., Projects No Comments »

Well, still not much to report over the last few days. I’ve just started my end-of-year Java and CSE1SYS (that’s C++) assignments, which are due in the next two weeks.

I’ve uploaded the last version of my Space AI “game”. It was a fun learning experience, but now I’m ready to move on to another project - perhaps even a proper 2-player clone of the old-but-gold Star Control 2 one-on-one action.

I’ve also uploaded a slightly tweaked version of my JRender (simple Java 3D software renderer), which I converted over to a normal JFrame application rather than an applet. Now model files can be opened by running the Engine program from the command line, rather than having to re-compile as was done previously. Having the code as a normal java application also has the added benefit of not requiring the JDK AppletViewer program to run it.

Exams will commence in only a few short weeks, and I’m currently scrambling to get everything done in time. As can be noted over the past few weeks my play-time is almost non-existent, so to those waiting for me to hurry up and finish MyUSB already (I’m sure there’s SOMEONE out there!) please accept my apologies and hang on a few more weeks. With the end of the University semester I’ll have a full three months minimum to fully devote to AVRs, Java and comp/elec. systems in general. Yee haw!

Terminally Busy

AI Space Game, Projects, Website 1 Comment »

Since quite a lot of people are finding this site due to my blog post about my HL-340 USB to Serial adapter - presumably looking for the driver - I’m going to be a good Samaritan and upload it for public download. Get your HL-340 driver here! I have nothing to do with the adator or the drivers, so please don’t email me hoping I’ll be able to provide technical support; chances are I’m as totally clueless as you are.

I’ve also uploaded the latest source code to my Java Space “game”, which is available from the new site page here. I’ve been heavily reworking the backend code, which now uses a slower, but MUCH nicer ArrayList to store the game objects. I’ve been opting for ease of use over speed for the latest revisions - battles shouldn’t be more than one or two thousand ships at the extreme, and the simplified vector routines and ArrayLists make for a much more accessible and pleasant coding experience.

I’m still modifying the game code, and adding new features. New is a function to turn on or off gravity effects for bullets - so you can code some dastardly AIs that can “throw curve balls” using nearby planets.

Mutual attraction

AI Space Game, Projects, Website No Comments »

Plenty of visitors to my site from AVRFreaks since I put up the link to my DB101 board review a few days ago - well more than usual anyway, with an average of about 40 unique users each day visiting some portion of my site. Actually, I’m quite frankly surprised that there hasn’t been much discussion of the DB101 board online, sans for a few posts in a single AVRFreaks thread. I hope that will increase once others start getting the boards into their sweaty palms, as it really is a great board.

A few days ago I posted my space game to a discussion board about an old game (now free and open source) called Star Control, from which I “borrowed” the basics of the gameplay from. The response was a little less interested that I had hoped for - and in several cases, downright hostile - but I’m continuing with it regardless. To make it more interesting I’ve just finished adding planets with gravity and collisions.

Also new is the playfield scaling, where in the graphics mode the arbitrarily sized playing field can be scaled to fit the chosen size of the applet. Both of these features are visible in the below screenshot:

Space Game with Planets and Scaling

A zip archive with the current game source is available for download here in case anyone wants a gander at it. It’s unfinished and my first working game, so go gentile with the criticism! Actually, I wouldn’t mind chatting with someone experienced with this sort of thing, so I can get some ideas on how to structure the game. While this is really just an exercise I want to do for myself, I’m nevertheless interested in knowing how the “real” games work under the hood.

Stargazing

AI Space Game, MyUSB Library, Projects No Comments »

Well, more work on the space game, and it’s now in a state ready for AIs. Anyone willing to give writing a simple AI a go?

Today between classes I reworked the ship and bullet list management. Previously I had written up a nice generic linked list manager, which worked quite well - and expanded as needed to fit into the available memory of the host machine. However, speedy it was not, due to all the object creation and removal required to manage the list, and as a result caused quite a drop in performance for large games (a 5,000 ship random battle took several minutes just to populate the list on my machine). Replacing it with basic, static lists reduces some of the functionality and increases the memory requirements, but results in a massive performance increase.

Space Game running with a large amount of ships

Above is a screenshot of the engine running a battle of initially 5000 ships (with each ship’s movement and firing being completely random).

As for my USB stack, this week I’ll finally have some time to work on it again. In the meantime, I’ve updated both the basic library zip on my site, and the USB Mouse demonstration firmware to the latest library code.

Greetings, Proffessor.

AI Space Game, MyUSB Library, Projects No Comments »

Well, I figured out the problem behind the USB host failing to give the correct connection interrupts - the current draw was too large. The poor 9V battery I’ve been using all this time just couldn’t power the VBUS regulator enough for the USB memory stick, and so the VBUS levels were dropping below the minimum threshold. I’m damned glad I have a JTAG for all this - without being able to see the VBUS error bit set it would have been a needle in a haystack search.

Don’t know what a JTAG is? Here’s an article I wrote about the official Atmel AVR development tools.

Now that I’m getting the connection interrupts, it should be straight forward (if time-consuming) to finish off the host Chapter 9 code and get the host mode in a near-complete state.

As for University, I’m working on a new project. Since the 3D Java code, I’ve since ported the code to VB.NET, as well as to C (with the GDK toolkit for window management on Linux). The latter project was a disaster - horrible performance and very hard to use API.

To break from the graphics mold, I then coded up a rudimentary game of snake, which utilized an experimental linked list library I coded up in Java. That worked well, but I never got to finish it before coming up with my latest idea - a space game!

Actually, a space game with a difference. With the framework almost done, the game should be quite interesting, as no human interaction is possible. The framework allows for multiple ships with multiple teams to be created, each driven by a different AI module. That allows myself (and a few fellow Uni friends) to code up AI modules and pit them against one-another.

Space Game Screenshot

The graphics front-end is completely decoupled from the game back-end, so for accelerated testing the game backend can be driven by a graphics-less console front-end. The best way to get an accurate measurement of one AI module’s performance over another is to make the computer play many, many rounds and check the win totals, so that’s what will happen in the end. For now, the graphical, slowed down front-end serves as a great debugging aid.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in