Jump to content

  • Log In with Google      Sign In   
  • Create Account

The Dev Journal



Dev Journal: Detecting Tapping and Pressing inputs using Java.

Posted by , 22 March 2014 - - - - - - · 1,470 views
inputtapping, tap, pressing and 5 more...
Dev Journal: Detecting Tapping and Pressing inputs using Java. I'll be showing you a simple way of detecting different input keystrokes using Java. There are two different keystrokes for a computer keyboard, tapping and pressing. Tapping a key means the user is pressing the key and letting go immediately after. Pressing a key means the user is pressing and holding down the key until the user wishes to let go.

In Java, the fastest way of detecting key inputs is to use a class implementing the KeyListener interface, and then adding the listener to the Swing component. Fastest, but not exactly feasible for some others.

The key to detecting inputs to determine if it's tapping or pressing is by using threads. I use a thread pool for easier thread handling. Below shows the codes, while I try to explain how it works.
public class NewInputHandler implements KeyListener {
	public Map<Key, Integer> mappings = new HashMap<Key, Integer>();
	private ExecutorService threadPool = Executors.newCachedThreadPool();
	private Keys keys;
First, we need to create a thread pool in order to manage threads easily. You can tell that I used a hashmap, this is for holding the key codes per key. If the Key is, for example, the "A" key, the Integer portion will contain the key code of A, which you can obtain via
KeyEvent.getKeyCode();
method. I also created a new class object, Keys, which holds key states, "tapped" or "pressed". More on that later on.
	public NewInputHandler(Keys keys) {
		this.keys = keys;
		mappings.put(keys.up, KeyEvent.VK_UP);
		mappings.put(keys.down, KeyEvent.VK_DOWN);
		mappings.put(keys.left, KeyEvent.VK_LEFT);
		mappings.put(keys.right, KeyEvent.VK_RIGHT);
		
		mappings.put(keys.W, KeyEvent.VK_W);
		mappings.put(keys.S, KeyEvent.VK_S);
		mappings.put(keys.A, KeyEvent.VK_A);
		mappings.put(keys.D, KeyEvent.VK_D);
	}
In the code above, I pass in the Keys object, and then put all available key controls into the hashmap. This part is a bit self-explanatory, but basically the hashmap now contains the key codes for the corresponding keys.
	@Override
	public void keyPressed(KeyEvent event) {
		for (Key v : mappings.keySet()) {
			if (mappings.get(v) == event.getKeyCode()) {
				if (!v.keyStateDown) {
					final Key key = v;
					key.isTappedDown = true;
					key.isPressedDown = false;
					key.keyStateDown = true;
					this.threadPool.execute(new Runnable() {
						@Override
						public void run() {
							try {
								Thread.sleep(100);
							}
							catch (InterruptedException e) {
							}
							if (key.keyStateDown) {
								key.isPressedDown = true;
								key.isTappedDown = false;
							}
						}
					});
					break;
				}
				else
					break;
			}
		}
	}
Now, this is one half of the core of detecting tapping and pressing keys. By navigating through the hashmap, then finding the key that has been pressed, we can then be sure to edit its key states. After that, we create a new thread worker that helps determine when the user is actually tapping the keyboard, or actually pressing it. I let it sleep for 100 milliseconds, as this given value is enough to detect and tell the difference both tapping and pressing. Finally, we edit the properties of the key that was selected and active.
	@Override
	public void keyReleased(KeyEvent event) {
		for (Key k : mappings.keySet()) {
			if (mappings.get(k) == event.getKeyCode()) {
				k.isPressedDown = false;
				k.isTappedDown = false;
				k.keyStateDown = false;
				break;
			}
		}
	}
	
