eRepublik on up to 64kbps

Day 2,232, 00:44 Published in Romania Romania by Nicolae Crefelean
Versiunea în limba română este sub cea în engleză.

And I thought the headless chicken was the worst that could happen... WOW! I'm on vacation and I only have a mobile data connection running at (up to, actually) 64 kbps (8 KB/s), which for some people would be enough reason for suicide.

The good thing: there was a time in my life when a 56 kbps modem was something normal and I lived with it for a few years, so now I just had to set my patience level to a different scale, the old one.

The awful thing: using todays' internet through such connections is not quite normal, especially with modern web applications, but that's why some developers really work hard to trim down and optimize as much as possible so their web apps can scale to as many users as possible, and to serve them as fast as possible so they can serve many others with the same limited resources. I wish this was the case for the eRepublik developers, but it's not.

Obviously, an internet geek's dream is to use websites with little to no crap at all. By crap I mean absolutely useless stuff in the web pages. Take this for example:

var company_create_same_industry_error = "You cannot own two companies in the same industry.";

It doesn't look to me as a feature from a future development of the game, but rather an artifact of a really old version. So I Googled it and found out that the string became invalid since day 1050, when eRepublik finally allowed the managers to work in all their factories.

A developer knows why this has further and worse implications. By simply having such an old string in the HTML, it means that the server-side (back-end) scripting language doesn't even check basic conditions to be met for such messages to end up in the browsers. Guess what! I was viewing the source code of the battlefield page. How's that for embarrassing?

Of course there's even more than the following:
var citizen_profile_show_all_skills = "show all skills";
var company_change_owner_confirm = "Are you sure you want to renounce at this company and give it to %%1%%?";
var upgrade_town_hall_url = 'http://www.erepublik.com/en/main/upgrade-town-hall'

At least does it bring good old memories? 😛

Oh, did you know the snow flake script alone takes 10KB to load regardless if you disable or enable it? It even has the raw change/development log, the „readme” information and the whole code is not minified. Why bother? Man... it makes your head spin.

Now how many remeber the eRepublik announcements on this background?


It's been a reaaaaly long time since I saw it. At least I remember seeing it at some point, but in my very early days here. The eRepublik CSS still has it's definition tucked in there, just like other artifacts that would only bloat my article if I wasted my time to find and put them in here, then I'd waste your time for having to read or scroll down.

