Wellcome and enjoy.

I would like to welcome you on my blog and thank for time you spend reading it I hope you will enjoy.It is personal creation of me, Lukas Tencer, and it will map my professional success as well as my personal interests.

Thursday, June 24, 2010

Real-World Data Based Game Content

I have read about research of computer games research group on ITU Copenhagen. They are generating game content based on users action and they are trying to maximize enjoyment from the game. Based on they research I have been thinking about game content little bit also on myself and following idea come into my mind.

Basically every game has some content and it could be created by artists or somehow generated. Generated context could be done procedurally. But even when you want to have procedural context, you need some seed, based on which you generate this context. Seed for researchers from ITU are players actions. I have been thinking about little bit different approach, and it is to generate game context on the biggest set of data one can acquire. It is real-world data. Just imagine about mixing real-world data and game context. There are a lot of ways, how to do this, so lets speak about few of them.

First of all one can just deliver game context based on the basic real-world, what is position. This is basically best executable on mobile devices. Where player is playing the game, but on different locations are available to him different levels. So where to use this? First of all education, where you can just give people more inspiration to visit some places, like museums, galleries, parks and other cultural and other institutions. Just a family on a trip around museums in their city and great way to deliver information to kids is to let them play game, which context is based on in what museum they just are. Second nice use is marketing. Also model situation. You are a big fast food company, which wants they visitors to pay a visit to their affiliates. You can release game, which will provide to players in every affiliate different level, for each level they receive award and after enough awards they will get some free drink or any of your products. Last use of just position is the legal issue. In many countries there exists rules and laws about specific game context, which can and can not be delivered to players. Best examples are Australia or Germany. It is easy to filter game content in stone shops, where developer and publisher adjust game context for release in particular country, but it is harder to done in electronic publishing. Also nice example are mobile games, where is no guarantee, that the application will pass all the local laws. For this purpose could be also used location specific game context.

Lets move to second option of mixing game context and real-world data. Now we want to use some more information than only position in computer games. It is best, that it would be information, that could be obtained explicitly and is available worldwide. This type of information are: traffic, weather, daytime, stock information ... there is a plenty of data, which can be used in games for game content. We does not need them to simulate, we can just use them. Also, when you use real world data in computer games, one can actually solve real world problem. Model situation: GPS, which communicates with game server and players quest is to lead the car as fast as possible from point A to point B with avoiding dangerous places(some really bad neighbourhoods), traffic jams... . Also use of real world information, for example weather in computer games, could make step toward personalization of game context (did ever happen to you, that you have noticed, that its raining not by looking outside window, but by looking on forecast instead?). Also option to let player play from some initial state, which is based on real data, and then to compare their results with results based on actual data, could lead to some nice statistic observations.

Last use of real-world data in game context is the deepest one from previously described. It is use just a real world as a environment, mixed with artificial models. Some solutions already exists in augmented reality, but none of them is actively used for computer games. This could be nice in combination with approach number 1, so you can play in real world and based on your position, you are playing with different game content. This idea is a little bit abstract but it is strong proposal for game prototype, which could bring new view on mobile game playing, especially now, when new devices with new technology are introduced. So augmented reality + location based game context could really make a difference.

On this theme I have not found any scientific articles published, even when in some areas are already existing solutions (games based on stock information, AR for PC ...), I have found none published on scientific conferences. So I am happy that I have option to share my ideas and visions with you and I hope, this could be helpful to you.

Friday, June 4, 2010

Drag and Drop in HTML5 and File Input. They have sth. wrong.

Hello everyone. At first, let me please say little background about recent events in my life, if you are interested only in technical stuff, skip this paragraph. Be unpredictable events it happens, that I am currently working on front-end of one web application for big big company. My role in team is not big, but I like my work and now I actually work on something pretty interesting. It is only 3 days what I am working with Dojo, Ajax, so please be patient with me. But as you can see I learn fast :-).

Let`s say something, what we would like to do today. As Google has started its Drag and Drop for Gmail, everyone wants to have one like that. So my BigB company has asked me to do also one like that for them. This is what I am working on in combination of Dojo, Ajax, HTML5 and classic HTML. Our task is like this: You have some form, there is some default behavior on this form and you would like to keep it, but also add some other. Thing are now like this, we have DOJO Fileinput and user can select there files and after submit of form they get uploaded on page. Now we would like to sth. like this. After dragging files on special div, we would like to add new Fileinput fields with those files in it. So no XHR request or sth. like this what is commonly used for uploading, we have to rely on script, which is processing form now and of course we can not touch him. So how to do this? There is a lot of limitations.

First of all, get working Drag and Drop, what is pretty simply task and even withou no knowledge of DOM or Ajax you can do it, I was able to do it, so you have to do it also. Follow this examples:


Get here until phase you would have access to you dataTransfer object. Now it is going to be little more complicated. First of all we need to put files to . To do this will help of new property of input DOM object and it is files. API is described here: http://help.dottoro.com/ljwjmspm.php. It is an Filelist object, and there are some problems with it, which I will mention later. Ok now, we have the files there and we would like also show names of files to user. This really could be problem with classic input, because value property is read only for security reasons, which are pretty clear. Using it could anyone download any file from your computer. So what to do now? Because we are using DOJO, there is one big advantage. DOJO Fileinput is little bit hack, and what you see is actually not an real file input, it is just text input and button, inside an file input. I know it sounds strange, but try to take a look on code in DOJO and you will get it fast. So now we just get this text input and we put there our file.name, great. We submit form, hoping that everything will go ok, and... PROBLEM!

Files added by user are uploaded without a problem, but files added to input programmatically are not submitted, so where the problem is? Could it be even done? So let`s take a look on documentation of Filelist, let`s play little bit with debuger and after a while we could find out, that our files property of input is allways 0?!?!. And this is pretty a problem in implementation of Filelist. Because, yes, you can access files with operator [], and this operator even accepts file to write into files, but it does not increase its length :-(. So on submit is nothing submitted. And what is worse, it is read only property, and there is no way how to change it. Just look on previous link.

This is pretty serious issue, and I hope, that in future implementations it will change, I would even report it to someone, if I would know to who. I can imagine, that there will arise a lot of more security and other issues, with allowing this property not to be read only, or by letting operator [] to set length. Other solution is to make operator [] able only to read, not write, but I believe, this would be step back. It is really nice help for developers. Especially, when you want to use file from other sources (DND, Web...). So how now solve this problem? On monday I am going try to write my own XHR request and override submit function, which is sending form. Will see, if it could be done, more info in part 2.

I hope, I have helped you at least a little bit. Have a nice day.