PHP, Zend Framework and Other Crazy Stuff
Archive for February 27, 2006
Template-Lite
Feb 27th
Sort of linked to my last entry, the guys over at Smarty have stirred something up of a hornet’s nest with their trademarking of the “Smarty” name. As an open source project its fine for them to do so, but of course we free loading lovers don’t like the thought. More relevantly the developer of Smarty-Lite was recently forced as a result to stop using the term “Smarty” in their library.
One day I’m going to find a trademark database and figure out how a common use phrase evaded trademarking before now… I could have sworn it was a registered trademark at the very least in the US and for a non-related company. One assumes the Smarty copyright holders did perform a database search.
Anyways, in one of those obscure lengthy possibly illegible blog posts (just kidding), Panama Jack got around to posting a link to the Smarty-Lite followup renamed Template-Lite that he will be developing. The Template-Lite website announces the release of version 1.0.0 since February 17th. Really someone should have blogged this earlier! Main point is it uses around half the memory of Smarty and operates faster as a result.
I haven’t tested it myself, just got curious and poked around in the code. A few items of note. It’s a put together very well, so little wonder its using less memory – most of the Smarty bloat has been excised. I did note it was missing the “assign_by_ref()” method, and escapes using htmlspecialchars() – not htmlentities(‘string’, ENT_QUOTES, ‘UTF-8′) as is best practice (charset being variable obviously).
The first is likely an easy addition – would be a good one too since I do a spot of referencing in my View layer for QSE, and developers with dangerously large arrays don’t like copying them all over the place. I don’t use Smarty’s escaping mechanism so it doesn’t bother me – template designers however will. Not entirely certain what Smarty does for escaping…
I think I’ll try this out over the next few days and figure out how much memory it actually saves me.
An aside:
Just on the Smarty trademark notices and copyrights in general. Whoever wrote that crap should buy an English dictionary and look up the the term “clarity” before touching a keyboard again. Most of the terms are vague and one talks about limiting permissions covered by Fair Use (it reads that way at least). Whole page stinks of corporate bluster. I think I see what may irk people…
What in God’s name does this mean? Have I broken copyright law by opening their homepage? Is the public banned from viewing graphical and layout elements? C’mon guys, at least hire a lawyer to write this stuff.
The rights specified above to view, download and print the documents and information available on this Site are not applicable to the graphical elements, design or layout of this Site.
Go hop, I own a printer and you let me download your pages. Bleh.
ADOdb Lite
Feb 27th
Last September I decided to make a switch from the ADOdb Database Abstraction library to a smaller more memory efficient alternative. Of course, I’m talking about ADOdb-Lite created by Panama Jack (the guy in charge of Alien Assault Trader’s development). Making the switch was not done lightly. ADOdb is an extremely popular abstraction package with a lot of solid support and features. On the switch side it hogs memory. ADOdb-Lite‘s claims to reduce the memory usage substantially while still offering a similar (though reduced) feature set was very attractive.
The switchover overall has been worthwhile. Its worth noting that at the time ADOdb-Lite was a very new library so it took some time to settle down into a stable form. Since that time I’ve reported two bugs and requested one function change, and seen other issues like the unexpected return of full arrays not associated arrays (no numeral keys) a few versions back resolved.
Some ADOdb features are yet missing. There are no Caching functions, which removes the possibility of caching results to file. Now PanamaJack justifies this by noting in-memory caching features of MySQL – incidentally Postgres has something similar. Lets talk DBMS’s in general before justifying everything with MySQL. I rarely even use MySQL. But at the moment its not a concern for me – to be honest the library is open source, so if I do need it I’ll hack it in there with the nifty module system.
Also missing is the Performance Monitor offered by ADOdb. Again this is one of those extra rarely used features. It is quite useful, but I’m not certain how in-depth this was originally integrated into ADOdb. This doesn’t particularly bother me since I use ADOdb-Lite as the abstraction layer in a Data Access object – I can fit in a perfmon clone without touching the ADOdb-Lite source code. Of course it’s pointless at the moment given a DAO does not necessitate optimised SQL. Unfortunately its a complex item to add to a clearly defined DAO-TransferObject or ActiveRecord setup without turning the DAO into a collection of transaction scripts…
Another small niggle in the system are the potential typo-style errors. ADOdb-Lite was either developed on a plain text editor, or a non error reporting IDE. Eclipse still complains a lot about ADOdb-Lite having notice level errors, and in earlier versions potential parse errors. Small niggle, I have a preference for IDE quality assurance as a first line error pickup mechanism. The library does ship with tests, which although not Unit Tests do a fair job of exercising the Library. They’re imperfect however for a full test suite – they can’t cover all DBMS’s supported at one session. Hardly the developer’s fault – it’s just the nature of an abstraction library.
Overall ADOdb-Lite is definitely worth a look at. It does a fantastic job of reducing memory usage, enough that it makes up a substantial percentage of QSE’s memory use reduction over QS2. It’s matured over the last half year to a stable dependable library. It lacks some features of ADOdb, but these tend to be small-use features most developers wouldn’t even touch. Of course that may be a bitter pill for some developers to swallow. A good trend is a steady pickup of ADOdb-Lite – I’ve seen a few projects make the conversion recently.
In summary, if you’re expecting to develop an application for public consumption in enviroments that may include non-accelerator enabled shared hosts then ADOdb-Lite is a solid alternative to ADOdb. It’s still maturing, and has some small issues but for most common use-cases it’s worth looking at.
QS Evolved Screenshots!
Feb 27th
After putting in a lot of hours on Quantum Star SE Evolved this weekend I have moved onwards from my earlier 0.18 test release. That was aimed at exercising the Partholan backend to find any last obvious bugs. This weekend I finally got into the meat and bones of the game. I started with a diversion into the Installer which had a few issues in 0.18 (most annoying was the lack of a proper theme for it!). I’ve updated and added back the Install theme however and the results are quite satisfying. I’ve added a few screenshots to this post to show it off.
The opening Installer page.
The Installer is an attempt to simplify the often horrible level of detail some PHP applications will require. Most of the in-depth options are hidden and can be changed from their defaults later from the Administration Control Panel. In most cases they won’t need adjusting. A lot of the messy items from Solar Empire and QS2 have been removed. QSE automatically figures out the URL and full system path with little trouble. Database choices are down to a minimum with any specialised requirements managed fluidly by the backend. There’s been an effort to simplify the number of directories requiring permission changes (just Data and TplCache).
Now on the game side I’ve upped the ante and created a simplified CSS based theme called BlueSpace. It’s layout is flexible and completely CSS driven. Tables are being used only to support our form layouts and even that can potentially be replaced with a CSS style when I spend the time needed.
The temporary Admin CP page using the BlueSpace theme.
The theme is pure CSS. I spent time wondering how to manage theming and making it as flexible as possible, but in the end the usual lack of theme making on open source games decided the issue. Themes are now nothing more than customised headers, footers and CSS – that in itself adds most of the flexibility needed. The templates themselves are fixed XHTML though obviously you can alter these on a private server – I’ll note this means text is not changeable if you decided to upgrade directly from the standard QSE development releases without text diffs. This by effect decided how to manage translations. My translations approach is going to be to pre-generate translated versions of the base “tpl-en” English templates into separate Template directories; tpl-fr, tpl-cz tpl-fr-CA, etc. In effect I want to remove the need to translate on-the-fly at runtime anything except Game Module content. So lets just translate and store the templates as semi-independent entities, allowing perhaps some minimal CSS adjusting for things like text direction. The approach makes possible a more manageable translation effort matching full English sentences to translations – not the flawed key phrase matching that is very hard to get right.
Anyway to round out this post, the game is moving ahead steadily now that Partholan is feature frozen. I’m currently playing about with the Administration Control Panel to add the most necessary functions such as the Game Creator, Game Manager, and the updated Universe Generator. I have to admit feeling some growing pride with QSE. It’s hard to get that from working on a technical blunder like the original QS2. Evolved is waaaay better
. I’m having fun working on it at least…
Another BlueSpace view – the Create Game form view.
Can’t wait to get a starting Star System view finished so I can start adding in all the funky fun stuff like Fleet navigation and Homeworlds. Looks like yet another more complete release by week’s end! ![]()
