Is a matter of fact that a good API design matters. Everybody knows this issue, but really are the principles of good design applied in companies? Well, it depends but in general it is difficult, sometimes due to deadlines and the thinking on a rapid results more than to spend time on design robust systems.
I think that software engineering is essential, a minimal UML diagram used to discuss some aspects of architecture sometimes help us to design a good API, because this is only a contract between creators and users (another developers), and at least we need to meet them all together. There are a lot of developers who think that UML is lost time. Some managers think it too. And then the problems arrive in a few weeks or months, usually as bugs, maintenance or growth difficulties.
With a simple whiteboard, a meeting place, a team leader and a little bit time, we can design very good systems. A leader or a project manager needs more than one brain, and it is often forgotten. It's good for manager, developers and the entire company, but always there are people who don't see it. API aren't easy to design, but once you've got it, give us a powerful tool and a very valuable asset for company.
Please think as an engineer.
--
References:
How to design a good API and Why it matters (pdf)
APIDesign.org
API-writing blog
Fog creek on API design
Artima forums: Design
Compactness and Orthogonality

The future of gaming is here.

  • Onlive is a microconsole (a platform) who receives the game you're playing via video streaming, something like youtube but applied to games. It uses an own video compression algorithm which gives high compression ratios, but it depends on your connection bandwidth to play in HD or not. There are already a couple of companies supporting and working on it.
  • Zeebo is similar, but it is a console yet with only a (free!) internet connection to download games we want to play. It doesn't use disks.
As you can see, the future is the online distribution, to make life easier (no more PC requeriments), cheaper (these platforms will be cheap, but with a monthly/annual payment), and sure (avoiding piracy, or trying to).
Well, I don't know if these new platforms will be really the future, in any case, I would like to check if the games (server) will respond rapidly when you are playing with a very quickly game like a FPS. Also, the image quality maybe won't be as good as in current consoles. (why do we want HD images if a lot of people are always playing videotubes/gametubes?)
Only time will tell.
--
References:
More gamestreaming: Gaikai
Why Onlive can't possibly work

27.3.09

EGO Technology

We always are talking about the most known game engines, like the Unreal's, CryEngine, Gamebryo, IdTech or Source. Those engines are very good (and expensive too), and obviously there are a lot of marketing with them, but did you know another next-gen technologies used in games today?

A couple of days ago, I'd news about the new Codemasters' technology: EGO. It's an evolution from their Neon engine and is being entirely developed by them, since three years ago. It's a company's investment to improve all their new titles, as well as an intelligent movement to make easier the transition for next generations. EGO supports next-gen multicore in both consoles and PC, car physics (bringing deformations to new levels of realism), next-gen graphics, tools and a lot of features that make it truly powerful, and a very good choice to be used in next-gen AAA titles.

The last point is that EGO is actually a fact, in other words, is being successfully used for titles like Operation Flashpoint 2: Dragon Rising and Racedriver: GRID, with incredible results.

In my opinion there are not too much companies who have the opportunity (vision and risk too) to invest in proprietary technology, like Codemasters is doing, but I think that needs a better marketing work, for example, a good website like UnrealEngine has, showing its features. Anyway I'm sure they're working on it.



--
References:
Gamespot: Codemasters' EGO has landed
Codemasters
List of game engines

Possibly another hit from the creators of Shrek and Kung-fu Panda. It looks great.
Since 2001 I was waiting for another comic monsters related movie in 3D. In that year Pixar released Monsters Inc, the best 3D film ever (to me), difficult to beat, seriously, but seeing what the Dreamworks' guys have done in Kung-Fu Panda, MvA could be the next Oscar for the best animated feature film (Pixar won the last edition with Wall-E).

Anyway we need to wait for incoming Pixar's Up, which is again directed by Peter Docter, director of Monsters Inc, so it's very good new to me again. Coincidences?. And what about our Planet 51? This year looks promising for computer animation industry.
I hope you enjoy it, I will do it.

Half-life 3?, a Samsung's promotional video?, an amateur's video?

