46 coaches online • Server time: 00:53
* * * Did you know? 189 games were played yesterday.
Log in
Recent Forum Topics goto Post Grotty Little Tourna...goto Post The Light and The Da...goto Post TournyS(3!):Slaughte...
Christer
Online
Khemri Tomb Kings
Star
Khemri Tomb Kings
Record
59/24/37
Win Percentage
59%
Shambling Undead
Super Star
Shambling Undead
Record
51/5/10
Win Percentage
81%
Overall
[R]
Star
Overall
Record
229/56/79
Win Percentage
71%
Archive

2019

2019-04-14 23:33:08
rating 6
2019-04-07 16:59:39
rating 6
2019-04-07 00:55:26
rating 6
2019-01-08 15:27:38
rating 5.9
2019-01-05 02:58:18
rating 5.8

2018

2018-08-17 17:28:31
rating 6
2018-08-15 00:05:40
rating 6
2018-07-17 20:17:40
rating 6
2018-06-28 14:28:08
rating 5.9
2018-05-23 17:55:10
rating 6
2018-05-10 22:42:46
rating 6
2018-05-09 19:42:28
rating 6
2018-04-30 10:44:23
rating 5.8
2018-04-23 12:33:02
rating 5.8

2017

2017-04-23 18:06:35
rating 6
2017-04-06 23:00:56
rating 6
2017-04-03 19:06:00
rating 6
2017-03-29 22:35:46
rating 6
2017-03-25 16:18:39
rating 6
2017-03-11 21:24:26
rating 6
2017-02-14 14:23:58
rating 6
2017-02-10 14:54:03
rating 6

2016

2016-11-30 00:04:21
rating 6
2016-11-27 23:40:04
rating 6
2016-11-17 18:18:07
rating 6

2015

2015-09-06 23:59:26
rating 6
2015-01-24 15:56:29
rating 6
2015-01-22 13:10:32
rating 6
2015-01-19 21:20:53
rating 6
2015-01-10 19:03:45
rating 6

2014

2014-09-09 15:35:53
rating 6

2013

2013-04-26 11:48:40
rating 5.7

2012

2012-12-18 17:37:29
rating 5.9
2012-11-18 18:19:19
rating 6
2012-09-25 13:47:16
rating 5.6
2012-08-15 12:31:53
rating 5.9
2012-08-10 23:12:22
rating 5.9
2012-06-27 22:53:48
rating 5.9
2012-04-10 11:56:38
rating 5.9
2012-03-07 13:52:00
rating 5.9
2012-02-16 16:59:56
rating 5.9
2012-02-04 19:00:41
rating 5.3

2011

2011-07-25 23:32:43
rating 5.6
2011-05-23 13:12:52
rating 5.6
2011-02-04 14:26:18
rating 5.4

2010

2010-03-26 11:38:41
rating 5.1
2010-03-01 12:16:53
rating 5.6

2009

2009-12-08 16:40:30
rating 5.8

2008

2008-09-11 14:47:19
rating 4.1
2008-02-26 21:16:54
rating 5.3
2008-01-21 01:01:58
rating 5.6

2007

2007-11-06 21:23:14
rating 5.1
2007-10-16 00:26:11
rating 5.4
2007-09-30 17:10:03
rating 5.4
2007-09-30 12:01:42
rating 5.3
2007-08-09 12:14:57
rating 4.5
2007-08-06 12:02:52
rating 4.9
2007-08-03 17:56:21
rating 5.4
2012-04-10 11:56:38
37 votes, rating 5.9
New LFG system progress report
Over the easter weekend, I finally managed to get some more progress on the new LFG system I posted about recently. You can find a reasonably up to date state of it at:

https://fumbbl.com/p/lfg2

Yes, there are bugs. The most notable one is that clicking on the checkbox for a team doesn't do much at all (it actually processes the click twice). Instead, you can click on the team row itself and it should toggle properly. You'll also note that the table is not properly themed yet (no rounded corners, no drop shadow).

