FLASWF Moved Back to Blogger!

This blog moved back to blogger,

Please visit me here:

Bruce-Lab.blogspot.com

Posted in 未分类 | Leave a comment

写在《Flash ActionScript 3.0 动画高级教程》中文版出版之前

回到几年前,当大多数的flasher们还挥舞着鼠标,奋斗在时间轴和关键帧上时,Keith Peters 就开始把flash当成一个编程工具来使用了。ActionScript从简单的脚本代码发展到今天这样一种强大的面向对象程序语言,与Keith Peters这样的先驱们的努力是分不开的。是鼠标,还是键盘?曾经是一个令我犹豫问题,直到有幸读到Keith Peters等人的书,才发现原来艺术可以如此程序,程序也竟然可以如此艺术。

 

如果把《Flash ActionScript动画教程》比为通往一个美丽的新世界的一扇门,那么这本《Flash ActionScript 3.0 动画高级教程》则可以说是指向这个新世界的最高峰的一座路标。读Keith Peters的书学到的不仅是ActionScript的编程技巧,还有设计动画所需要的各种数学、物理的知识,而这些东西正是大多数flasher所欠缺但又难以在其他同类的书籍中找到的。

 

这本《Flash ActionScript 3.0 动画高级教程》给我们带来的是前一本书《Flash ActionScript动画教程》中没有涉及或没有能够详细展开论述的技巧,这些技巧在Flash动画、游戏制作中稍微复杂但更加实用。

 

第一章的高级碰撞检测技术几乎是每个flash游戏都需要的技巧,是游戏中所展现出的各种物理特性的基础。基于位图和基于网格的碰撞检查很好地解决了不规则形状对象的碰撞测试和大量对象的碰撞测试的效率问题。这些在实践中发展并成熟起来的技巧的原理和应用在书中给出了深入浅出的讲解。

 

第七章简单介绍了flash10最令人激动的新特性之一3DKeith Peters从最简单的三维基本概念讲起,循序渐进,再到三维坐标,旋转深度排序、三维变换,通过一个个具有代表性的程序实例,能让你很快地熟悉并掌握这些新3D功能的使用。

 

每种技巧,Keith Peters都尽量用朴素的语言,描述其中的原理,力求使读者真正地理解这些问题的解决方法,体会到其中的奥妙。书中给出了大量程序源码,作为应用实例来帮助理解概念,同时也展示了如何将各种方法用代码实现。Keith Peters不愧是一个顶尖的flash玩家,代码本身也如同其实验作品一样完美,那些清晰、简洁的代码在程序员眼中就犹如优美的诗句,阅读这样的书简直是一种享受。

 

Keith Peters的书并非各种技巧、知识的堆积和罗列,而是对这些技巧、知识的解读和总结。

这些内容并非完全由Keith Peters所创造,而是凝聚了各种flash社区集体智慧。Keith一方面作为一个充满激情阐释者,将这些有用的技巧和自己的理解与心得分享给大家,另一方面作为一个虔诚的传道者,努力地将flash作为一种信仰传播开来,发扬光大。

 

一名闪客的高度,不在于他有多么深厚的美术功底,不在于他有多么高深的编程技巧,也不在于他掌握了多么复杂的数学物理知识,而在于他是否能把flash当作一种信仰,这是一种精神的高度,也正是这么一种精神的高度成就了Keith Peters这么一个活跃在flash中长达十年之久的大师级闪客。Keith Peters的书,使我感受到的不仅是大师的经验和才智,更多的是一个flash信徒对flash发自内心的热爱。

 

我们应该感激图灵图书将这本flash大作翻译引进国内,这对国内的flasher们来说是一大福音。希望更多的flasher在这本书的帮助下,能够更快的成长,更深刻地理解flash这一技术与艺术的完美结晶!

Posted in 未分类 | Leave a comment

A simple tutorial for using Alchemy Quake Engine to create your own FPS game!

 a-custom-quake-map-in-flasha-custom-quake-map-in-flash

           (custom quake maps in flash)

 

PART 1 COMPILE THE SOURCE

 

 

1. Get the source code at http://github.com/mkr3142/QuakeFlash

using git and

 

2. Install alchemy.