Do you like the puzzles? Ok, and... What if those puzzles are asked you in an interview?
In my opinion, I think that the companies who do some kind of coding test or interesting interview questions are good companies.
Years ago, a good friend talk to me about it. In fact, in my current company I did an online C/C++ questionnaire and then an exercise in office. The exercise wasn't too difficult, but enough to check distinct levels of programming style.
Something similar I did four years ago, for Gextech, and I remember a question in special, something like:
What would you like to be, if you'd reborn?
Damn it!, I didn't study this question on school. What do I have to answer? Well,..... I would be a Cactus!
A cactus?, why?
Because I like the sunshine and the peace that a cactus have. (I thought this was the last question to me..., but not).
Reading in Coding Horror, an article about puzzles and curious interview questions I've found this web: techInterview.com, where you have the most freak interview questions I ever heard about. I recommend you read them if you want to move to a company you think will do these kind of interviews.
In any case, do you think these kind of questions or puzzles are always valid? I don't think so. There are a lot of people that get nervous and block themselves, but they could be valid candidates, maybe with a more systematic or a mid-term thinking, sometimes doing the work with more careful, and you can't guess it if you only judge them with a puzzle.
You can't build a good team with only top brilliant freaks. You'll need more meticulous people, perhaps slower than others, but with a better sense of safe work. It depends of course. Not all puzzle-solver people are freaks, and vice versa, but you understand what I say. Don't you? ;)

How many programming paradigms do you actually know? Let's enumerate the most used:

  • Declarative, like Prolog
  • Imperative
    • Structured, like C
    • Object Oriented, like Java
  • Event driven, like C# or OO Pascal (Delphi)


More...? Well, in this page you'll see quite a few: Programming Paradigms

I recommend those rare like Nondeterministic or Feature Oriented ones. They're interesting.

Llego tarde, y el artículo ya ha sido retirado, pero tengo que escribir acerca de ellos:
Paloma Pedrero, columnista de "La Razón" la ha cagado. Pero por desgracia no es la única ignorante, ni lo ha sido ni lo será ...


Me uno al resto de desarrolladores y bloggers y estoy hasta las narices de tener que escuchar comentarios de gente que no tiene ni puñetera idea de lo que es un videojuego, de lo que cuesta hacerlo, de la ilusión que muchísimas personas le ponen, de la cantidad de horas, de la preparación técnica necesaria, de la cantidad de diversión y entretenimiento que proporciona a mucha gente, de la cantidad de dinero que proporciona a determinados ejecutivos, de la industria económica que ha creado, de la ayuda que proporciona a que avance la tecnología ... y lo peor de todo, de que un videojuego no es más que otro producto más como los miles que hay en el mercado, intentando competir por un trozo del pastel. ¿Por qué tomarla con los videojuegos?.

¿Acaso un videojuego no tiene calificación de edades como las películas?. ¿Acaso los videojuegos no son la salida fácil para padres que no saben/quieren dedicarle horas a sus hijos?. Hay videojuegos violentos, sí. Hay películas violentas, sí. Hay noticias en el telediario a las 14.30 donde aparecen cadáveres mutilados, sí. Hay fotografías de niños muriéndose de hambre, o videos de muertos debajo de un derrumbamiento por un puto misil en una puta guerra mostrado impúnemente en un reportaje en pleno horario infantil, sí. Hay chavales de 15 años que tienen ataques de corazón por el colesterol causado por la puta comida basura que comemos, sí. Hay cada vez más cáncer, provocado por vete tú a saber, con todas las ondas que nos rodean, productos químicos del día a día, la comida de nuevo, la contaminación..., sí. Hay coches que alcanzan los 200 km/h muy fácilmente, pero también hay leyes que nos prohíben correr a más de 120, sí. Cada vez tenemos menos árboles, por culpa del papel, para poder escribir chorradas en una columna de un períodico, o espera, ah que ahora usan ordenadores y eso creado por los frikis... internet. Hay una crisis causada por unos "listos" que se han llenado los bolsillos a costa del trabajador, y que ahora nos echan las culpas, y se salen de rosita gracias al gobierno que les ayuda, sí. Hay que ver lo que provocan los videojuegos en el mundo!!. Creo que los violadores y asesinos que copan nuestras portadas no jugaban a videojuegos, o sí?. Jugaban a un videojuego llamado "matemos a alguien por diversión, y hágalo usted mismo con este kit de asesinato. II (instrucciones dentro)".