The reason that this is a blog and not an announcement is because I wanted to let you guys know a bit what's going on under the hood of that page, because it's pretty interesting technology.

The page is built using a number of application layers:

1. PHP page generator. This is the code that generates the page itself (theme, and the table wrapper). It's effectively an empty table and the controls at the bottom. This part is fairly straight-forward and doesn't really need much description. There's not much logic here at all.

2. Javascript. Those of you who are technical minded can view the javascript through your browsers. As with a lot of the javascript added to the site lately, the code heavily depends on the jQuery framework. jQuery simplifies things immensly for me as the developer, and adds lots of neat features. If you're a developer yourself, you'll notice that it's very imperative in nature and uses globally defined functions. Not very portable design, but I know very well what context it runs in so I didn't want to bother with the added complexity of isolating it more :). As you may notice, the code includes a lot of AJAX calls, which takes us to the next layer.

3. PHP proxy / facade. This code is what the Javascript calls to fetch data. It's fairly simple in nature, because its main purpose is to forward the request from the PHP engine to a Glassfish server (Java EE - Enterprise Edition) that's also running in the server park.

4. Java. This is a back-end server I've mentioned in an earlier blog. This is where the XMLs needed by the javascript front-end are generated. This is built on a pretty extensive framework I've designed to abstract the physical data model (ie, the data in the MySQL database). The framework handles caching of objects and allows mutual exclusion which PHP simply can't provide in a stable fashion.

The way the Java framework is implemented, I can do things like (a bit simplified):

Team team = Team.load(teamId); // Fetches a cached team instance, or loads it from the database
int treasury = (Integer) team.get(Team.TREASURY); // Fetch the team's treasury
team.set(Team.TREASURY, treasury + 10000); // Add 10k gold to the team

The set() method call doesn't actually persist the new treasury immediately, but instead marks the team as "dirty" (a concept that is common with caches) and schedules it for storing. In the framework, there's an asynchronous thread running which processes dirty objects and stores the updates to the database.

The major benefit of this approach is that I can push many changes to an object and only generate a single SQL update call. This results in a higher potential performance, and improves latency significantly. The cost of this approach is a risk of losing some non-persisted changes in case of failures, and that there's a second or two of lag between a change being pushed to it appearing in the database itself (this delay is not affecting end-users in any way).

Now, all this is well and good, but it also creates a bit of a problem. Most of the site is written directly in PHP, where the PHP reads information from the database directly. The problem appears when the PHP code updates an object that exists in the Java cache. Effectively, this means that the cached object will contain old information and the data from the Java layer will be out of date. This is visible in the new LFG page in its current state if you have a team that's not ready to play, load the LFG page (forcing your teams into the cache), ready your team and reload. The Java layer will still think that your team is not ready because the information is cached. Tricky.

There are a couple of possible approaches to getting around this issue:

1. Move all modifications into the Java layer. This is a massive project, and something I've been toying with the thought of. However, in the short term it's not feasible to do this.

2. Modify the Java framework to allow for certain "volatile" columns, which are always loaded from the database. This would most likely result in all data being volatile and therefore the caching would not be useful anymore. Not a very likely path.

3. Create an API in the Java engine that allows the PHP layer to flush individual objects out of the cache. This would allow me to notify the Java layer that an object needs to be reloaded because of a change. Most likely, this is what I'll end up doing because it's fairly simple to do and has a nice feel to it from a design perspective.


Finally, I have some venting I need to do:

* Checkboxes are annoying. If you look carefully at the "Select All" checkbox on that page, it's acting as a tri-state checkbox. It functions much like you'd expect, making it select all rows if there's at least one row that is not checked, and deselicting it if it's not. This is implemented pretty crudely in the current Javascript code, and I really need to redesign this into a more reusable fashion. I have a feeling I might want to use a similar control elsewhere (PM system for example).