If you don't know how to do that (step 1&2) check this tutorial (I wrote for alchemy doom).

 

3. Compile the source to a swc

Copy the source folder to “F:\alchemy\” (suppose you install alchemy into this folder)

First you need a simple modification of the C source of wiquak in the source folder “D:\alchemy\QuakeFlash\WinQuake”:

Open the file “common.c” by any text editor, find this line (by searching key words such as “use modified games”)

” Sys_Error ("You must have the registered version to use modified games");”

Just remove or add”//” before (commentize) that line.

registered_remove

This is important if you want to use the engine to run your mods or total conversions, that line will check if the game data “PAK0.pak” is original (not modified), and won’t let the game run if not.

 

Now let’s build the C source to a swc: (you may want to read "readme_QuakeFlash.txt" in your downloaded source folder first)

Run Cygwin go to the “F:\alchemy\QuakeFlash\quakeswf” folder and compile the source:

cd F:

cd alchemy/QuakeFlash/quakeswf

source /cygdrive/f/alchemy/alchemy-setup

alc-on

make -f makeswc

  flashquake1

 quakeflash

When it's done, check that "quake.swc” was created in “F:\alchemy\QuakeFlash\lib

(if not, go to “F:\alchemy\QuakeFlash\quakeswf\Release”, copy "quake.swc " to “F:\alchemy\QuakeFlash\lib”)

 

4. get the game data PAK0.pak

Download the original quake game demo(DOS) from  http://www.idsoftware.com/games/quake/quake/,

you will get the file “quake106.zip”, unzip it and run “install.bat”,

go to the folder you installed your game such as "C:\QUAKE_SW",

copy the "PAK0.PAK" form "C:\QUAKE_SW\ID1" to

F:\alchemy\QuakeFlash\quakeswf\embed

 

5. compile the swf

Open the FlashDevelop project file “QuakeFlash.as3proj” in"F:\alchemy\QuakeFlash\quakeswf",

build the project you will get the “QuakeFlash.swf” in “F:\alchemy\QuakeFlash\quakeswf\bin”.

Run it, it will play the demos, press space key->NEW GAME, you can play the game now!

 

 

PART 2 MODS and TOTAL CONVERSIONS

 

 

1. choose one of your favorite quake editors

There’re lots of free & open source game editors for quake1.

