Archive for December, 2012

30
Dec
12

Turbo for DOS

Turbo was created by Doug Ross back in 1987 and is a CGA game written for early IBM PCs. It is much like many old school arcade games such Outrun and Pole position. It is a driving game on a perfectly straight road, where you have to dodge traffic going towards you and in front of you. The game has some very simple CGA graphics which use an often unused colour palette with yellow, green and red. The sprites are quite reasonable for the time being quite large and detailed. There is no sound to speak of. Control is via the keyboard and is pretty simple, but the way your car responds is kinda slow, and often results in crashes that I felt like shouldn’t have happened. Turbo unfortunately hasn’t really stood the test of time very well, it is interesting as a piece of history but not something you’ll spend any time playing.

23
Dec
12

Snooker and 8 Ball for DOS

8 Ball introduction screen

8 Ball introduction screen

Shareware in the early to mid 90’s was often written by single people as a way of getting their software out there and sold. Stephen Haigh wrote two such bits of software, an 8 Ball simulation (most often played in pubs) and a snooker simulation. As children we got the software through the shareware magazines that were much more popular and that my older brother bought. This was how we came across these two shareware games.

The start of a game of 8 ball

The start of a game of 8 ball

8 ball is a simple simulation of the common  pool game played in many pubs around Australia. It was created in 1991 and was a testing ground for the author to see how well the shareware concept would work for him. There are 3 basic modes of play. Practise mode allows you to simply shoot balls around the table and experiment to learn how the game works. 1 player mode pits you against the computer and 2 player mode allows you to play with a friend.

The computer winning

The computer winning

The graphics supported are CGA, EGA and VGA although there doesn’t seem to be much difference between EGA and VGA graphics. The graphics are pretty simple, but get the job done. There aren’t any fancy 3d graphics or anything else to distract from playing the game. Sound comes in the form of PC speaker sound, and surprisingly also has digitised speech that works quite well through the PC speaker. The time you will hear speech the most is when a player makes a foul shot or wins the game. I found that dosbox doesn’t really work very well with the form of digitised sound this game uses. It sounds much better on real hardware. The AI in game is quite good and will win quite often, it isn’t as good at situations that require a bit more thought so there are some ways to trick it, and it sometimes takes a shot that isn’t obvious when an easy shot presents itself.

Information screen for snooker

Information screen for snooker

Snooker was written in 1992 as the author got a good response to the first game. It simulates the much more complicated game of snooker, and has the same 3 basic modes of play. The biggest differences apart from the rules of the game is that the graphics have been upgraded to hi resolution VGA graphics.

The intial set up for snooker.

The intial set up for snooker.

The support for other graphics modes has been removed, understandably because EGA and CGA were no longer really in use. The higher resolution graphics are indeed much better than those from 8 ball, and help to make it easier to make more accurate shots. Sound is through the PC speaker again, also still including the digitised sound with the same problem under dosbox. The AI is pretty similar in behaviour to the one in 8 ball, but because the game of snooker is a bit more complicated it is easier to get a score better or on par with the computer. The only annoying thing is the snooker game has a shareware nag screen, which is a pain if you can’t register the game any more.

Got a high score

Got a high score

My parents have a full sized billiards table, so me and my brothers learned to play snooker on that, and thus these two games had limited appeal to us when we got them. That doesn’t mean they are bad games, just that playing the real thing is more fun. For what they are 8 ball and snooker are well crafted and will give you the experience of playing 8 ball pool or snooker on DOS with out requiring a powerful machine for all the extra bells and whistles many other pool and snooker simulations have. I looked on the internet to find out if there are any free-ware versions of the games, or if there was any contact for the author, but there doesn’t seem to be any information available.

This slideshow requires JavaScript.

19
Dec
12

Java Data Structure Performance

Recently I was browsing Stack Overflow looking at questions asked about Java. One theme that kept on recurring is that of the performance of various data structures within the Java API, in particular the Vector and ArrayList classes were frequently compared. So I decided that i would have a go at working out which data structures perform well.

The first thing I needed to decide upon was what kind of test was fair, and what kind of circumstances would I run the tests. I made a small test framework in Java so I could apply exactly the same algorithm to each data structure. I built the program to perform tests one after another with increasing data sizes to see how the data size affected the results. I wasn’t worried about factors such as the garbage collector and other tasks running on the OS as these would affect all the tests and I could take some precautions to minimise their effect. I’ll make my code available in the code section when I’ve finished tidying it up a bit.