	@Override
	public void keyTyped(KeyEvent arg0) {
		//Ignore. Used for sending Unicode character mapped as a system input.
	}
This is the other half of the core. When a key has been released, we have to mark all occurrences of the key as false, in order to prevent input overlapping issues. Just be wary that there's a missing bracket, so people there may be anything but quiet.

So now, when you start the game, tapping (or quickly press) the touch screen will say that you have tapped a key, or pressed a key. That is it for today.


Dev Journal: 2D sprite animation using OpenGL ES 2.0 for Android

Posted by , 21 March 2014 - - - - - - · 10,938 views
2d, sprite, animation, opengl, es and 2 more...
Dev Journal: 2D sprite animation using OpenGL ES 2.0 for Android Chapter 7 - Making heavy use of Android


You probably might see that the way I write this journal is a bit different than my other entries. The fact that I'm using Chrome for Android to write this, means that I'm lacking the WYSIWYG editor most people are using. So, there won't be anything to show, even images and screenshots.

I'm currently using AIDE, also called Android IDE. It's an integrated Android development environment suited for Android programming on the go. Been using it since the Christmas holidays (when it was 50% off), so I have a pretty solid knowledge of using it, and have become a power user of Android. What you probably won't believe is that I'm using HTC Desire S to program Android apps, especially at times when I have to lie down on the bed and program away at night.

I'm going to hasten this up and move on to the most important part of this entry. There's not a lot of stuff that I wanted to share for the moment.

----------------------



Chapter 8 - 2D sprite animation using OpenGL ES 2.0 on Android


In this entry, I will be showing you how to do 2D sprite animation using OpenGL ES 2.0 for Android. I use a bit of GLSL in order to manipulate the textures around and display the effects of sprites animating on the screen.

Note that in this entry, I jump around often. It's done so I can explain the steps when it is needed (a "demand-first" approach). If you get confused, please leave a comment explaining where you can't understand, and I'll try to modify the post for you at a later time.

The first thing you want to do is to create a spritesheet ("Sprite sheet" or "spritesheet"? Spelling is correct?). How you lay out your sprites is up to you, but you need to be consistent throughout the creation of many sprites you'll probably do in the later part of your project.

For me, I will be using a layout of 4x4 spritesheet, where a sprite character has 4 directions (NORTH, SOUTH, EAST, and WEST), with 4 frames of animation per direction. Each sprite character is 16x16 large, so the entire spritesheet is 64x64.

Attached Image

For demo purposes, I will use a simple sprite character named "Joe", from the Pokémon series (2nd generation, to be exact. Joe actually exists!) You can use any sprite characters you can use, regardless of size and shape.

This spritesheet should be placed in your assets folder of your Android project. You can place it in your res folder, but for the most part, I'm going to stick to the convention. You can choose to separate your sprite characters via folders within your assets folder, or in your res folder (You have to place it in /res/drawable-nodpi if you really are going for the res method.)

The next thing you want to do is to load the bitmap.
public class Art {
	public static Bitmap joe;

	public static void loadAllBitmaps(Activity activity){
		final AssetManager mgr = activity.getAssets();
		joe = load(mgr, "player/player.png");
	}