He de decir que las imágenes que peor recuerdo tengo desde pequeño, de violencia, no eran de videojuegos violentos precisamente.

Para que voy a seguir escribiendo esto si finalmente todo seguirá igual... a los informáticos, y más aún a los desarrolladores de videojuegos se nos verá como esa gente rara, cerebritos que no son sociales, y que provocan que personas se vuelvan locas. De hecho provocamos que la sociedad se degenere de esta forma. Por quererme ganar la vida con algo que me gusta he causado que un chaval coja el rifle de su padre y .... un momento ... ¿el padre tenía un rifle en casa? Será que el padre jugaba a los videojuegos, seguro.

Que pena, en serio, qué pena de ser un blanco tan fácil y que nadie nos defienda. Lamentables formas de vida...

No dejeis de leer los siguientes enlaces:
Reflexión de esta columnista
NoticiasJuegos
OtakuFreaks
Banzaii
Dandel

For a long time I was thinking about to post more articles on AI in this blog. As the matter of fact even I wanted to post a series of techniques, algorithms, ideas about AI for gaming, but never I did it.
This thinking comes again to me recently, because of I'm reading two books about AI, and have cleaned all my knowledge base about the artificial intelligence discipline, to re-start with a new (and hope more robust) approach. These books are:

- Roger Penrose's The emperor's new mind: A deep reflexion and demonstration about why the AI as science will not be able to build really thinking machines like in Sci-Fi books and films.

- An academic 1.3k pages book, written by several university teachers in Spain, with a lot of solutions, applications, methodologies, tools, algorithms, techniques and theory in general.

I was working for three years in a non-interactive football game in AI for players. Finite state machines for low level (animation selection and blending) and a fixed/imperative rule based system for high level (strategy and position in field) techniques were used. Vector forces and some trigonometric/linear algebra was necessary of course. But no neuronal networks, no genetic algorithms, no learning machines, and even so the results were very good for our purposes (a mix between AI and statistical sequences).
I've found some people with the thinking of "NN are the solution to all our problems" or "with a genetic algorithm we solve it" or even "A* for every situation". Sometimes, we don't need to make our lives harder just because, and a good understanding about the difference between AI as science or AI as Knowledge Engineering is elemental to put limits to AI, and go right to the point.

And so Neurogence is created. This is my new blog about AI in general (not only for games).
Initially this blog site will contain a few articles, news and links. I'll need more time to make a good site. I've a lot of ideas about this blog, but the time is insufficient, you know, I hope you like it. By the way, if somebody wants to contribute to Neurogence, let me know by send a mail to gyakoo@gmail.com

14.3.09

Links Soup

Today I just woke up thinking to post a few links:

Have a good weekend

It is impressive, graphics, gameplay, ambient and music.
Try to watch it in HD, if you can:

Lastly I've been designing a simple framework to distribute tasks in a cluster environment (a multi computer system where nodes are connected via network). One of the most used framework to do this is the BOINC project, which was created originally for the project SETI@home. Obviously my framework doesn't try to simulate the BOINC's, but it tries to explore the main idea behind.

There is a web page for the project where you can view how it is implemented, examples and you can download it. It's called gydis (gyakoo distributed computing library) :)

Gydis project website.

Basically it is a set of classes which offer you an easy API to create a job and to distribute it in the cluster. By using the power of python's introspection a protocol communication between nodes using a own remote object is created.

The main idea is you must to inherit from a Job object (same syntax like a Thread class), to implement its run method and call to start to schedule the job in cluster. For job grouping you must to do the same but with JobGroup class, implement its reduce method and call to start to schedule all its jobs and wait for them, until results are computed and your reduce method is called back to combine them.