I made code to test several different major aspects of a data structure. I recorded how long (in milliseconds) it took to create, insert into, remove an item by index, and remove an item by its value. I was just using the System.currentTimeMillis() to work out how much time was used, so small-scale accuracy can’t be assured. If you want to be more accurate you could use a profiler on the same code. I chose to not require the data be ordered within the collections as the tests are not dependant upon ordering within the data structure.

I tested 4 different data structures and had a dummy test with no data store to check the algorithm for the tester wasn’t causing extra overhead. I tested an implementation of a standard primitive array and LinkedList as well as the Vector and ArrayList classes. I’ve graphed some of the results I had at the bottom of this post. The first result that I found very interesting is with 1000 or fewer records there are no significant differences between the various data structure types. So if you aren’t storing large amounts of data there is little to gain by picking one data type over another.

The LinkedList data type interestingly had some of the worst performance values getting worse comparatively as the data size increased. Particularly for the remove by index and remove by value operations. In theory it should have similar performance to the others so this is a bit confusing. Perhaps it is all the extra reference handling that makes it significantly slower. It’s no surprise that it isn’t faster than the other data types as the operations that work well are adding and removing at either end of the list. This means that the LinkedList data type is best suited to implement structures such as a stack or queue as that allows for dynamically sized structures that are relatively fast.

Vector and ArrayList showed some slight difference in performance but are for the most part pretty similar. This is in part because they use exactly the same underlying data storage mechanism. The only difference being that Vector is synchronized and therefore thread safe. The results from testing seem to indicate that the cost for acquiring the synchronization lock is a smaller factor the larger the data set you have. Even on smaller data sizes the difference wasn’t incredibly large. On a faster machine with a different JVM the difference between the two was even smaller, looking almost identical. So differences between these classes will largely depend on what kind of system you are running on, and will in most cases not be a huge difference. Again if the data size is small it doesn’t really matter which one you use.

Interestingly the Data type that did the best was the standard primitive array implementation. It was significantly faster than all the other data structures! The simple answer is that primitive arrays in java require fewer operations to manage when converted into machine code by the JVM compared to other methods of storage. In this case it is also faster for removal by index because the array did not worry about keeping items in order when removing an item. I simply moved the item at the end to occupy the space to be deleted and then decremented the size. This is a common practise for lists of items in games where the order in the array is not important.

Classes such as Vector, ArrayList and LinkedList preserve the order of items within them whether you require it or not. This carries an intrinsic cost when removing items, and at worst can be O(n) to remove an item. When order of the items isn’t a concern any item can be removed in constant time as I have done in this implementation of the primitive array.

So which data storage technique should you favour? There isn’t a simple answer to this question as it will depend on each particular problem. However it does seem that you will get the best results most often when you create a data structure tailored to your problem. In this particular instance a simple array was best. You can construct pretty much any type of data structure with a primitive array, so many different solutions can be implemented with better performance than the classes in the API. In my experience the Vector class is fine for most things and easy to use, but when I’ve required speed I often use a primitive array, or another type of data structure altogether such as a HashMap which is useful for creating a cache.

So why do the data store classes in the API exist in the first place? Simply put convenience and generality, when performance or data size are not going to cause problems it’s easier to use a pre-constructed class to store data in. The java storage classes are also implemented in a generic way so that they can be used for any purpose, this has a performance cost but you benefit by having data structures you can use for many different data types and situations. If you want some of that convenience and better performance, you could use the Trove library for data storage. Trove is faster than the java API but does not really have generality like the classes in the API. Check it out here.

16
Dec
12

Alley Cat for DOS

Alley Cat is another CGA game written for the original IBM PC. It was created by Synapse software apparently started by one employee and finished by Bill Williams. It was originally a game for the 8-bit Atari computers around at the time, released in 1983. Bill Williams then ported it to the PC where it became popular. In the game you play as a cat in an alley trying to dodge a dog and get into an apartment in order to get food and access to your lady cat friend.

The Title Screen

The Title Screen

The game has quite good CGA graphics, and some of the better PC speaker sound for the time. I found the graphics and sound to be quite good, even better than some later software for the PC. It is also interesting in that it runs ok on faster machines. Many games and programs of the time had poor timing code built into them, so would run extremely fast on newer 286 and 386 machine.