	private static Bitmap load(final AssetManager manager, String filename){
		Bitmap result = null;
		try {
			result = BitmapFactory.decodeStream(manager.open(filename));
		}
		catch (IOException e) {
			Log.e("Art", "Error loading art resource.", e);
		}
		return result;
	}
}
To initiate the loading, call the loadAllBitmaps() method in the constructor method of a GLSurfaceView subclass. (My preferred suggestion.) You load most of your assets this way by passing the main activity to your subclass. It not only controls the OpenGL context creation, but also allows you to control how your assets are to be loaded inside a method.
//In the main activity's onCreate(Bundle b) method.
ActivityManager mgr = (ActivityManager) this.getSystemService(Activity.ACTIVITY_SERVICE);
ConfigurationInfo info = mgr.getDeviceConfigurationInfo();
if (info.reqGlEsVersion >= 0x20000){
	renderView = new RenderView(this);

//In the RenderView class. It's a GLSurfaceView subclass.
public RenderView(MainActivity activity) {
	super(activity);
	this.activity = activity;
	Art.loadAllBitmaps(activity);			//<-----   This is where you load your sprites.
	this.setOnTouchListener(input);
	this.setEGLContextClientVersion(2);
	this.setRenderer(this);
	this.requestFocus();
	//...
	//... Of course there are more codes than this.
}
Once the sprite has been loaded, the next step is to load it in as a texture from a Bitmap.
	public static int loadTexture(Bitmap bitmap, int copy) {
		//This is to check for possible reinitialization of this object.
		//We want to prevent this from happening, otherwise there will be
		//unwanted black textures in your app.
		if (bitmap.isRecycled()) {
			Log.e("Entity", "Bitmap is already recycled. Detected too soon.");
			bitmap = Art.copy(Art.joe);
		}

		//Texture loading.
		//This is the part where most of the time, new OpenGL programmers would want
		//to search for it on Google. I'm putting it here for future references.
		//** Of course this is for Android. **
		final int[] textureID = new int[1];
		GLES20.glGenTextures(1, textureID, 0);
		BitmapFactory.Options options = new BitmapFactory.Options();
		options.inScaled = false;
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureID[0]);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
		GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);	
		GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);

		//This is to make sure the bitmap is recycled, and then pass the texture ID handle
		//to somewhere else where it is safe from being Garbage Collected.
		//For the time being, I placed it in to let readers know of this.
		//The exact code itself is useless at the moment.
		bitmap.recycle();
		copy = textureID[0];
		return textureID[0];
	}
After converting the bitmap to a texture object the OpenGL ES can understand, we need to setup the shader codes as well as shader initialization codes.
public void loadShaderLocations() {
	this.uMatrixLocation = GLES20.glGetUniformLocation(Shader.BaseProgram, Shader.U_MATRIX);
	this.uTextureUnitLocation = GLES20.glGetUniformLocation(Shader.BaseProgram, Shader.U_TEXTURE_UNIT);
	this.aPositionLocation = GLES20.glGetAttribLocation(Shader.BaseProgram, Shader.A_POSITION);
	this.aTexturePositionLocation = GLES20.glGetAttribLocation(Shader.BaseProgram, Shader.A_TEXTURE_POSITION);
	this.uTextureMatrixLocation = GLES20.glGetUniformLocation(Shader.BaseProgram, Shader.U_TEXTURE_MATRIX);
}	

public void setVertexAttributePointers() {
	this.vertexFloatBuffer.position(0);
	GLES20.glVertexAttribPointer(aPositionLocation, 3, GLES20.GL_FLOAT, false, 3 * 4, vertexFloatBuffer);
	GLES20.glEnableVertexAttribArray(aPositionLocation);
	this.vertexFloatBuffer.position(0);
	this.textureCoordinatesFloatBuffer.position(0);	
	GLES20.glVertexAttribPointer(aTexturePositionLocation, 2, GLES20.GL_FLOAT, false, 2 * 4, textureCoordinatesFloatBuffer);
	GLES20.glEnableVertexAttribArray(aTexturePositionLocation);
	this.textureCoordinatesFloatBuffer.position(0);
}	

public void setUniforms(float[] modelMatrix, float[] textureMatrix) {
	GLES20.glUniformMatrix4fv(uMatrixLocation, 1, false, modelMatrix, 0);
	GLES20.glUniformMatrix4fv(uTextureMatrixLocation, 1, false, textureMatrix, 0);
	GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
	GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureID);	
	GLES20.glUniform1i(uTextureUnitLocation, 0);
}	