So the JavaScript is bloated. The HTML and PHP are inherently bloated, the CSS is also bloated and... what's left? Oh, the database. That's bloated as well. I'm pretty much sure most of you know how the achievements are announced on the friends feed. Whatever the language the user has set for his eRepublik session, the achievements will be displayed in that language. Now there are two possibilities here. Either the developers chose to store the user's session language in the achievements table so they can display it to everyone in that language (not useful considering we don't know so many languages) or – and I bet this is the case – they stored the full message in the database instead of making good use of localization and properly/decently organize the database and the PHP code – something even a beginner should know how to do it.

The „dark side” of all these findings is there's just too much useless crap in the eRepublik code, that makes the user experience crappier, it's harder to maintain on the server side, not to mention that it's actually more expensive for eRep Labs to contract higher-grade hosting services to accustom their players and customers. Remember the extra 10KB of „snow” per user? The server should be able to handle 10MB per second for 1000 simultaneous users - only for those flakes. And the game's full source code is much, much bigger. That's why the admins made CDN's, so we can actually play without generating bottlenecks on a single host. CDN's are great, but to use them to cover for such sloppy code management... it's just sad. If I said it was pathetic I'd be in danger for another Forfeit Point, so I won't say it. For how much money the users have spent on this game, this article should've never existed nor anyone would've had to think about writing it.

Now the bright side of all these facts is most of this crap can be taken out after a serious code audit, but an audit that doesn't require special effort, nor highly specialized developers, because most of the old and useless crap can safely be removed, completely. Only the achievements require some extra coding, but even that's sufficiently easy to be fixed. The end result? A better game without much effort, nor extra budgets for high-class coding.

Oh, the irony! While I was going to my newspaper to copy/paste my article the headless chicken stopped by to say hello. I had to wait for it to go to sleep, so I can publish this. Then I went to sleep myself as a sign of protest. 😛



Oh, my God! Who made me look at the headless chicken's page source code? It's 70.2 KB of text for two images and the message below:

Occasionally there are a couple of things which we need to check or to implement in order make your experience in eRepublik more pleasant. Don't worry about ongoing battles, timer will be stopped during maintenance.
Meanwhile, you can learn something from the eRepublik Wiki.

Follow eRepublik on Twitter or Facebook to get informed once maintenance is over.


Now I can only wonder why do I have to wait for about 9 seconds for a truck-load of useless CSS to load just so I can see the annoying chicken. For 1000 simultaneous users, this is 70.2 MB of data per second. Neat! And what else did I find in the source code? Of course, the well-known timer that tells us „Maintenance. We'll be back in ...” - which shouldn't be there. And there's an extra useless call to json-time.appspot.com for the timer. Dear developers, here's a freebie on me:

if ($timed_maintanance) {
echo „We'll be back in ...”
} else {
echo „Occasionaly we must fix our mess.”
}

Please show some common sense in development. It's not about my issues with the code but the whole user experience on a rather large online community. It's your, it's ours, but only you can fix it.


eRepublik on up to 64kbps: http://www.erepublik.com/en/article/2357653

Versiunea în limba română:

Şi eu, care credeam că găina fără cap e cel mai rău lucru care se putea întâmpla... WOW! Sunt în vacanţă şi am doar o conexiune mobilă de date, care merge cu (până la, de fapt) 64 kbps (8 KB/s), ceea ce pentru unii e suficient să se sinucidă.

Partea bună: a fost o vreme în viaţa mea, în care un modem de 56 kbps era ceva normal şi am trăiat cu el câţiva ani buni, aşa că acum doar a trebuit să-mi setez nivelul răbdării pe o scară diferită - cea veche.

Partea groaznică: folosirea internetului contemporan prin astfel de conexiuni nu-i tocmai normală, mai ales în cazul aplicaţiilor web moderne, dar de-asta unii dezvoltatori muncesc din greu să reducă tot ce pot şi să optimizeze cât de mult posibil, astfel ca aplicaţiile lor web să scaleze la cât mai mulţi utilizatori cu putinţă şi să-i deservească cât mai repede, ca să-i poată servi pe mulţi alţii cu aceleaşi resurse, limitate. Îmi doresc să fi fost şi cazul dezvoltatorilor eRepublik, însă nu-i.

Evident că visul unui pasionat de internet este să folosească saituri cu cât mai puţine mizerii sau chiar deloc. Prin mizerii mă refer la chestii absolut inutile în paginile web. De exemplu:

var company_create_same_industry_error = "Nu puteţi crea două companii în aceeaşi industrie.";

Asta nu pare a fi ceva din viitorul jocului, ci mai degrabă un artefact dintr-o versiune foarte veche. Am căutat pe Google şi am găsit poza asta din ziua 1147:


Un dezvoltator ştie de ce asta are şi implicaţii, ba chiar mai rău. Pur şi simplu având un text atât de vechi în sursa HTML înseamnă că limbajul de scripting de pe server (back-end) nu conţine nici măcar nişte condiţii de bază ca astfel de mesaje să nu mai ajungă în navigator. Ghici! De fapt mă uitam la codul sursă al paginii câmpului de luptă. Cât poate fi de jenant?

Sigur că există şi mai mult decât următoarele:
var citizen_profile_show_all_skills = "arată toate skill-urile";
var company_change_owner_confirm = "Sigur doriţi să renunţaţi la această companie şi s-o cedaţi lui %%1%%?";
var upgrade_town_hall_url = 'http://www.erepublik.com/en/main/upgrade-town-hall'

Măcar vă trezeşte amintiri plăcute? 😛

A, ştiaţi că doar scriptul cu ninsoarea cere 10KB pentru încărcare indiferent dacă îl activaţi sau dezactivaţi? Ba chiar conţine, intact, jurnalul de modificări/dezvoltare, informaţiile de configurare, iar codul nici măcar nu este redus la minim (minificat). De ce ne-am deranja? Pfuu... ţi se învârte capul, nu alta.

Câţi dintre voi vă mai amintiţi anunţurile eRepublik pe fundalul ăsta?


De foaaarte mult timp nu l-am mai văzut. Cel puţin ţin minte că l-am văzut la un moment dat, cândva, doar că în zilele mele timpurii pe-aici. Codul CSS eRepublik încă are definiţia acelei imagini (clase, de fapt) înfiptă la grămadă cu alte artefacte care doar mi-ar umfla articolul dacă mi-aş pierde vremea să le găsesc şi să le pun pe toate aici, apoi v-aş pierde vouă vremea punându-vă să citiţi sau să derulaţi în jos.

Deci codul JavaScript e umflat. Codul HTML şi PHP sunt inevitabil umflate, CSS-ul este de asemenea umflat şi... ce-a rămas? A, baza de date. Şi-asta-i umflată. Sunt destul de sigur că majoritatea dintre voi ştiţi cum sunt anunţate realizările pe feed-ul prietenilor. Indiferent care-i limba folosită de acel utilizator în sesiunea lui/ei eRepublik, realizarea va fi afişată în acea limbă. Aici există două posibilităţi. Fie dezvoltatorii au ales să stocheze în baza de date limba folosită de utilizator în tabela de realizări, ca să le poată afişa tuturor în acea limbă (inutil din moment ce nu cunoaştem atâtea limbi) sau – şi fac pariu că ăsta-i cazul – au stocat integral mesajele astea în baza de date în loc să folosească corespunzător localizarea şi să organizeze corect/decent baza de date şi codul PHP – lucru pe care chiar şi un începător ar trebui să-l ştie.

„Latura întunecată” a acestor descoperiri este aceea că e prea multă mizerie în codul eRepublik, lucru care face experienţa de utilizare mai naşpa, e mai greu să întreţii serverul, ca să nu spun că de fapt e mai scump pentru eRep Labs să plătească contracte de găzduire de nivel mai mare ca să-şi poată deservi jucătorii şi clienţii. Vă amintiţi de cei 10KB de „zăpadă” per utilizator? Serverul ar trebui să reziste la 10MB pe secundă pentru 1000 de utilizatori simultan – doar pentru acei fulgi. Iar codul sursă al jocului e mult, mult mai mare. De-asta administratorii au creat CND-uri, ca să ne putem noi juca fără să sufocăm un singur server. CDN-urile sunt super, dar să le foloseşti ca să acoperi un management al codului atât de prost... e pur şi simplu trist. Dacă aş fi spus patetic aş fi fost în pericol să mai iau un punct de penalizare, aşa că n-o s-o spun. La câţi bani au băgat utilizatorii în jocul ăsta, articolul de faţă n-ar fi trebuit să existe vreodată sau nimeni n-ar fi să se gândească măcar să-l scrie.

Partea bună în toate cele de mai sus e că mizeriile astea se pot elimia după un audit serios al codului, însă un audit care nu necesită un efort special sau dezvoltatori foarte specializaţi pentru că majoritatea mizeriilor vechi şi inutile pot fi înlăturate în siguranţă, complet. Doar realizările au nevoie de puţină programare, însă şi asta e suficient de uşor de reparat. Rezultatul? Un joc mai bun fără un efort masiv sau bugete suplimentare pentru programare de înaltă clasă.

Ah, ironia! În timp că mă îndreptam către ziarul meu pentru un copy/paste la articol, găina fără cap s-a oprit să mă salute. A trebuit să aştept să plece la somn ca să public asta, dar în semn de protest m-am dus eu la somn. 😛



Doamne fereşte! Cine m-a pus să mă uit la codul sursă al paginii găinii decapitate? Are 70,2 KB de text pentru două imagini şi mesajul de mai jos:

Occasionally there are a couple of things which we need to check or to implement in order make your experience in eRepublik more pleasant. Don't worry about ongoing battles, timer will be stopped during maintenance.
Meanwhile, you can learn something from the eRepublik Wiki.

Follow eRepublik on Twitter or Facebook to get informed once maintenance is over.


Acuma... pot doar să mă întreb de ce trebuie să aştept cam 9 secunde să se încarce o căruţă de CSS inutil doar ca să văd găina aia enervantă. Pentru 1000 de utilizatori simultan asta înseamnă 70,2 MB de date pe secundă. Super! Şi ce-am mai găsit în codul sursă? Desigur, binecunoscutul cronometru care ne spune „Întreţinere. Vom reveni în ...” - ceea ce n-ar fi trebuit să fie acolo. Plus că mai e un apel inutil către json-time.appspot.com pentru acel cronometru. Dragi dezvoltatori, iaca o gratuitate din partea mea:

if ($timed_maintanance) {
echo „Vom reveni în ...”
} else {
echo „Din când în când e musai să ne reparăm mizeriile.”
}

Vă rog daţi dovadă de bun simţ în dezvoltare. N-are nicio legătură cu problemele mele cu codul, ci cu întreaga experienţă de utilizare într-o comunitate online destul de mare. E a voastră, e a noastră, însă doar voi o puteţi repara.


eRepublik pe (până la) 64kbps: http://www.erepublik.com/en/article/2357653