BingoGems.co.uk Menu
2009
Nov
25

Object Pooling

Categories: Bingo Game Server

The game server now supports object pooling. There were 3 objects that have been modified to support it. Supposedly, this is a good optimization technique since there are less object creations and deletions going on. In the old days of my Java programming, this has actually been very useful, especially since server RAM was still very limited then.

However, there are now debates as to whether object pooling is still beneficial in Java these days. They say the newer JDK has much improved garbage collection, so object pooling actually slows things down in some instances. It looks like the use of object pooling is now advised mainly for objects that maintain external resources (e.g. threads or database connections).

On BC and TTG, I remember I was using 2 threads per connecting player, and then a database connection is created as needed. It wasn’t until TTG when pooling has been given a more serious look. On HB, a minimal thread and database approach has been implemented from the beginning. And now on BingoGems, it has been a complete redesign again. Only 2 main threads are running, there are also only 2 live database connections, and multiple game rooms can be running on a single game server instance.

This has been possible because of advancements in the Java language itself, and of course taking into account the many things I have learned from experience developing these kinds of things. So now, it looks like I don’t need to do object pooling at all. However, the only way to find out is to do some actual profiling, but I don’t think this is necessary at this point.

Anyway, in the meantime, I have disabled this feature. The good thing is, it’s something I can easily enable in the future, should the need arise. I did leave out the part of manually calling the garbage collector, so that clean-ups can be done at a more appropriate time.

Tags: ,

2009
Oct
18

Flash Game Components Finalized

Categories: Flash Bingo Games

The intermission component, which used to be a separate file, is now included in the individual game files. Likewise, login component is now included within the chat component. These merging have been necessary to bring down the overall download size (about 50KB per game), since loading of a shared component library can not be reliably monitored.

This will be the final game structure already, so the game loader basically just loads 2 components per game. Total file sizes are still smaller compared to HB, even if the games now support more features. Excluding sounds, each game will be less than 150KB in size in total (with chat), which I think is still very compact.

Other minor changes: 90-Ball bingo is now showing card set #, and card #s are within the set only. This is a bit different than the other bingo games because in 90-ball bingo, sorting of cards is based on sets and not on individual cards. I also made display changes for player points and XP, to minimize crowding of overall text being displayed.

Tags:

2009
Oct
14

Game Font, Flash Shared Library Changes

Categories: Flash Bingo Games

I’ve just changed the font being used in the Flash games. Previously, I was usingĀ  a combined set from 2 different fonts. Letters are narrow so it allows more text to be displayed (useful in the chat area). However, I noticed that it is not as legible as I originally thought.

So I searched for a new font, and settled for something that has wider letters and resizes better. Downside is, this results to lesser text that can fit in the chat area, but I believe this is a good compromise in exchange for more legible game texts overall.

This single change required all game objects to be updated (size and alignment revisions). So I took this chance to update the Flash shared library approach as well. I was initially using Flash’s built-in run-time library support, but I am still unable to find a reliable way to pre-load and cache shared library files, so I have to get rid of the concept for now.

This involves 2 steps. Step 1 is to changed all shared objects so they are no longer published as separate files (this is now 100% completed). Step 2 is to combine some current game elements together to minimize file size bloat (this still needs to be done).

Other minor game changes that I made along the way:

  • Added pop-up help text for Jackpot descriptions in all games
  • Common functions for pop-up help messages (so that colors can be changed in 1 location)
  • “Good enough” solution to a pending issue when changing 6/12 cards view during purchase time before the game starts (some cards are dimmed, some are not)

Tags:

Search Blog