public void loadFloatBuffers() {
	this.vertexFloatBuffer = ByteBuffer.allocateDirect(4 * 3 * 6).order(ByteOrder.nativeOrder()).asFloatBuffer();
	this.vertexFloatBuffer.put(new float[]{
		0f, 0f, 1f,
		0f, 0.5f, 1f,
		0.25f, 0f, 1f,
		0.25f, 0f, 1f,
		0f, 0.5f, 1f,
		0.25f, 0.5f, 1f
	});

		//Graphics Ratio: 
		//Width:Height = 1:2
	this.textureCoordinatesFloatBuffer = ByteBuffer.allocateDirect(4 * 2 * 6).order(ByteOrder.nativeOrder()).asFloatBuffer();
	this.textureCoordinatesFloatBuffer.put(new float[]{
		0f, 0.25f,
		0f, 0f,
		0.25f, 0.25f,
		0.25f, 0.25f,
		0f, 0f,
		0.25f, 0f
	});
}
For shaders, we want to pass in a model matrix, and a texture matrix. The model matrix determines where the entity is to be drawn. The texture matrix determines what portion of the spritesheet texture should be drawn to the mesh that is defined in the vertex buffer object. We pass in these matrices as uniforms, since they won't be modified while we're doing vertex and texture calculations. (Not sure the terminology for calculating vertex and fragment shaders be called.)
//Vertex shader code:
attribute vec4 a_position;
attribute vec2 a_texture_position;
varying vec2 v_texture_position;
uniform mat4 u_matrix;
uniform mat4 u_texture_matrix;

void main(){
	v_texture_position = (u_texture_matrix * vec4(a_texture_position, 0.0, 1.0)).xy;
	gl_Position = u_matrix * a_position;
}



//-------------------------------------
//Fragment shader code:
precision mediump float;
varying vec2 v_texture_position;
uniform sampler2D u_texture_unit;
void main(){
	gl_FragColor= texture2D(u_texture_unit, v_texture_position);
}
To be honest, the texture matrix calculations can be placed in any shaders. I placed it in the vertex shader, as I believed the fragment shader is executed more than the vertex shader. We need to update the texture's UV coordinates for the fragment shader to draw. I obtain the translated U and V coordinates by matrix multiplication using the above code.

To determine texture UV coordinates of a spritesheet, we use the origin UV of the texture, which is located at the top left corner of the texture. Each side is worth 1.0, or 100% of its width and height. Half width is 50%, or 0.5. A quarter of height is worth 25%, or 0.25 of its original height.

To keep what our texture UVs are, I use 2 float variables (or 1 float array of size "2") to mark its position.
//In the sprite class object, I used a float array to keep its texture position.
protected float[] texture_uv_coordinates;
//I also used a float array to keep its vertex position.
protected float[] xy_coordinates;
I pass the texture matrix and the model matrix through to the sprite class object, and then pass both of the matrices to the shader, as mentioned earlier.
public void setUniforms(float[] modelMatrix, float[] textureMatrix) {
	GLES20.glUniformMatrix4fv(uMatrixLocation, 1, false, modelMatrix, 0);
	GLES20.glUniformMatrix4fv(uTextureMatrixLocation, 1, false, textureMatrix, 0);
	//...
}
Then I update both matrices.
public void tick(float[] modelMatrix, float[] textureMatrix) {
	//Input update code
	Matrix.setIdentityM(modelMatrix, 0);	
	Matrix.translateM(modelMatrix, 0, this.xy_coordinates[0], this.xy_coordinates[1], 0f);	
	if (RenderView.input.pressed){
		this.xy_coordinates[1] -= 0.001f;
	}

	//Frame animation update code
	tickCounter--;
	if (tickCounter < 0) {
		texture_uv_coordinates[1] += 0.25f;
		if (texture_uv_coordinates[1] >= 1f)
			texture_uv_coordinates[1] = 0f;	
		tickCounter = 60;
	}
	Matrix.setIdentityM(textureMatrix, 0);
	Matrix.translateM(textureMatrix, 0, 0f, texture_uv_coordinates[1], 0f);
}
Ignoring some of the codes I didn't mention, there's a "tickCounter" that is used to slow down the rapidness of the sprite animation. Once the tickCounter reaches 0, it updates the texture UV coordinates by what we determined when we're creating our sprites. Then we reset the tickCounter, and repeat.

