30 Oct 2011

MEANWHILE:

A Layman's Explanation of Time as the 4th Dimension


This is something I've been pondering for some time and I think I've finally worked out a simple way to explain how time can be seen as the fourth dimension. Don't worry, there's no maths involved in this explanation, just strategic examples.


General Stuff:
In the following examples, I will split the dimensions used into two categories, Base and Stack dimensions. This is NOT any kind of official naming, it's just what I use. The difference between them is basically that if you strip away only the stack dimensions of an object, you can still see what it is but if you take away a Base dimension, the object becomes partially or wholly unrecognisable. This will become much clearer in the examples, believe me.


Example 1: An animated GIF Image
This also applies to a film and basically any moving image. Anyway, an animated GIF is basically a series of pictures, so in this example the 1st (length) and 2nd (width) are the base dimensions (because if you take one of them away, you can't really tell what it is) and the 4th (time) is the stack dimension, as the 2-dimensional images are cycled through over time. The easiest way to visualise this is a flickbook, where the 2D images are literally stacked and then flicked through successively. Therefore you could argue that a GIF/Film is a 3-dimensional image utilizing the 1st, 2nd and 4th dimensions.


A specific example of this is a GIF I made when I was messing around with photoshop's animator tool. It was a large square with a red value which increased along the 1st dimension (x, across), a green value that increased across the 2nd dimension (y, down) but then I was stuck. How could I make it gradient through blue? The image was 2D not 3D, but then I thought of making it animated, effectively substituting the 3rd dimension (depth) for the 4th (time) to create a 3-dimensional gradient.


Example 2: A hologram
A still hologram would be 3-dimensional, utilizing the 1st, 2nd and 3rd dimensions, simple enough (1st and 2nd are Base, 3rd is Stack. Though you could say that any of the 3 could be Stack with the other two being Base, giving a cross-section in any of the 3 axes). But a moving hologram could be said to be 4-dimensional, utilising time as an extra Stack dimension containing a series of 3-dimensional holograms.


I've found this idea very useful when dealing with multidimensional arrays whilst coding, where an array can have up to 32 dimensions. I suppose I should point out that in computer terms, an animated GIF may be put into a 4-dimensional array, not a 3D one, with the extra dimension holding the data for each pixel (x position, y position, colour, etc.) though it is perfectly possible to use a 3-dimensional array and just hold the colour value for each pixel and instead use the dimension indices (i.e. the colour-value's position in the array) to hold the x, y, and t values.


I hope this may one day possibly help some person who is struggling to understand why time is the fourth dimension. Unless of course it isn't and/or this is a load of bull.


Maybe I'll design a program to demonstrate all this...

19 Oct 2011

Spectrospores!

Certainly better than PixelGame, this is the result of my first assignment (though it has a weighting of 0 meaning it has no effect on my overall grade, but still) which was to create a game using GameMaker 8.1 Lite that can be played using a single button.
My idea is Spectrospores, a colour-based puzzle/defence game where you have to stop these coloured circles (spores) from reaching you (a larger thing called the pulsar in the bottom left corner) by launching pulses of the right coloured photons to charge them with light and explode them.
The player controls the pulsar using the spacebar which is used to select a colour (the colours automatically cycle up the spectrum from IR to UV, pressing space stops the cycle) and the length of the hold determines the charge level. The more charge, the more powerful the pulse (more photons) but also the longer the cooldown time before the pulsar can be charged again.
A spore is overloaded by hitting it with 3 photons in quick succession. If you aren't fast enough, the spore will fling off the photon again in a random direction (possibly charging another spore) and switch to a lower charge state.
When a spore overloads it released a burst of photons of the next colour down the spectrum (e.g. a blue one releases green photons upon overloading).
Also, there are special white spores that will explode and release a HUGE amount of whatever photons hits it first.