Here you have two (stupid) examples of use, but you can do a lot of things with this.


Single Job

The example below shows how to calculate a single factorial of 15 on a node. Yes it's a dumb example, but basic enough to show you how to create a Job and schedule it in cluster.
import job

class SimpleFacJob(job.Job):
def __init__(self,n):
job.Job.__init__(self,"controller-hostname")
self.n = n

def fac(self,n):
if n <= 2 : return 2
else : return n * self.fac(n-1)

# Executed remotely on a node.
def run(self):
self.result = self.fac(self.n)

# Called locally (here) when job finishes.
def response(self):
print "Job result=",self.result

if __name__ == "__name__":
j = SimpleFacJob( 15 ) # Create the job.
j.start() # Launch the job to cluster
# Wait until finalization
while not j.result:
pass

Single Job Group

Now another dumb example, we are going to calculate a factorial of 11 by computing eleven factorials of 10 and then sum them. We create ten jobs, each one computing factorial of 10. The reduce method will be a sum.
import job

class SimpleFacJob(job.Job):
# See the example above
...

class FacSum(job.JobGroup):

# Adds all results
def reduce(self):
r = 0
for j in self.jobs:
r += j.result
print "Reduced to:", r
return r

if __name__ == "__name__":
jobs = []
# We create eleven jobs, each one with factorial(10) computation
for i in range(0,11):
jobs.append( SimpleFacJob(10) )

jg = FacSum( jobs ) # Creating the group of jobs
jg.start() # Launch the group to cluster

# Wait until finalization
while not jg.result:
pass

Currently it's the version 0.1 so you'll find bugs, and the documentation is not completed yet, but I hope that this prototype will be continued.
Any recommendation to gyakoo@gmail.com

Well, last weekend I've been surfing between some projects done during last years, and surprise!, I've found some music files composed using fruity loops. BTW I remember that won a mod tracking contest prize in PCMania (a well known spanish magazine) about ten years ago, but I lost them of all. Anyway here you have some rescued trance/goa/progressive modules, enjoy them.

Sometimes our products need to release all data assets as images, sounds, models, configuration files, ... packed in a single file, often called packets.
This allow us to hide some files, best management of update/modding packets, compress data or avoid asset ripping.
In many situations, a zip packing structure could be used, in others, a tar, or a own structure with checksums or additional information.
But we need to split here two concepts: Compression and packing. It's trivial but necessary to know that a zip file is a packet/file format, meanwhile the deflate/inflate algorithms (used by zlib) are compression techniques. Zip uses zlib for every stored file.
Also, whether we want implement a library for this purpose, we need to provide, a single api mechanism to access transparently to a file using native os file-system (throughput C API) or to a file stored in our packets.
Lastly I've developed a library to do this. With an own packet format and using the free LZO compression algorithm (one of the fastest I know), you can access to your data from a packet(s) or from normal files with follow code:


#include "gfs.h"
int main(int , const char** )
{
// gyakoo filesystem initialization
gfs::init();

// Adds a packet search path.
gfs g;
g.add( gfs::PACKET, "data.pak" );
{
char chunk[4096];
// pickup a file from abstract file system.
gfile* f = g.grab( "images/texture.jpg" );
if ( f != 0 && f->length() > 0 )
{
// read in 4k chunks the file.
while ( ! f->eof() )
{
unsigned long r = gf->read( chunk, 4096 );
// do something with chunk ( r is number of bytes read )
}
f->close();
delete f;
}
}
return 0;
}

You could change the packet adding g.add( gfs::PACKET, "data.pak" ); by a folder using g.add( gfs::FOLDER, "data/" ); and the code doesn't need to be changed to access to the file.

With this library, I release a command line tool, like the tar one, to create, visualize and make another operations with packets and files.

The internal format of packet uses md5 for name, to avoid variable-length reading, and tries to minimize the seeks and read operations.
Here you have the format of packet: specs.txt

And here you have the source of library (linux and makefile): gfs-0.1.tgz

Bon Appétit