After updating the texture UV coordinates, we pass it to our shader to let it manipulate the texture drawing itself. This is the core of the sprite animation.

The input code mentioned above is for handling touch events. Once the user executes a touch event, in this case, a single tap on the screen, the sprite character moves down by 0.001 or 0.1% of the entire height of the viewport of the screen.

Once you cleaned up your project and used the above vertex and fragment shader codes, you can now start your own sprite animations, or you can go up a step and improve how animations work.

Again, if you have any questions, please leave them in the comments below, and I'll check back to try to help you out.


The Dev Journal: How I brought new life to an already wasted creation

Posted by , in Diary 19 December 2013 - - - - - - · 1,294 views
bringing, new, ideas, to, the and 6 more...
Chapter 5 - Adding ingredients I loved to the cauldron.

The first game I got into was not actually a PC game, but rather the oldies my dad put on a CD-ROM for me to play with. The CD-ROM was packed with emulators and old copies of obsoleted abandonwares, such as The Incredible Machines, The Oregon Trail, Peanuts: Math and Numbers, Jumpstart First Grade and Second Grade.

These games are what placed me on a track to gaming. But what exactly happened that made me jumped on a bandwagon on a road to game development? The answer is none other than Blizzard's WarCraft III: The Reign of Chaos.

Prior to that, I started playing my first PC game, Sid Meier's Civilization III. It taught me the basics of turn-based strategy, the history of mankind, how to change the tides by strategically placing units, towns, and colonies at the right spots, and how to engage in trading with others. Everything else is just, meh, I'm not really into that stuff.

Then moving on from Civ III, I started playing RollerCoaster Tycoon 3 for PC, and SimCity 4. These games taught me how to achieve the achieveable and get rewards for it by working with what I got in hand. That's open-ended for you. To me, it's more like building/simulation, where you interact with something, and get a reaction from it.

Now, with the strategy and building in hand, mashing the ingredients up, and we get WarCraft III: RoC. Here's where the magic comes around. As I'm playing real-time strategy games, I started to understand the meaning of formulating a plan from the start. What actions should I need to do in order to do something in the future? What do I need to build in order to survive? This course of action is what led me to like playing real-time strategy games, and also placed a seed in my mind.

-----------------------

Now, the magic is activating. The seed has grown in onto me, and I feel like I wanted to put in my passion for playing real-time strategy games into my creation. A dead creation, so to say.

Here's what I came up with while I'm starting to lose faith in mankind for not being able to provide useful feedback from my last experiment. I'll copy/paste them below:

1. Any ideas are sufficient, regardless of it being mediocre, lame, or awesome.
2. I have an RTS planned out. I only have this demo, along with the source code provided, completed. The goal is to make it as a game, according to test-driven development rules that were set before the beginning stages of programming.
3. Timeframe: 8 months or more. As much work I can get from my schedule while in the police force. Highly unlikely that I get at least 2 hours or more of work from this.


When I ask for ideas, I meant for people to think up of anything, any game themes, or any run-on sentences, such as "Once upon a time...", or "Look, there's something over there!", etc.

Rumaging through what I have in mind, a pixel-based RTS game, with no prior training in game A.I., and have conscription on my schedule, which cuts down so many hours of man-work on this hobby. I like to play building and simulating games, so I have "Buildings" and "Simulation" on my mind.

And then, boom! An idea came through to me, all by itself.

I now introduce to you a new game, in the next chapter.



------------------------------------------------------------------------------------------------------------------------

Chapter 6 - Pixavive Survival, Alpha version.

That's it, the game finally has an actual structure as a game, however small and feature-lacking it may be.

The first version, with the notice shown here, didn't have what I called it a "game." It didn't have a title, no options, no tutorials, or anything else other than the "core" of the game. What is the "core"?, you may ask. A game core is a minimalistic game, consists of nothing but the game. If you clicked on the link given above, download the ZIP file, extract the JAR file, and execute it, you will see what it means as a "game core." Programs like these are easily labeled as "demo," but I think differently. A "demo" is technically a program that "demonstrates" a technique others have made during the course of development.