* Dynamic vertical size with automatic scrollbars. Yeah, I don't think this is possible in CSS at all. I ended up with a javascript method that resizes the dialog as appropriate. I'm happy with the end result (try resizing your window when looking at that page assuming you have a fair number of teams and a screen that's large enough).

* People are using way too small screens. I linked this page on the IRC chat and instantly got complaints on how the rows are too large and the fonts are too big. I may end up having to implement a control that resizes the view for those of you who feel it's too big. The system was designed to be much larger than what you're used to in order to keep it simple. There are a lot of pages on the site which are very dense on information, which makes it complex and harder to learn. My intent with the new LFG system is to make it as easy as possible for the end user.


This turned out to be much longer than I thought. Thank you for your time!
Rate this entry
Comments
Posted by pizzamogul on 2012-04-10 12:25:08
Even the inner workings of the new LFG system are transparent. Long live FISHBOWL!
Posted by Chainsaw on 2012-04-10 12:33:08
Looks good! But I can't click on the check boxes. I'm sure you're aware of this though I'll mention it Just In Case.
Posted by Christer on 2012-04-10 12:38:46
Chainsaw..

"Yes, there are bugs. The most notable one is that clicking on the checkbox for a team doesn't do much at all (it actually processes the click twice)."

Third paragraph (if you count the link as the second paragraph).

If you lost me that early, there's not much hope for you... :)
Posted by Overhamsteren on 2012-04-10 12:40:00
This update was really nerdy and made me feel stupid :P

The link took me to a page with 'Look for games with' and then a big white box with no teams, in the bottom 'select all' and 'Look for games' buttons with no response.

I am using Firefox 11.0
Posted by zakatan on 2012-04-10 12:41:04
using Chrome here, and I only get a large white box that says "Look for games with". No teams are shown or anything.
Posted by Christer on 2012-04-10 12:46:33
Ah right.

You need to hold your shift key and press the reload button on your browser (this forces the browser to skip the cache).
Posted by Niebling on 2012-04-10 12:59:28
GREAT!!!

I can see I have to go make a [R] team soon :)
Posted by DonTomaso on 2012-04-10 13:16:16
Nope, that shift-trick doesn't work on IE...

Posted by Christer on 2012-04-10 13:30:37
Browser compatibility is something I sort out later in the development process. Internet Explorer, in particular, is often messing things up and if you want to see development pages in action, Firefox is usually the best choice of a browser. Chrome has a tendency to work fairly well, as does Safari.

I'm aware that Internet Explorer 7, at least, renders the page horribly bad and this is not something I intend to fix. For IE, FUMBBL supports version 8 or later (I'd require IE9, but that would deprecate Windows XP entirely, something I won't do at least until official Win XP support is dropped by Microsoft), so make sure you're up to date.

I'll end up testing on IE8, IE9 and possibly IE10 (under the Windows 8 consumer preview) once I'm a bit further into the development.
Posted by Overhamsteren on 2012-04-10 13:41:18
Ah that helped, looks good :)
Posted by maysrill on 2012-04-10 14:19:36
Keep in mind that for every person using two 22" monitors, you've got someone saying in IRC that they can't see the bottom of the screen on their netbook, so can't use in-game chat.

I can scroll a bit, or make my window larger, or even increase my resolution (I don't use anything close to max res. on my desktop, it makes too many system things painfully tiny). Not everyone has such nice options.

I love the fact that the click-on-team thing is going in as an alternative to the check boxes. If that works, would it make sense to eliminate all the checkboxes (except perhaps the "select all" box)? I think anyone who gets confused will figure it out quick enough, and after that it's very simple. Makes for a very clean interface, as well.
Posted by pythrr on 2012-04-10 14:36:35
yeah

fishbowl rocks
Posted by Skolopender on 2012-04-10 21:01:11
FishBowl!
FishBowl!
FishBowels!
FishBowl!
Posted by Christer on 2012-04-11 00:17:02
It should work properly in IE8 now as well. Plus, the checkboxes function as expected.
Posted by Niebling on 2012-04-16 21:57:33
Looking at it with my iPhone and it looks great :)

Does it ever stop searching ? :)