1 / 44

Cool Things in Small Spaces

Cool Things in Small Spaces. The Art and Science of Intros and Bytetros. Who am I?. I am “Polaris”, the founder of the Northern Dragons Demo Group. http://www.northerndragons.ca

scott
Download Presentation

Cool Things in Small Spaces

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cool Things in Small Spaces The Art and Science of Intros and Bytetros

  2. Who am I? • I am “Polaris”, the founder of the Northern Dragons Demo Group. http://www.northerndragons.ca • I am also an active coder for the Northern Dragons and have written code for several 4kb productions. The most recent* being “4kb Evolutio” released at Assembly 2004. • Yes, you can contact me – just email me! polaris@northerndragons.ca

  3. What are we supposed to talk about? • Showcase some example intro’s and bytetros. • Highlight what’s special about intros compared to demos and their role in the demo scene. • Tell some Tales from the field: • Design advice • Code techniques - specific to Windows 32 • Your requests, and questions are important! • There is a 15 minute period for questions at the end, but do ask questions during the presentation too!

  4. What am I not talking about? • Intro’s larger than 16kb, in terms of techniques. (64kb’s are quite different) • How to use any particular intro creation tools [such as .werkkzeug1] • Things outside of the win32 platform. (Outside my realm of expertise) • API “wars”. (For example: OpenGL vrs Direct 3D)

  5. What do you want me to talk about? • The seminar is “in a Power Point can”, but I’m flexible! • Room Survey: (show hands) • How many people are here are active in the demo scene? • How many people are actively writing productions? • What roles? (Coder?) (Musician?) (Artist?) • What platform? (Win32? Linux? Other?) • Does anyone have specific things in mind they want answered during the presentation?

  6. What are Intros? • The first intros were “cracktros”. These programs are graphical “brag tags”, that appeared at the start of a cracked games. These gave greetings to other crackers, and displayed the credits of the crack authors using pseudonyms. • Eventually, people started making little graphical programs for fun, instead of just in cracks. This gave birth the demo scene in general. Demos are real-time computer productions of a larger size (typically MB now), where as intro’s are limited size.

  7. Why make them? • Intros explore the technical edge of what’s possible in a small space, as well as exploring real-time art. • Each one is a personal brag tag saying “look what we can do”! • Every intro is really an experiment showing “apparently this is possible in xxxx bytes” [whatever the size is]. • Still, some intros have more “spirit” and design than others.

  8. King of the Kings – Demo Parties • Demos and intros are often shown at parties, Compos (competitions)… where they compete for the audience favor [and prizes]. • Pilgrimage is one of many events where compos are held. • Competitions help “spur” intro creators on, to out do each other. • There will probably be some intros released at Pilgrimage ;-)

  9. What does a small intro look like? • Let’s watch some samples. • The following samples just a few I have chosen, so be sure to check out demo scene sites for more: • www.pouet.net • www.scene.org • www.256b.com • These productions have been released at demo parties, so please rank your favorites as you watch. We’ll compare your ranking to the party ranking after.

  10. 4KB Intro Viewing Order • 1. San Angeles Observation • http://www.pouet.net/prod.php?which=13020 • 2. Smells Like Fish • http://www.pouet.net/prod.php?which=13075 • 3. Evolutio • http://www.pouet.net/prod.php?which=13073 • 4. 99 Beers • http://www.pouet.net/prod.php?which=10564 • 5. The Etherium • http://www.pouet.net/prod.php?which=10569

  11. 256 Bytetro Viewing Order • Dropz • http://www.pouet.net/prod.php?which=4015 • Tube • http://www.pouet.net/prod.php?which=3397

  12. Lets Watch!

  13. San Angeles Observation by Armada & Trauma • Release date : August 2004 • Party : Assembly 2004 • Ranked : 1st

  14. Smells Like Fish by Axes Denied • Release date : August 2004 • Party : Assembly 2004 • Ranked : 8th

  15. Evolutio by the Northern Dragons • Release date : August 2004 • Party : Assembly 2004 • Ranked : 4th

  16. 99 beers by Siffo • Release date : August 2003 • Party : Assembly 2003 • Ranked : 9th

  17. The Etherium by The Northern Dragons • Release date : August 2003 • Party : Assembly 2003 • Ranked : 14th

  18. Dropz by Baze / 3SC • Release date : 1998 • Party : Demo Bit 1998 • Ranked : 1st

  19. Tubes by 3SC • Release date : August 2001 • Party : Syndeecate 2001 • Ranked : 1st

  20. Surprised by the Rankings? • Intros have evolved from just pushing technical limits, to having a sense of “design”, and appealing to the audience. • The importance of “Design” is discussed well in “Tips for Demomakers”: • http://www.theparty.dk/pages/scene/tips_for_demomakers_a_story_to_tell.html • Also check out the 4KB intro compo studio from assembly for some discussion about design. • ftp://ftp.scene.org/pub/parties/2004/assembly04/assemblytv/4k_intro_compostudio.avi&id=250850

  21. So you want to create an intro? (Technical Notes) • Intros typically feature real-time music and graphical effects. • Because of the small space, data isn’t typically stored. Instead algorithms that generate the data have to be used. • The most important thing about writing an intro isn’t the platform, or coder tricks. It’s about the algorithms in the first place.

  22. A simple example texture • The texture on the right is 256x256, with 0-255 in colour [grey scale]. • Even as a .jpg [with compression] it takes a total of 6KB to store. This is larger than many intro’s!

  23. Using algorithms (Example) • To generate our texture, we instead need to use an algorithm. This un-optimized algorithm generates this texture: for(y=0;y < 256;y++) { for(x=0;x < 256; x++) { // the algo height_value=(1-(sqrt(((x-128)*(x-128))+((y-128)*(y-128)))/128))*255; } } • Note – even without code size optimizations, it takes no more than 200 bytes in a basic C compiler – a savings of over 15 Times! • This is only a small example – you need to think algorithmically about, textures, geometry, music, and code!

  24. Programming Tools • Once you start thinking algorithmically, it becomes time to code. • Your intro or bytetro will eventually become an executable program, running on a pc. • This usually involves an assembler or compiler of some type, to generate the binary code executed. For many this is assembly…. but….

  25. Language Examples • Java. Yes it’s possible! [Jar file with J3D] • Material Demo - 2,078 bytes • Turbo Pascal • Gargaj/Ümlaüt Design – Hugi 22 • http://www.hugi.scene.org/main.php?page=hugi22 • Delphi • Migeel – Hugi 28 • http://www.hugi.scene.org/main.php?page=hugi28

  26. Language Examples • C/C++ • Kwak by Calodox, 7th place Assembly 2002 • http://www.pouet.net/prod.php?which=7105 • Evolutio by Northern Dragons, 4th Place Assembly 2002 • http://www.pouet.net/prod.php?which=13073 • Assembly Language: • The Etherium (NASM) • http://www.pouet.net/prod.php?which=10569 • Trees (MASM) • http://www.pouet.net/prod.php?which=9311 • Others • Of course…. Use your imagination!

  27. Pushing the technical limits • The first stage is to push the limit of the algorithm. • The second stage is to push the limit of the Language selection. (A compiler or assembler) • While many avoid Assembly language, it gives you the most options and flexibility to “push limits”. This may involve using features in ways they weren’t first designed. It isn’t the only option however! • The third stage is to push the limit of the operating system itself. This deals with OS limitations, or what a “executable” file is on that Operating system.

  28. Second Stage: Specific to C/C++ • The largest changes possible relate to setting your compiler options, and how you code in your C/C++ compiler. • Take the following example: #include <windows.h> __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {MessageBox(0,“Silly example",“test!",MB_OK);return 0; } • This example, when compiled with “default” VC++ 6.0 options results in a 24 KB EXE! 

  29. Tweaking VC++ • The same program, altered just a little bit…. Becomes 1KB in size! #pragma comment(linker,"/ENTRY:main")#pragma comment(linker,"/MERGE:.rdata=.data")#pragma comment(linker,"/MERGE:.text=.data")#pragma comment(linker,"/IGNORE:4078")#pragma comment(linker,"/OPT:NOWIN98")#include <windows.h>void main(){MessageBox(0,"test","test",MB_OK);}

  30. What happened? • It’s the same program, but we’ve changed the compiler options, cutting out the “fluff” that the compiler includes by default. These include: • Microsoft Visual C++ Runtime Library • 4kb section alignment [not required] • Merged sections in the exe: • .text (default code section), • .rdata (default read-only data section) • .data (initial data section)

  31. Pushing the Operating System • The biggest challenge is the exe alignment, and headers. Windows 32 programs have a lot of extra “fluff” in them, that you don’t need. • The MS-DOS had a light program. This way it supported two types of programs: • .COM files - limited to 64kb, but no headers! • .EXE files - for large exe • For this reason most bytetros are actually MS-DOS .COM file programs.

  32. Phase #1 Using an executable packer Because of the extra stuff in the exe header, coders started using executable packers. For details on the win32 PE format: http://win32assembly.online.fr/pe-tut1.html Executable packers store the original exe using compression, and attach a decompression routine that writes the it exe to memory and then executes. A good standard exe packer is UPX: http://upx.sourceforge.net/

  33. Phase #2 – Using a file dropper • The problem is, the resulting compressed exe – is still a windows program. It has a certain amount of “fluff” that you still can’t avoid. • To get around this, a technique known as file dropping was developed.

  34. File Dropping • File dropping takes a Windows executable program and attaches it to a MS-DOS .com file. • This .com file writes out the attached windows executable to disk, runs it, and then deletes it once finished. • Because this accesses the local disk for the temporary file, this technique “drops” a file. • Be careful! Various parties have various rules. Some outlaw writing anything to disk!

  35. File Dropping • The write to disk routine takes a few bytes on top of the regular windows executable. • The improvement comes from using a .com file packer. This is like a regular exe packer, but for the MS-DOS platform. A very good and popular one is apack. • http://www.ibsensoftware.com/ • This technique is characterized by a MS-DOS window that shows up before the production starts. • With this technique it’s possible for a 16kb to shrink down to 4kb. For Example – the Etherium 16474 bytes -> 4008 bytes

  36. File Dropper Tool Links • A few Tools to create file droppers: • PE2EXE [aka PE2COM] – From Frankie / Smash Designs • http://www.active-web.cc/html/research/ • GEM Dropper 1.0 • http://gem.intro.hu/main01.htm • Warning: Many tools drop a file into C:\. This may mean your production won’t work on Windows XP [post SP1], without administrator privileges. Read your tool documentation. (Or make your own!)

  37. Phase #3 – Cab Dropping • No matter how you slice it… a file dropper must have the executable code to decompress the original windows exe to disk. • In Hugi 28, Gem Introduced a technique called “CAB dropping”. Since then this has become the “defacto” standard for 4kb’s, most of the entries in Assembly 2004 4kb Intro Compo are cab droppers of some type.

  38. Cab Dropping • A cab dropper uses the operating systems extract program to decompress the exe. Cab files are similar to zip files. • Win95/98/ME: c:\windows\command\extract.exe • WinNT/2K/XP: c:\windows\system32\extrac32.exe • To do the decompression you write a batch file • It calls extract.exe, and or extrac32 • runs the win32 program, • then deletes it.

  39. Cab Dropping OS Dependencies • Because of platform variations, often a cab dropper will call both extract and extract32. One works. The other results in something like: • 'extract' is not recognized as an internal or external command,operable program or batch file. • For this reason some feel that cab dropping is “messy”.

  40. Cab Dropping – A single file • It’s also possible to trick the cab file format into having the batch file commands in it. This results in a single .bat or .cmd, that contains your production. It’s possible to avoid problems with root folder writing by writing to the operating system %temp% folder. • The joined cab / batch file has more info that shows up in the header. Specifically: • 'MSCF' is not recognized as an internal or external command, operable program or batch file.

  41. Space savings / Tool Links • In summary (The Etherium) • 16474 bytes – pure windows exe • 4008 bytes – as a file dropper • 3856 byte – as a cab .bat file • Cab Dropper tool links: • Gem Cab Dropper • http://gem.intro.hu/main01.htm • 20to4 Cab Dropper • http://www.20to4.net/

  42. The Future • As operating systems add features, new options become available for creative programming. • In the future we can look forward to a variety of more cool things in small spaces! (on every type of operating system)

  43. The Future • The key is to be creative in the way you use your computer! • Algorithm • Code • Operating System • And DESIGN!

  44. Question Period / Discussions • Any questions?

More Related