Now, what's so special about this "first version" I have here? It's easy! For the first time, I have given life to a worthless application. I have given it something it can hold dearly on to, and that itself gives motivation and determination for the developer (which is me, of course!) to continue writing code for it. By writing more code to an already dead project, but with new vigor, that dead project is no longer dead. I've revived it!

That's it, the significance is that.

From here on out, I'll talk more about the technical details about this "game," and touch upon the shortcomings of this "game's" evolution.


----------------------------------------

To be continued...

----------------------------------------


Balking it up: Why I am doing this?

Posted by , 09 December 2013 - - - - - - · 1,404 views
balking
Chapter 3 - Questioning my demo.

Expecting some sort of ideas, guidelines, or tips for improving arbitrary concepts, instead, I get asked about why I'm using Java AWT and pixel manipulation techniques, and not graphics libraries, such as libgdx, jMonkeyEngine, etc. Good question, folks, good one. You can see the questions yourself: here, here, and here.

The answer to this question lies in the way I learn Java, the principles of my lessons. I learned Java in my sophomore years, all thanks to Minecraft. The forum I represent has a member who posted a thread about the game in 2010, which introduced me to the Classic multiplayer version (Minecraft Classic v0.30) on the Mojang website. It was there that I was in awe about the aspects of the game, and what it was made out of. The creator, Markus "notch" Persson, created the game out of Java.

Posted Image

Minecraft Classic v0.30, being classy.

At the time, I was adamant on using C++ to write up a game. I never learned how to use Java, other than the fact that it was too hard to use, and you have to memorize long names. Thinking back, the C++ standard libraries all have names that are too concise for me to comprehend. I was used to asking, "Hey, what's this 'ios'?", or "Hey, why are we using Hungarian notations?", but I digress from that.

After getting involved with the Minecraft community, I started to learn a bit more about Java. I also realized the appeal to using Java was the fact that its standard library is unified for multimedia. You have the audio library, image library, standard utilization library, graphics library, network library, window/container library, file saving/loading library, and more, all mashed up together in a neat way. Unlike the counter-part, C++, I have to find the libraries I wanted to use, learn the libraries' API and functions, and try to make sure I don't forget to organize which library does what. Even more painful to learn C++ is the usage of Win32 APIs, which I have to search high and low in the MSDN References.

It was when I was about to have enough of C++, I saw a thread about notch's Ludum Dare entry, Prelude of the Chambered. The biggest WTF moment was that it posted a Ustream livestream of notch programming the game. I sat there, with my midnight snack in hand, ramen noodles in the other, attentively at the screen, trying to understand WTF is going on.

You guys probably remembered that I used to post a thread in GameDev.net about livestreaming yourself writing code, and used notch as an example. Then rip-off would say something like, "Hm, I don't know who else would do this, but it seems interesting. You get to understand what the developer is trying to think, and you get to see the codes in action.", or maybe something like, "I don't know, this is rare." That guy, I have no idea what he would say about me if I mentioned him like this. Posted Image

Anyway, notch switched to Justin.tv, then switched to the gaming-community-friendly Twitch.tv. I followed his livestreams, got pissed that Ustream would not keep deleted accounts' old archived livestreams, and watched his archived livestreamed videos. It was then I started learning Java, besides having college courses that teaches me beginner's Java programming, that I was radically improving myself and inching closer to writing games. Actual games!

The first thing I watched was his Prelude of the Chambered archived livestream, where he uses ray casting techniques to create his engine. I followed along by writing/copying his code I saw in the livestream in Eclipse, and got amazed by it. I fuddled it around for a bit, before I got stuck on the part where he's starting to erect a wall of static white noise. In the livestream, the wall he created moved just fine along the x-axis and z-axis, but in my code, the wall moves at a slower pace than the rest of the objects, which causes a distortion. I just couldn't find a way how to fix the problem.