Some of which I know are quark (quark.sourceforge.net, powerful for making total conversions, can create & modify maps, models, textures and sounds…), bspquakeeditor (www.bspquakeeditor.com) and quakeED (http://www.celephais.net/board/view_thread.php?id=60225&end=25unzip and put it in “C:\games\quake\tools”, you need to create that folder by yourself.) for levels (new maps), a light and useful tool PakExplorer(for create & modify PAK0.PAK, quark has a build in Pak Explorer too.).

 

2. I prefer quark, just learn how to use it to create & modify PAK0.Pak 

 quark_pakquark_mapqurk_model

to make your mods and TCs. There are docs and video tutorials online (quark.sourceforge.net) to help you.

 

P.S.For bspquakeeditor quakeED, the default quake level format is *.map, you need to compile the *.map to *.bsp (both editor can do that).

 quakeedbsp

 

3. A quick start – test your first quake mod level in flash:

You created/downloaded a level and want to test it in the flash.

Use PakExplorer open PAK0.PAK, import (drag and drop) *.bsp into maps folder of PAK0.Pak, delete e1m1.bsp, rename your *.bsp to e1m1.bsp, save and recompile the flashproject. The first level of the game will be yours.

If you download a mod’s PAK0.PAK (here are some:http://www.quaketerminus.com), just open it and the original PAK0.PAK by PakExplorer, right click and copy any *.bsp from MOD.PAK’s map folder and paste it in the original one’s map folder, delete or rename “e1m1.bsp”, rename the mod’s .bsp to “e1m1.bsp”, save the PAK file, rebuilt the swf and the first level will be changed.

 

P.S.a tip for moders: compile the swf everytime when you want to test your level is

time consuming, because the “Main.as” embed the “PAK0.PAK” file to get a standalone swf, modify Main.as, use Loader, let it load the "PAK0.PAK",

so you won’t need to recompile the swf any more whenever you change the

PAK0.PAK”, (if you’re not clear of what I mean or how to do that, mail me or leave a comment.)

 

copy

deletee1m1

A free (GPL) game data (PAK file) for quake1 is here: http://openquartz.sourceforge.net/index.html

download Game data in binary format, use PakExplorer open pak0~3.pak, copy all files in pak1~3.pak into pak0.pak, repalce what's in F:\alchemy\QuakeFlash\quakeswf\embed with"config.cfg" of openquartz and the newly created pak0.pak, compile the project, you will get something like this:

http://www.quake-1.com/docs/flashquake/OpenQuartz.swf

LINKS:

1. quake1 mods and tools: http://www.quaketerminus.com

2. free web client version of Quake: www.quakelive.com

3. Quake 2 for Papervision3D:http://code.google.com/p/paperquake2/

4. Flash quake/descent style renderer: http://board.flashkit.com/board/showthread.php?t=749263

    source: http://esl.eng.ohio-state.edu/~rac/hobby.html

5. Quake 2’s Maps in Flash 10: http://blog.promethe.net/2009/10/01/load-and-display-quake-2s-maps-in-flash-10/

6. alternativa 3d quake: http://makc.googlecode.com/svn/trunk/flash/alternativa3d_quake/quake.swf

 

Posted in 未分类 | Tagged , | Leave a comment

Quake in flash using alchemy, source and swf available online now!

Thanks to Michael Rennie,

Play the game online: http://www.silvergames.com/game/quake-flash/

Source Code: http://github.com/mkr3142/QuakeFlash

Great news!

Cheers!

Posted in 未分类 | Tagged , , , | Leave a comment

Build your doom in flash step by step - Instructions for compile alchemy doom

It is when I found this game I began to believe how useful adobe alchemy will be.

Finally, the classical doom was ported into flash player as an playable game!

Thanks to adobe alchemy and Mike(http://mike.newgrounds.com/), who made it and shared the source!

I am not an expert on doom , alchemy or even flash but I feel glad to share what I know about this project with those who like doom and flash.

This simple tutorial is the first step to build your doom in flash using Mike’s source, hope it can help. 

 

 PART 1 - COMPILE THE SOURCE

 

1.  get the souce code

(1) simplely download this packge:

http://flaswf.googlecode.com/files/alchemy_linuxdoom-1.10_by_Mike.zip

(include Mike’s source(mybe outdated, try (2) to get the latest source) and my flashdevelop project file,

just open "my doom project.as3proj"(alchemy_linuxdoom-1.10\my doom project\.) and build it you will get the "doom.swf"(\bin\.).

no pre-loader in this package, if you want that, go to the project home or make your own.)

(2) gip http://github.com/Herschel/flash-doom/tree/master

1.download this sofeware Git-1.6.4-preview20090730.exe from

http://code.google.com/p/msysgit/downloads/list

install and run "Git bash":

git clone git://github.com/Herschel/flash-doom.git

 git0

when done go to

"C:\Documents and Settings\user\flash-doom" and find your source.

 you can also download raw file directly one by one

(http://github.com/Herschel/flash-doom/blob/7fa25473c3285d3258d27818ec06d1ebc2fb87ed/src/as3/DoomGame.as

-click raw on the right of the title)

 

2. install alchemy

follow the instructions:

http://labs.adobe.com/wiki/index.php/Alchemy :D ocumentation:Getting_Started

P.S. you should install "make(Devel ) packages" when installing Cygwin.

 

3. compile the source code

Download the source files and copy them to D:\alchemy\(supposed you install alchemy into this folder)

Run Cygwin go to the alchemy_linuxdoom-1.10 folder and compile the source:

cd D:

cd alchemy/alchemy_linuxdoom-1.10)

source /cygdrive/d/alchemy/alchemy-setup

alc-on

make

cygwin_setup_make

It will take some time to finish compiling all c source files into a swc.

When you see this:

make_incomplete

You can find lots of .o file in your swc folder, compilation is almost done,

it will now pause for a while, and then build all .o file into a swc:

make_done

When it is done, go to "swc" folder and copy the generated "doom.swc" to your project folder.

 

4.create your flashdevelop project

Create an flashdevelop project:

flashdevelop_project

Copy "DoomGame.as" into "D:\alchemy\alchemy_linuxdoom-1.10\my build\src"

and "doom1.wad" into "D:\alchemy\alchemy_linuxdoom-1.10\my build\lib"

add the swc asset:

addswc

DoomGame.as - (right click) always compile

Properties - Output - platform target - flash player 10

project

Build your project now!

Finally find your "doom.swf" in bin folder

and Run it, Press space key - new game...

 

PART 2 - CREATE YOUR FLASH FPS GAME POWERED BY ALCHEMY DOOM ENGINE

 

1.create/add new levels – doom builder

http://www.doombuilder.com/

Doom Builder.exe-file-open map/new map-"doom1.wad"

Game Configuration-Doom

Add resourc-From WAD File-doom1.wad–ok

db0

db1

Now you need to learn how to use this software to make new levels by yourself.

When done:File-save map into-choose your wad.

 

2.make total conversations - XWE

http://www.doomworld.com/xwe/

Xwe.exe-file open-"doom1.wad"

 xwe0

Play with this powerful editor, you can create a totally different  game!

Don't forget to replace the original "doom1.wad" with the new edited one when rebuilt your game!

 

Links:

1.some doom ports:

http://www.doomworld.com/classicdoom/ports/

2.the doom game:

http://www.idsoftware.com/games/doom/doom-final/

3.doomonline-A port of Doom for Flash by Max Herkender:

http://code.google.com/p/doomedonline/

http://blog.brokenfunction.com/2007/07/20/flash-plays-doom/

4.Ryan A. Chilton’s Flash doom & quake:

http://esl.eng.ohio-state.edu/~rac/hobby.html

5.doom 2d flash:

http://www.codinsoft.de/doom2d.html

6.game-Doom Triple Pack (Doom, Heretic, and Hexen):

http://www.newgrounds.com/portal/view/470460

 

Any question or problem please feel free to drop your comment!

Posted in 未分类 | Tagged , | 3 Comments

Adobe Alchemy Ray Caster Test

Interested in ray casting, I once wanted to port this C++ code to as3.
Don't have much time for that and have little faith in as3's speed, I haven't done that yet.

Then I knew adobe alchemy, played Mike's Doom port and decided to have a try using Alchemy.

A Wolfenstein 3D is to complicated for me but this simple code is just fine. Not used to C/C++ programing any more, I got lots and lots of
warnings when compiling my swc. Luckily, it works in the end.
I first tried no textures, then one texture and finally full textures.

The swf looks all right but it is a mess behind what you see. Lots of work need to be done with the source code.

DEMO:http://flaswf.googlecode.com/files/Alchemy_RayCaster_DEMO.swf

arcnotexarc1tex

arc_1arc_2

Besides this simple test, I also played with a voxel terrain engine (as3 port by me available here) and other old school effects using Alchemy.

voxelnioisetunnel

Posted in 未分类 | Tagged , | Leave a comment

Ray Casting in Flash

Ray casting is a technology used in many old ‘3D’ games such as Wolfenstein 3DDOOM. Game engine use ray casting is also called a 2.5 D engine. The limitation of a simple ray casting engine in Wolfenstein 3D is that you can't look up or down – you can’t rotate X axis. Ray casting is fast and simple so before flash 10 which supports 3d, many people used this technology to make some 3D effect. Ray casting can easily create a maze-like world of walls. You can render terrains, too. Terrain rendering is much different from walls, it is also called voxel rendering.

Here are some information about voxel terrains and volume rendering:

http://bruce-lab.blogspot.com/2009/01/terrain-rendering-in-flash.html

Ray casting is different from mode7, mode7 is much more simple,  good at rendering floors or grounds, but can’t do with walls.

I collected some good examples of flash based ray casting:

1.Wolfenstein 3D flash ported by Glen Rhodes

Flash ray engine

http://www.glenrhodes.com/wolf/

 

 2. Andre Michelle’s ray caster(source available)

(1)AS3 version

http://lab.andre-michelle.com/raycaster-v3

(2)old as2 version

http://recycle.andre-michelle.com/as2/packages.zip 

You can find the source in ‘fla/examples/pro/raycasting’

 

 3.fast ray casting engine

http://gimme.badsectoracula.com/rayfaster/

 

4. half baked ray casting (source available)

very powerful but use c processor.

Demo:http://hbrc.sourceforge.net/

Source:http://sourceforge.net/projects/hbrc

 

 5.Pixel raycasting engine (source available)

http://www.digital-ist-besser.de/tryouts/raycasting_pixelbased/ (Broken link)

as3 source

 

6.http://www.furi.dk/raycaster/

 

7. Strille’s ray caster(flash5)(source available)

http://www.strille.net/works/raycasting_v2.swf

http://www.strille.net/works/raycasting.swf (source available at flashkit)

 

 8.Frédéric Heintz, aka FredH’s flash maze(source available)

http://www.fredheintz.com/sitefred/flash/maze/maze.html

Find the flash8 source at http://www.fredheintz.com

This one also has a simple editor.

 

 

9. doomedonline(source available)

A port of Doom for Flash by Max Herkender

http://code.google.com/p/doomedonline/

http://blog.brokenfunction.com/2007/07/20/flash-plays-doom/

 

 10. Ryan A. Chilton’s Flash doom & quake(source available)

http://esl.eng.ohio-state.edu/~rac/hobby.html

 

11.Another simple as3 raycaster

http://www.signalsondisplay.com/blog/wp-content/uploads/as3/raycaster/Raycaster.html

 

12.http://peaceoutside.org/3d.php

 

13.ericlin’s 3d maze(source available)

http://ericlin2.tripod.com/f3d/maze3d5.html

http://www.gotoandplay.it/_articles/2004/07/el_maze3d.php

This one is not ray casting. It skews movieclips to create a perspective wall effect which is similar to raycasting.

====================

TUTORIALS

1. F. Permadi’s Ray-Casting Tutorial

http://www.permadi.com/tutorial/raycast/

java source:http://www.permadi.com/java/rayc/Rayc.java

2. Lode's Computer Graphics Tutorial-Raycasting (c++ source available)

http://www.student.kuleuven.be/~m0216922/CG/raycasting.html

3.Another Raycasting Engine Tutorial

http://www.iirc.net/petes/

====================

LINKS

1. id Software’s Wolfenstein3D source code

Find it here:ftp://ftp.idsoftware.com/idstuff/

2. A fast java raycaster like doom or wolfenstein 3D (source available)

http://www.shinelife.co.uk/java-maze/

3. Wolfenstein 3D  in 20 lines of JavaScript by Mathieu 'p01' Henri (source available)http://www.p01.org/releases/20_lines_Castle_Wolfenstein/

4. JavaScript ray caster by Ben Joffe(source available)

http://www.benjoffe.com/code/demos/canvascape/textures

5.Flash AS3 Ray Casting Tutorial with example and source

http://www.rustyarcade.com/blog/read/33/Ray-Casting-Tutorial

=============================================

UPDATE(2009-12-4)

rayfaster 2 test:

http://www.badsectoracula.com/peponi/rayfaster2/

Posted in 未分类 | Tagged | 1 Comment

terrain rendering in flash(draft)

back later...
I do like playing with terrains.
Generally there are two ways of rendering terrains or landscapes, the first one is called voxel, the second one is using 3D triangles.
There are difference between the two ways, both in theory and the result.
Many flashers did some very impressive experiments about terrains by action script.
1.A great one was Electric Oyster 's flash flight simulator over the arctic.
The swf is based on their own 3D engine-Electric 3D engine using tiangles way to render the terrain.
Great texture and rendering speed!

P.S.Anyone who want an standalone (off-line) vision,just go to your Temporary Internet Files’ folder,copy the files ‘Main.swf’and‘data_lq.bin’ out, save them where you want.(don’t change the name of the second one,keep it ‘data_lq.bin’)-play ‘Main.swf
for full screen version it will be 'data_hq.bin'
you may need to take care of flash player's security problems.
2. away 3D greenpalnt demo
http://www.closier.nl/playground/greenplanet.htmlmuch more than just landscape, very impressive!
3. Den Ivanov did lots of beautiful experiment on terrain.
The most famous one is his land craft simulator in flash 8.
http://lab.parkstudio.ru/terra/
He also did other simple voxel terrain with source their
Check:

MusicScape: http://www.cleoag.ru/2007/03/29/musicscape/

But PaperTerrain :http://www.cleoag.ru/2007/03/31/sources-for-papervision3d-terrain/is using another approach papervision 3D
And triangles.(with source)

(sorry, can't find the original link...)

We can easily see the difference of final result:
Voxel is much more month, on the other hand you can recognize the triangles
4.SWFZ TerrainLoadingTest http://www.swfzlab.com/swfz/terrain/TerrainLoadingTest.swf

Based on Joho’s powerful flash 3D engine.
5.Unit Zero One 3d voxel landscapes http://www.unitzeroone.com/blog/2006/10/03/flash-9-example-3d-landscapes-voxel-engine/

6.isaac 's flash voxel engine:

voxel land(with source)

9.Kris Temmerman's Generated Landscape

10.Mike Johnson Flash 8 : Perlin Noise Landscaping(with source) http://mx.coldstorageonline.com/index.php?bid=42

11.http://www.polyaktiv.de/neu/swf/virtuallc.htm

http://www.polyaktiv.de/neu/swf/landscape2.htm

12.3D slice mountain

http://www.arseiam.com/fx/54.php


http://psyark.jp/archive/2006/07/19/sunkenworld.swf

15.iso terrain

17.http://antonvolkov.com/flash/land3d/
This one shows how triangle works.

18.perlin terrain 3d study 1&2


19.mrdoob's

Terrain Raycaster
Desert Generator
Cube world

21.joa-ebert's AS3 VoxelEngine

24.http://chrisbenjaminsen.com/show/mapdraw.swf

25.flashkit post -Pseudo 3d with bitmap as displacement for y-axis
http://board.flashkit.com/board/showthread.php?t=747849
slight's SaphuA's Space
all source can be found here: http://www.25lines.com/
2009-January 25 lines contest: Entry-008
Petri Leskinen's flight 25

http://www.25lines.com/finalists/0901/008.txt (source)http://www.25lines.com/finalists/0901/008.swf
2008-November / December 25 lines contest: Entry-068
oaxoa's voxel terrain
2008-November / December 25 lines contest: Entry-005

Paulo Afonso's DYNAMIC TERRAIN
2008-November / December 25 lines contest: Entry-027
Piergiorgio Niero's Random Terrain 3D Generator
2008-November / December 25 lines contest: Entry-064
Daniil Tutubalin's Bottle Glass Mountains(in Finalists)

27.bit-101's terrain

Spider Defense:

terrain 2d:

lots of linescapes there!

http://www.artfromcode.com/?cat=6
28.Andre Michelle's mode7 terrain:
Tutorials:
1.Perlin Noise and Dynamic Terrain Generation
LINKS:
1.Generating Random Fractal Terrain
http://gameprogrammer.com/fractal.html
2. Voxel terrain engine(tutorial with c++ source)
MEMO:
My work 1 pixel style
2triangle perlin/3/color
Zground 3d slic/zground traingle
Voxel terrain

http://m-design.bg/terrain/ ?
UPDATA============================================UPDATA

 

 

UPDATA============================================UPDATA
AS3 Landscape generator (source)
using perlinNoise and paletteMap to create 2d landscape(texture)
AS3 Draw Landscape  (source)
Ariel Nehmad's  GNA - FLASH 3D ENGINE ironman game
Posted in 未分类 | Tagged | Leave a comment

Yo2优博网WordPress博客服务

欢迎使用 Yo2.cn 优博网提供的 WordPress 博客服务。

我们为此提供不限制流量和空间大小的博客服务,和 yo2sns 博客社区服务

Posted in 未分类 | 1 Comment

Image Binarization and Edge Tracing in Flash

Image binarization and edge tracing are some old school image technologies.

Just played with them in as3 when I was trying to create a cartoon filter for flash.
Those techs are pixel level transformations, get/setPixel and get/setPixel32 can do that job,
it works slow, though.
The result,

original image:

Binarized image:
Edge:

Nothing new here. But if you need it, here are the codes:

================================================

UPDATA 2009_7_09

another cartoon filter (version B) using Image binarization and edge tracing:

original image:

 result:

source file:http://flaswf.googlecode.com/files/CartoonFilter_B.as

Posted in 未分类 | Tagged , , | Leave a comment