However, it is a little buggy. For some reason not at all my fault (some strange bug in GameMaker itself I think, I've checked my game over and over again and found no reason at all) spores will occasionally get charged with photons not of their colour and all photons released by the pulsar will appear IR or red, however this is purely aesthetic and they still act like they should, they just look funny.


Overall, its nice and colourful, quite fun to play and I think everyone was quite impressed with it.


Download
Dropbox (.exe file)




Side note:
I have started the coding for my zombie game. Nothing working yet but I have bits of a physics engine going (a lot more simple than it sounds, velocity.Y -= (9.8 / FPS) implements gravity, for example) as well as a very simple (well, simple in operation, not coding) terrain generator. I've also started building the class tree and I'm working my way down it to the Zombies.


Class Tree for zombies: (bold is done, italics is doing, normal is not done)
>gamePhysObject (any physical object in the game world, has togglable physics (movement) and clipping (collision, i.e. it hits stuff instead of passing through)


>gamePhysEntity (any object with a level of Artificial Intelligence, this includes living (and undead) things as well as stuff that like sensors and tripwires probably)


>GamePhysZombie (any zombie, maybe have subclasses (e.g. fast zombie, ninja zombie) but will definitely have customisable settings with probably slight randomisation so they aren't ALL the same)

29 Sep 2011

Aggressive Pixels

Not quite as bad as PixelGame, though I think the name is even worse. It was originally gonna be AngryPixels, but I thought it would sound like a really rubbish angry birds rip. Anyway, this is the VERY FIRST simulation of some of the VERY BASIC elements of the Call-based AI idea I have for my Zombies (details under the instructions).

Instructions:
There are some in the program itself but anyway, here's the full set.
In the zip are two files, this one you don't have to install like PixelGame (I found the Build button)
The Map.bmp file you put somewhere that you can easily type the location of, like C:\Map.bmp
The .exe file you put wherever the hell you want really. To run the program, just double click the .exe

1: Enter the file address of the map (e.g. C:\Map.bmp or Q:\A\Really\Stupid\Place\StupidlyNamedMap.bmp)
2: Press Startup ONCE. I'm not yet sure what happens if you do it more than once, but it involves Zombies so it can't be good.
3: Press Process. The simulation with start and the display will show the map you chose populated with white zombie pixels (white because its easy to see, dark red was a nightmare.)
4: Press Stop Processing to stop the sim. You can press Process again to continue it, but to restart the sim you have to close and reopen the whole program. Sorry.
5:...
6: Profit!

The boring stuff about Calling zombies and things like that
Basically, the way the AI works in this (or will work, it's not complete by any stretch of the imagination) is that the zombie communicate by Calling and Hearing. A Call finds all other zombies within the Caller's speech radius and starts a hear event for each Hearer. If the Caller is within the Hearer's hearing radius, they receive the information, in this case the Caller's target location which overwrites the Hearer's target. Soon the Zombies should be able to choose between accepting and rejecting the information depending on whether their's is better (i.e. nearer and/or tastier) or not. Eventually, this will become an integral part of my final game as all sorts of things will be able to Call, such as guns when fired, explosions, falling stuff and basically anything that makes noise. However, these will not carry any information apart from their origin, so it only really makes for good Zombie distractions. Also, there will be human NPCs which when they Hear a zombie they will add the call's origin to their list of locations. Then they can communicate that to others, warning of potential zombie-infested areas or give that information to the player. These location will also have a timestamp so that newer reports can overwrite older ones, so that if one guy is raving about zombies in the old mill and another guy has just been there, he can set him straight. But all that complicated stuff is way, way, way down the line. In the short term, this will probably develop into a tool for testing Call/Hear events and zombies hunting humans (or vice versa) with a movable human character (probably ArrowKeys/WASD-controlled if I can get it working) and ploppable zombies as well as 3Dish terrain (things move slower uphill and faster downhill).

Making a new map for Aggressive Pixels
This is actually really simple, it just has to be a 512x512 pixel 24-bit bitmap (the default type paint makes, just use the draggy thing to resize it). Only rule in terms of colour is that [192,128,64] is the colour for inaccessible areas, Zombies will be placed randomly anywhere that isn't this colour, but can't move past walls of it. So yeah, go nuts.

Download (Dropbox):
Aggressive Pixels

21 Sep 2011

Pixel Game

Literally the WORST game ever, but my first try at making something game-like with an actual visual interface.
Download format is .Zip, unzip it and run setup (this was generated by Visual Studio).
To uninstall, just find it in Add or Remove Programs.

Basically, you use the buttons in the top left (no key control at the moment I'm afraid) to move a white pixel around and place it, making pretty black-and-white pictures in a painfully slow and annoying fashion.

Instructions:
U, D, L and R are to move the current pixel Up, Down, Left and Right respectively.
N starts a new pixel, ALSO REQUIRED TO GENERATE THE BLANK IMAGE AT THE START. YOU HEAR ME? PRESS N FIRST WHEN IT LOADS!
S should save it but I have no idea where, it's like a single line of code that I've never even seen before I used it.
X gives you a completely new blank image. No idea if you can start by pressing X instead of N, but just press N anyway.
E erases a white pixel. Move the current pixel over an already white pixel so it turns grey, then press E and it is erased. The current pixel remains there though, but the one beneath it is now black.

Basically, move the white pixel with the direction buttons, place it with N and then move the next one. As I just said, white pixels will turn grey when you place the current pixel over them to show that there is already a white one there instead of a black one (it also means the program can easily tell it has to put a white pixel back there when you move off it, but you don't need to know that).

Download (Dropbox):
PixelGame

New Start

If you (incredibly) haven't come from my DA page, its dakshen3.deviantart.com, have a look, I do more than just sit and code (not much more though). Otherwise, just carry on.


Anyway, now I'm at the University of Lincoln doing Games Computing (+Masters) I thought that it would be a good time to actually use this old, run-down blog to show off the various bits of crap I create during my learning experience. It also gives me a good place to come if I ever think I'm not good at coding, so I can look back and think 'Wow, look how badly I sucked at coding back then, I'm actually way better now' and hopefully feel a bit better about it.


So, yeah. From now on, Electric Sheep and my DA page should be quite closely linked. DA will be more about my ideas and plans and such, this will be the technical part.




On a completely unrelated note, apparently my neighbour the Incredible Disappearing Luke (he just seems to vanish for hours on end, then you find out he was in his room or something. He did it when we moved in, turns out he had slept from like 2pm to the next morning so I was the only person who had seen him at any point until he emerged for breakfast) has met Dean of OMFGItsJackAndDean, who are friends (I assume) with Tom (aka TomSka) of Eddsworld fame, who unfortunately graduated at the end of last year, so we never got to meet him. So yeah, that's my incredibly insignificant, dilute, indirect and roundabout claim to fame for the time being.