That put me off of following along with the livestream, as I'm unable to fix/debug the actual math problem, but from that experience, I learned how to write up a basic Game Component that runs a game loop of 60FPS per second, and pixel manipulation techniques.

Instead of continuing to study notch's livestreams, I tried learning more about pixel manipulation, and sought to improve/hone my Java coding skills by learning more classes and objects that were used in the livestreams. Then I went back for more notch's live programming sessions, and his another livestream, Minicraft. Writing RPG Java games is now more practical since the Minicraft engine is somewhat more closer to being an actual RPG engine than some mathematics library.

I felt that by investing in these livestream sessions, learning a language gets more fun, more practical, and more easier to learn, but that's just me. I speak for no one of this opinion, though. Thus answering the good question above, this is how I learned Java, and this is how I'm strictly following up by writing games with blocky graphics. I never learned how to use a Java graphics library, nor learned the basics of writing games. I just skipped ahead, all thanks to notch.

Livestream of notch coding Prelude of the Chambered, part 1, now on Youtube.
Twitch livestream of notch coding Prelude of the Chambered, continued.
Notch's past livestreams, some of which contained programming sessions.

Answering that good question is enough for me, on to the next chapter~~~~~!



Chapter 4 - Adding a new ability.

It started off with me playing around with the player unit, selecting it and moving it around while the enemy unit follows it uninterruptedly. Clearly, the player unit needs some sort of ability or power that can attack or fend off the enemy unit. I started visualizing what kind of attack the player should have, it could be catapulting something, shooting something, missiles, guns, bullets, force fields, etc. Ideas kept pouring in, and suddenly, I'm overwhelmed.

Ignoring the fact that I was questioned about my preferences and not the demo, I started to wondered about my "experiment." That "experiment" is that I'm unable to make others brainstorm concepts up for me, even without putting up an actual proof of concept in my demo. That thought is short-lived, as I began to start writing up a new ability, the Aeon of Strife area of effect attack. In other words, "A circle that expands from the player unit's position."

