The box that contains the artifact to unlock your mind.
Behold! Every item in the box fits perfectly, easy to unpack an pack down.
The USB dongle for connecting to the EPOC headset.
16 Felt sensors in their hydrator pack. All these sensors need to be soaked and attached to the headset before each use. After use, they should be removed from the headset and put back into the hydrator pack.
Contact lens liquid, used for soaking the felt sensors. Had to use a lot the first time I used the headset. This is way better then using some sort of gel, doesn’t get sticky, messy and no smell.
USB cable, for charging the headset. You can’t use this as an alternative connection as far as I know.
And here is the headset itself! Had a bit of a hassle the first time putting it on, but just after some uses I can put it on with ease. It doesn’t feel weird wearing it, and my glasses is not in the way. But it’s really tedious installing and removing the felt sensors each time I want to use it.
Another post will come soon where I will show it in action. It will also feature me wearing this dorky thing :^)
I recently ordered a dev kit from Emotiv and just found out that it will be here this Friday!
So what is this Emotiv stuff?
Emotiv is the company behind the EPOC neuroheadset, a wireless headset that reads neuro-signals basically. I won’t get into what a neuron is but if you want to read more about that sort of stuff check out the wikipedia article. It can read two types of major neuroscience branches (as they are called on the wiki) Cognitive and Affective. To make this easy we could say that the cognitive part is your conscious thoughts and intent while the affective part is your emotions. It can also read your face expression and has a gyro.
So what can you do with it?
A lot! Imagine using this headset in games, where you use your thoughts as input. Some people has connected it to their homes to switch on and off lights by just thinking about it. Another guy built it to control his wheelchair by using facial expressions. I can’t wait to get started, I noticed this project 2 years ago but I don’t think they shipped internationally by that time.
it currently only supports Windows but both OSX and Linux support (yay!) is in beta stage. So right now the dev kit contains a few dll files that you can access with C\C++, C#, Java (with jni), mathlab (I think) and other languages where you can communicate with win dlls. I’ve that there is a Unity plugin for this as well. The dev kit also contains a few applications such as a control panel for the EPOC headset.
Is this the future for gaming and human to device interaction? I don’t know, but I will blog about my experience of it when it gets here. Currently my only concern is that it has some latency, making action based games hard to create. Check out the videos below to see more of this awesome product!
I’ve hear rumors that this little baby will be released November\December this year! I will most definitively get me one of those for experimenting, especially for gaming, see the sprite and graphics tech demo below.
UPDATE: I got a tweet from Raspberry Pi yesterday saying that they are still on track for releasing it this year.
So if you never head of Raspberry Pi (not many have) here is a quick summary.
It’s a single board computer, unlike it’s ”competitor” Pico-itx which is only a motherboard. So this means that all the ports, memory, cpu, gpu etc. is already mounted on the board. It will be bundled with Debian but any other OS compatible with an ARM processor should work (Android?). So what’s so awesome about it? In my opinion these three aspects are more then enough to buy one:
- It’s cheap, they got two models, one budget\lite version for $25 and one more featured version for $35. The later one has more RAM, Ethernet and one more USB port.
- Power,the low-end model only consumes around 1W on full load and has external PSU like laptops. This makes it smaller and more portable. The high-end requires more power, but still unconfirmed of how much more. And you can also run it on 4 AA batteries!
- The GPU and HDMI. Yeah, you heard me. On board HDMI. And it’s powerful too. It can render a full HD 1080p movie directly to a television or monitor and demos has been shown where it runs Quake 3 at 1080p(!). Check the sprite demo below, and make sure to visit http://www.raspberrypi.org/
Setting up the environment variables JAVA_HOME and JDK_HOME is easy, just type this into the terminal:
export JAVA_HOME=/usr/lib/jvm/<platform_name>
export JDK_HOME=/usr/lib/jvm/<platform_name>
Note: No trailing slash and point to the root of the platform, not /bin. And no ”quot” chars.
This works great until you reboot or re-login. You may know that you can add these two lines to .bash_properties located in your home folder. But you won’t find that file in Ubuntu, instead add these two lines in the bottom of .bashrc.
Now log out and in again and try to type this in the terminal:
echo $JAVA_HOME
If you see: /usr/lib/jvm/java-6-sun for example, then your done! Recheck the .bashrc file in your home folder if you only see blank space.
You can do this for all the custom environment variables you want to add to your Ubuntu account.
Easy as pie with a GUI (like tortoise or rapidSVN), but sometimes you don’t want a GUI (for numerous reasons). I struggled with this for a while and found a solution. My biggest issue was to find the actual revision --limit was my savior. It may not be the best but worked great for my purpose.
To locate the revision where the file was deleted, use svn log --verbose --limit 15
I add --verbose to see the files and not just the comments and revision numbers and --limit 15 to only get the 15 latest revisions (our HEAD is at 9780). Now locate the revision where the file was deleted, marked with a big D.
Then run svn up -r revision_number filename_or_folder
When I’m coding, or actually whatever I’m doing at work, I tend to forget common things. By things, I mean commands, code library names, processes, code snippets, environments, softwares etc. I used to have a notepad with this common stuff in case I forgot them. But now I’ve lost that notepad… Can’t find it… But I learn on my mistakes! I’m going to use a digital notepad from now on for safe keeping. I was planning to use google docs, but then I realized, why keep this common stuff to my self? Why not share it for other people having the same problem?
So, that’s why I created this category called Stickies on my blog, for post that I might need later on, for safe keeping or just a memo. Feel free to comment on my ”Stickies” if you have a better way of solving the problem.
A common thing I’ve noticed is that people that begin to code java (or any other language supporting ArrayLists) can not see the differences and uses ArrayLists before traditional Arrays. So here is a quick description of both and when to use them.
Array
An array has fixed length which is set when it is created (using the new keyword), it cannot grow dynamically. It can be 2-dimensional, 3-dimensional or more. Don’t really know if there is a max matrix, guess not, but only as long as your computer has ram for it. Arrays are quick and always start with index 0, a common beginner mistake is to set the array length counting 0 as a value, see below.
byte[] myArray =newbyte[1];byte[0]=1;byte[1]=2;//Won't work as the length of the array is only set to 1!
Arrays are good to use when you know the maximum length after code compilation. An example related to game development is Tile Maps, when loading the map data you should already know how big your level is. This is true for most tile maps. Another example could be if you want to enter player High-Score data into an array before converting it to JSON or XML to a webservice such as: score, name, email, time and ip; total length of 5.
ArrayList
ArrayLists are very similar to regular Arrays, you store stuff in them. But instead of having a fixed length ArrayLists grow each time you add another element. Unlike Arrays, ArrayLists are filled with data through the method add() and you get the data by using the method get(int index). But under the hood of an ArrayList lies an Array. So each time you call the add() method you clone your current Array in the ArrayList into a new Array with the new fixed length of n+1, where n is the current length, and then the new data is added. This can slow down performance of course, but it’s a cool feature if you need dynamic arrays. I use a custom built version of ArrayLists in my game for handling all the objects.
Here is a performance tip: when creating your ArrayList you can set the built-in Arrays fixed length using ensureCapacity(int minCapacity). This way the ArrayList does not clone the current Array when you call the add() method until it reaches the minCapacity.
I think we all know that when it comes to (real-time) gaming we want our game to run as smooth as possible and in my case on as many Android devices as possible. In my current game project for Android I start by creating the game for java desktop before porting it to the device. This is good, because you won’t need that oh-so-very-slow Android Emulator. You could always debug straight to the phone, which is good as you get the exact result, but in the end also kinda tedious to install the game over and over again (and debugging on device has a lot of data in the header).
It’s also a bad thing to run the game on Desktop, because you get speed blind and can’t really get to feel how the game runs on the phone. By speed blind I mean that you don’t optimize your code, because it runs fine on the desktop. So, I developed for a long time on the desktop machine, and when I was going to make a first test run on the phone it ran really sluggish, almost didn’t start. I had to go back into my code and optimize a few things. I should have done this at the start of the development but it ran fine on the desktop so I didn’t care right then.
The major performance issues I had with my game were 2 things:
- Checking collision
- Area to check for collision
A very bad way to check for collision against a tile map.
These two are what makes most platform games slow if not optimized. I went cheap when starting my development and this is how I checked for collisions. I checked each pixel underneath the player + the current gravity or +1 if he was already on ground. Right now we have too many checks. My Player is 32×32 pixels big, which means the number of collision checks (for bottom) per tick\frame is 32*current gravity. I did the same for checking collisions on the sides and on the top as well. And all the checking looped through each individual tile (about 625). If you do the math, this is very bad and waste of cpu power, especially for a phone.
So how should we check for collisions? The answer is simple and common to most game developers, Bounding Boxes! A bounding box is a rectangle around instances or areas. To check for collision with bounding boxes you simply check if a rectangle intersects with another and then handle the collision. And when you think about it, most tile maps have large rectangular areas, why not just dynamically create a bounding box over such areas? It speeds up stuff a lot!
The same map with around 625 tiles now only have 6 areas to check for collision.
One last thing, only check for collisions if the bounding box is near the camera viewing frustum.
here is a very simple code to check if two rectangles is intersecting.
Ai-Ushi can now load and render .ccm tile maps! Only the main layer is supported and no objects, but hey! It’s always a first step! Make sure to follow me on twitter for more regular updates :)