The game is challenging to play, but not so hard as to make it frustrating. It took me a while to get used to how jumping and moving worked and frequently got eaten by the dog that patrols the bottom of the screen. The aim of the first screen is to get into a window in the nearby building, once you have there is a mini game to complete. There are a variety of different mini-games all with different hazards. Most of them have a broomstick that chases you around and will knock you around or out the window. You can keep the broom busy by leaving a bunch of paw prints at the bottom of the screen. Once you’ve completed the mini-game you are taken back to the alley, where instead of an open window there is a female cat calling you. You have to get to her and complete a mini-game where you have to dodge an array of other cats to get to her at the top of the screen.

The game screen

The game screen

I’m still not very good at the game yet, so have not been able to play all the mini-games, and frequently get eaten by the dog. Despite it being hard, it isn’t because of poor controls. I used the normal keyboard controls, and found they were pretty good. The jumping mechanic takes a little time to get used to, but makes good sense. You can’t change direction mid jump like many platformers, and need to build up speed to jump a larger distance. There are joystick controls if you happen to have one, but I was unable to try these.

It’s easy to see why Alley Cat was one of the more popular early games for the IBM PC. It uses the graphics and sound of the machine well, and is a challenging game. If you happen to have an old machine, you should try this game out.

10
Dec
12

Bouncing Babies for DOS

Bouncing Babies

Bouncing Babies

Bouncing Babies is a CGA game written in 1984 for the original IBM PC by Dave Baskin. The game is basically a clone of an old school game and watch game called Fire made in 1980. There is a building on the left hand side of the screen which is on fire, and for some reason there are babies falling out that you must catch with your firemen. The only trouble is they bounce! You have to bounce the babies into the ambulance on the right hand side of the screen. You loose a life if you happen to miss one as babies falling from a height onto the pavement do not survive so well.

Being such an old game it was made with the oldest PCs in mind. That means CGA graphics and PC speaker sound. The graphics are simple but quite good for CGA. The sound is a simple noise for when each baby bounces, fortunately it’s not annoying and it’s a little reminiscent of the type of sound that would have come from the original game and watch games. If you plan to play this on anything more powerful than an 8086/88 you need to use a slow down utility as the game runs way too fast on anything faster. On dosbox a setting of around 250 cycles would be best, but adjust that to suit your play style.

Game play wise it is a pretty faithful clone of the original game, the only difference being there are babies falling instead of the generic humanoid shapes in the original. With all the babies falling down it makes me wonder what happened to the parents, and why there are so many babies! The game is good for a short burst of play and is challenging, but there are much better games for PCs of that era. As a game and watch game it would have been excellent for the time, and good for keeping kids busy on long car trips.

03
Dec
12

Wood Fruit for DOS

Title screen for Wood fruit

Title screen for Wood fruit

One of the first shareware games we got from a magazine was wood fruit which is a fruit machine simulator for the IBM PC. It was made by Stephen Wood the year of which is lost to the mists of time as I couldn’t find any information about the game around the internet. The game is shareware and as the author states in the readme file he only wanted 50p (UK pounds) to register the game, although I imagine he is no longer available at the details provided.

Initial state

Initial state

The game runs on EGA with PC speaker for sound with no support for anything else. The graphics are reasonable and colourful, everything is easily identified. Sound is pretty basic and not bad as far as PC speaker goes. Given that the game was written entirely by one guy, he has done a pretty good job of creating graphics and sound for the game.

Game play is pretty simple yet some how compelling. Much like the real machines it is easy to invest half an hour to an hour, fortunately with out the financial consequences! There are many different ways of winning, and many mini-games that control how much you get.

After playing a while

After playing a while

Wood fruit is simple and fun, if you can manage to find it give it a try. It does rely on the speed of the processor it’s running on so I’d recommend that you use something like dosbox so you can adjust the number of cycles to make the mini-games a bit more playable. It works on most old hardware, but I wouldn’t use anything faster than a 386, the main requirement being the machine should have a EGA card (a VGA card also works).

 




Enter your email address to follow this blog and receive notifications of new posts by email.


Mister G Kids

A daily comic about real stuff little kids say in school. By Matt Gajdoš

Random Battles: my life long level grind

completing every RPG, ever.

Gough's Tech Zone

Reversing the mindless enslavement of humans by technology.

Retrocosm's Vintage Computing, Tech & Scale RC Blog

Random mutterings on retro computing, old technology, some new, plus radio controlled scale modelling.

ancientelectronics

retro computing and gaming plus a little more

Retrocomputing with 90's SPARC

21st-Century computing, the hard way