(And yes, I understand fully and completely about this in the comments section of my last entry. Please don't bring it up. Pretty please!)

So, I wrote it up. You can see the source code here, along with the instructions on how to play the demo.

Posted Image

Yes, the same old thing... But wait!

Posted Image

Posted Image

So, there you have it, a new ability.

I was quite happy with it, and uploaded the results to my project thread. I ended up with a serious discussion on how I'm writing messy code, how I'm ignoring optimizations, etc. http://public.gamedev5.net//public/style_emoticons/default/sad.png Damn, no crying emoticons.

-----------------------------------------------------------------------------------------------------------------

To be continued...

-----------------------------------------------------------------------------------------------------------------


The First Journey: I hate this so much...

Posted by , in Diary 01 December 2013 - - - - - - · 1,434 views
the, first
Chapter 1 - The Introduction I Disliked About.

This is the first part of the many infinite journal entries I'll be doing in the future. This is a diary, without written dates or manuscripts about identities in which they are not relevant to what I'm about to do and write, that only keeps log of my production and developments of game projects I had done since I graduated from college. How long I'll be doing this is not important, but it is what I'll be doing when I'm on my computer, and doing nothing but typing, typing, and more typing.

Many people are doing blogs to remind them of their past, their experiences, and their knowledge. That's a good thing, and I'm following along. Some day, I'll be able to explain to my superiors that I created this journal just for them to view/read, and probably leave out the details that follows during my interviews and such. This way, I can easily get a raise, surprise my bosses, get more money to pay off future expenses, etc. Oh, a man can dream, right?

This is the first entry, and the start of many frustrating moments where I just don't have the time to write this down or something. But I don't have anything else to do other than to waste my time, so why not start doing this? It's a thought worth pondering, I guess...

So, where should I start?

There was a time that I was working on an Android college project, but I felt like the whole project is forced upon me to complete. At the end, I do not like the way how it turns out, nor do I miss the project and its good times. There's probably none of it.

That leads me to think, what else can I start off? Oh I know, my current game development project, the so-called "Demo" game.

But before venturing into the realms of my Demo project, I must insist to you, that I write entries of this diary after I had completed a milestone. Note that milestones I had given to myself are, in reality, just simple goals that can be easily met if motivated long enough. If I don't reach the next milestone, I probably wouldn't be writing an entry here, would I? There's no point in remembering all the hardships and pain I have to endure when I'm stuck in a loop somewhere.

For future references, I can tell you that all my projects are hosted first-handedly at The Helper Forums. (Link here.) This is the place where I began my journey a long time ago, and it's now a part of me. If you wanted to look at my past projects, you may follow the link given above, and browse around, until you find me. You should be able to find all of my projects under my profile name, if there's nothing changed at the time of this piece being written down.

Now, let's delve ourselves in the road of my journey...

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Chapter 2 - My Current Game Project, The Demo.

Posted Image

Yeah, that's it. My project's first ever game logo. I love it. I may be going to hell for this, but who cares?

The very first development started off in a different direction. I'll be honest with you, I don't even know what I'm doing at the time. The demo consists of nothing but nothing. I'll quote what I said down below, so you don't have to leave the page just to read my old submissions.

First submission of the "Demo" game.

I would like to share something with you guys, so I can get some feedback on what directions I should go.

Here is a Java program consisting of a white box in a black background. You control a light pink square by left clicking to select it, and right clicking to move. A green square follows you where ever you go.

It's bland, it's not really much. But it's a concept I'm experimenting with during the little free time on my hands.


And here's what it looks like when you start the game:

Posted Image

At the time, I was playing around with how to select the unit by left-clicking using the mouse, and moving the unit by right-clicking using the mouse.

Posted Image

That's the gist of the demo. Practicing what I know is definitely fun to do, especially the logic behind all of this. Now the main problem I have yet to face lingers when I did this, and you readers probably already knew about this. Graphics. I couldn't for the life of me get to use good-looking artworks for the demo. The best I can do is to use pixel manipulation techniques to (lamely) achieve what I wanted to do. I don't know how, and reading some graphics books won't help you delve into this problem and work the solution out.

Maybe I should start asking people how to do this better in the future... Good plan, I suppose. Now comes my review of this demo, since you really don't think I'm just here showing off my demo just for nothing, right?

The flaws of this demo is that this "demo" is merely an application. An useless, bland, empty application that has no uses. To a newbie programmer, they probably don't even know what this demo is for really, even after all the introduction that said about this demo's purpose of life. The only action you're able to see is the green enemy unit chasing you forever until you quit the application. And while the enemy is chasing you, you couldn't bring yourself to stay attentive to the application, after all, this "demo" isn't really a "game."

And now, here's where the meaning of this journey becomes important to you readers. Do you now realize what problems my demo is having? It turns out that there are a lot of problems that I can easily explain it to you:
  • No motive to continue "playing" the demo.
  • No meaningful actions that give off incentives to keep the player glued to the screen.
  • No rewards. How can you win when the enemy unit is chasing you constantly with no consequences?
  • No story. Who is the enemy? Why is the enemy chasing you? What is with the non-working border surrounding both of the units?
  • No scenarios. What is the game plot? If there's no game plot, can a "user" make up one?
  • No feedback. No one wants to comment about a useless "application" that does nothing. Try giving some inputs yourself, I welcome anything from you.
And that's how, instead of receiving feedback about the demo and what else I can add to it, I get comments about my programming taste. It's just sad.

But one thing that led to another, I started to give new life to this demo. I can start telling you all about this exciting story, but I need to know if you can answer or complete these questions before moving on.
  • Can you come up with just one simple feedback, based on the first revision of this "demo" I have shown you?
  • If you were in my shoes, would you rather scrap this project and start over?
Post your answers in the comments below, and I'll gladly read them, even if you post your animadversions of me, my diary, and/or this demo.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

To be continued...







PARTNERS