Tom Krcha's FlashRealtime

Hey amigo!
I am Tom Krcha, Gaming Evangelist at Adobe. These are my notes


Age of Defenders: Post-apocalyptic tower defense game launched for tablets

November 7th, 2011

Age of Defenders is a tower defense game for browser (Win, Linux, Mac), iPad, Android and soon to be launched on BlackBerry PlayBook. The game is built with Flash and ported to tablets with Adobe AIR. It has practice mode and multiplayer mode via RTMP (via Flash Media Server) and RTMFP (P2P). Multiplayer is actually pretty unique as you can really play among different platforms, e.g. from Android to iPad or iPad vs. browser and so on.

Play online: http://ageofdefenders.com
Available in Apple App Store
Available in Android Market

Official trailer:

I had a chance to do a quick interview with Tomáš Botek (Head of development team, Age of Defenders):


Me: What is the main idea behind Age of Defenders?

Tomáš: We wanted to create a mix of tower defense and strategy games, where two people will play against each other, including attacking and other bit and bobs. Also, we wanted to create a web based game, which would be closer to serious gaming. And which could be played repeatedly, not just one time.

Me: Where can I get it or play it now?

Tomáš: The game can be played at www.ageofdefenders.com or can be downloaded from Android market and App Store. Also, it will shortly be available in App World. Age of Defenders runs on all tablets with the resolution of 1024×600 and up.

Me: How long have you been working on the original browser game and how big is the team?

Tomáš: We have started with a web version, which took us approximately 1 year. We are a team of 4 programmers and 3 designers. We have spent a lot of time thinking about the concept of the game.

Me: How many lines of code have you written for Age of Defenders?

Tomáš: Every single part of the game together, including the server-side code has around 110 000 lines of code. There are some libraries, which are not ours (e. g. pathfinding), but all of them are edited, so around 85% of the code is ours.

Me: Why have you chosen Flash/AIR for the development?

Tomáš: We liked the idea that you can play straight from the web browser, without having to download or install anything. That’s why using Flash was our first choice. Web-based gaming will change, will become something a lot more serious and we want to be part of this. Also the fact of building an app in Flash and porting it seamlessly to mobile devices with Adobe AIR later on, has proven how lucky choice it was.

Me: How long did it take to port it from iOS to Android with AIR?

Tomáš: When we had the first tablet version ready (iOS version), all we had to do for the other platforms was to work with the resolutions. The transition from the iOS to Android was very quick, took almost no time.


// Age of Defenders running on iPad, Sony S tablet, Sony P tablet, Windows and Samsung Galaxy Tab

Me: What are your next steps with the game and what features do you plan to add?

Tomáš: The game was just born and has got a long life ahead of it. We are creating a long-term profile with a history of matches, leveling up and match-making, so players who are at the same level could play against each other. We are working on different game modes and a lot more towers and units. At the same time a new singleplayer campaign is on its way, which will be very diverse and interesting. Currently, it is the most deprived part of the game, so we want to change it.

How To Rotate A Cube In 3D With Matrix

April 4th, 2011

Another simple trick to avoid locks when rotating objects in 3D.

Goal: rotate a cube in all axes and avoid axes to switch.

See the problem in a video:

1. Consider following scenario (WRONG):

Demo | Full source code

protected function init():void{
	box = new Box(200,200,200,2,2,2);
	box.setMaterialToAllFaces(new FillMaterial(0xFF0000,1,1));;
}
 
protected function onMouseMove(event:MouseEvent):void{
	if(!isDragging)
		return;
 
	var deltaX:int = lastX - event.stageX;
	var deltaY:int = lastY - event.stageY;
 
	lastX = event.stageX;
	lastY = event.stageY;
 
// IMPORTANT PART
	box.rotationZ += deltaX*Math.PI/180;
	box.rotationY += deltaY*Math.PI/180;
 
	camera.render();
}

When you use rotationZ and rotationY together you will find that by rotating the cube you switch axes and at the end you rotate different axes than you wanted at the beginning.

2. Solution: rotate with Matrix

Demo | Full source code

protected function init():void{
	box = new Box(200,200,200,2,2,2);
	box.setMaterialToAllFaces(new FillMaterial(0xFF0000,1,1));;
}
 
protected function onMouseMove(event:MouseEvent):void{
	if(!isDragging)
		return;
 
	var deltaX:int = lastX - event.stageX;
	var deltaY:int = lastY - event.stageY;
 
	lastX = event.stageX;
	lastY = event.stageY;
 
// IMPORTANT PART
	var matrix:Matrix3D = box.matrix;
 
	matrix.appendRotation(deltaX,new Vector3D(0,0,1));
	matrix.appendRotation(-deltaY,new Vector3D(1,0,0));
 
	box.matrix = matrix;
 
	camera.render();
}

See correct version - rotating a cube with:

Also if you have a different solution - don’t hesitate to share it. I am pretty sure, there are more ways to do this.

Local Flash Peer-to-Peer Communication over LAN (without Cirrus/Stratus)

August 27th, 2010

native-ip-multicast-small Some of you guys were probably wondering how to establish P2P connections in the local network (LAN) without Adobe Cirrus. Yes. It’s possible. Using native IP-only multicast. Let’s build a simple chat with Posting. Adding Multicast broadcast is just a simple next step which I am sure you can accomplish by yourself with few hints from my article about Multicast

Open an IP Multicast connection. This can be done by specifying connection string as “rtmpf:”. Note, that this technique cannot be used for one-to-one communication. So no DIRECT_CONNECTIONS with NetStream, but you can do all RTMFP Group operations.

netConnection.connect("rtmfp:");

Read the rest of this entry »

Flash Summer Webinars This Week

August 22nd, 2010

Make sure you don’t miss following webinars this week prepared by Adobe Platform Evangelists. All of them will be live online using Screen Sharing technology via Adobe Connect Pro.

Especially if you are regular reader of my blog and interested in P2P, don’t miss Advanced P2P Programming on Friday - it will be summary of all my recent articles.

This week:

Next week:

Register for free.

Video-on-Demand over P2P in Flash Player 10.1 with Object Replication

July 28th, 2010

In the previous tutorial File Sharing over P2P in Flash Player 10.1 with Object Replication we went through the Object Replication basics. And you can see that the Receiver is requesting packets one by one. That’s not suitable for the real world app, but it’s good for testing on a LAN to see the progress. In the real world app, you can immediately request all packets using NetGroup.addWantObjects(beginIndex, endIndex);.

Transferring VoD video over P2P

Let’s get something real with Object Replication. The use-case I like most is a Realtime P2P Distributed System for Video-on-Demand.
Video-on-Demand P2P Object Replication Scheme
Read the rest of this entry »