JetpackHQ | Register | Log in    

Parallax Without Scrolling?

April 8th, 2008

I’m pretty much committed to not doing any scrolling in Jetpack 2. That creates a different type of game, and I haven’t done everything I’d like to with the single-screen style yet. But I want to give the whole screen life, so I’m investigating the possibility of scrolling just the background, while keeping the foreground still. This will create a slightly odd parallax effect. The background would move very slowly to the left as the player runs right.

I wasn’t sure quite how to do this, but it reminded me of Rastan, so I fired up MAME to see how they did it. It looks pretty good in Rastan, but of course that is a scrolling game. Will it look good in Jetpack? You be the judge.

Since I’m still waiting on SWF encryption to protect my source code, I can’t publish a working demo, but try to picture the background moving in this remix of level 1.

Will a graphical background work?

Note these are all programmer graphics, and will get much better once I find an artist!


Writing a preloader in ActionScript 3

March 25th, 2008

Note: This is a pretty technical post, if you’re not a programmer you will probably not be interested!

A preloader gives the user something to look at while the rest of your program loads. This is one of the nice things about SWF’s, they are capable of streaming - showing part of their content before fully downloaded. The way you do this is by putting all the content to be loaded later on a later frame of the SWF timeline. This does get a little complicated, because ideally you should preload not just your data, but your code as well. Any classes you don’t need for the preloader should be placed on a later frame along with any library assets.

This is where a big bug in ActionScript 3 shows up - the “Export classes in frame” setting appears to be badly broken, as discussed on actionscript.org. As you can tell, Adobe’s error is making some professionals desperate to find a workaround. Well, thanks to others in the ActionScript community, I’ve finally discovered the workaround. Unfortunately it involves abandoning Flash in favor of Flex. But, this isn’t as bad as it may sound. While I detest the Eclipse-based Flex Builder IDE, I discovered a fantastic (and free) tool called FlashDevelop that is a superior development environment to Flex Builder or Flash, and offers easier customization while lacking just a little polish (for one thing, syntax highlighting must be edited via XML file). FlashDevelop uses the command-line SWF compiler mxmlc that comes in the new (also free) Flex 3 SDK.

Actually since Adobe has all these nebulous products floating around that all pretty much do the same thing (Flash, Flex, Air, who knows what else), it’s a little confusing what language you are using for your source files. It’s ActionScript but it’s the Flex brand of ActionScript, which is a few tweaks different from Flash ActionScript. They could just merge all these tweaks into a single language and let you choose which features you want to use, but I imagine like in many other things computer, there’s less money in making things simple. Anyway, basically in Flex-ActionScript, you can embed all your library assets via source code, rather than via an IDE. Although the way you do this is a little awkward, I find it highly preferable. And you can still use advanced layouts and components by just including them via SWC

Once you get your project converted to Flex, here is the fix: instead of monkeying around with the timeline, set your preloader as your primary build class, and use the command-line option “-frame” to put your main program on frame 2 (placing the line [Frame(extraClass=”Main”)] in your preloader appears to be equivalent). Thanks to this German guy Sven Busse for discovering this (unfortunately the text is German, but the source code is readable). Also thanks to Lars Gerckens for his research, and BIT-101 for this alternate solution. And of course thanks to Adobe for providing such horrendously incomplete documentation that things like this have to be discovered through much trial and error. I can’t fault them too much though, since they are at least finally strangling the abomination that was Macromedia’s ActionScript 2.

After your preloading is done, you have to start the main class - but you can’t reference it because then Flex will include it, and all the classes it uses, along with the preloader on frame 1. Here’s how you instantiate it without referencing it (’Main’ is the name of the main class):


nextFrame(); // goto Main frame
var classdef:Class = getDefinitionByName("Main") as Class;
var main:DisplayObject = new classdef(); // runs itself

Now there’s another problem - your Main class won’t have a stage object until after you call addChild(main) - but how does Preloader tell Main to initialize after, when Preloader doesn’t know what class Main is? The way I do it is by storing the stage in a global variable, then letting main add itself to the stage in the constructor. I use a class called Sys that contains static variables for build type, debug mode, stage, and a few other globals. Generally globals are a bad thing, but in certain cases like this I think they are worth it.

If you have find any caveats or improvements, let me know!

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

One problem still exists: when loading this in a web browser, loaderInfo.bytesLoaded seems to only reflect the first frame. We need to know the total bytes for the entire SWF to accurately show load progress. From looking at the source code to mx.preloaders.DownloadProgressBar, Adobe’s own code actually has to guess at the size of the SWF it’s loading. Weak. So no “percentage loaded” indicator is going to be accurate unless you explicitly provide it with the estimated size of your SWF.


Ad Blockers Considered Harmful

March 22nd, 2008

I did some research on ad blockers a while ago and thought I would share it here while we are waiting for a working beta of SWF encryption software. After my research I realized that ad blocking software is very bad for the web as we know it, and more damaging than software piracy (since I believe that most pirates wouldn’t buy the product anyway). It doesn’t affect this website as I don’t have ads yet, but it has hurt some of my free website projects in the past.

The problem is not that ad blocking software exists, but that the design is severely flawed. I like the idea of being able to block annoying ads. But surprisingly, of the dozens+ of ad blocking programs out there, not a single one will let me do that! They are all set to BLOCK EVERYTHING BY DEFAULT - including the inoffensive ads and the sites you use daily and want to support. Some let you “whitelist” sites where you want to see ads, but this is a red herring. The harmful flaw of this software is due to the power of defaults. No significant number of people is going to go through this process for every site they want to support: [disable the ad-blocker, find out if a site has inoffensive ads, enable ads on that site, reenable the ad-blocker]

While researching this issue I installed an ad-blocker with no intention of keeping it - but I liked it, and now I understand the problem. You want it for that damn 5% - those annoying websites with popups and flashing ads. But being an ethical person I want to support the other 95% of sites I like. When you install an ad blocker, it’s a real eye opener to see how differently a sizeable chunk of people are seeing your website.

At worst, ad-blockers hurt the free web. At least, they are ripping us off. People who use ad-blocking software are being subsidized by people who do not. Everyone who runs this software (MILLIONS of people) is leeching off the free web, and depending on those who do not leech to keep their favorite websites free. There are no good estimates that I could find as to how much revenue is lost due to this problem (it’s very hard to measure), but since the number of users is in the millions (just one program boasts 1.35 million subscribers), I would guess that between of 10%-30% of revenue on free websites is being lost due to leeching, most of which is not the fault of the users but software makers who have no vested interest in fairness to free websites.

The logical extension of this problem, if everyone installed today’s ad-blocking software, is that large portions of the free web would dry up, either going subscription-based, or out of business. That makes this flawed software hostile to my business. But where is the public rage, or at least the mild annoyance? This issue is not in the public consciousness. It is mentioned on a few public forums, where virtually everyone is in support of the ad blocking software. I think this reflects a real misunderstanding of this software’s effect.

One potential solution I came up with is to convince companies to change the paradigm from block everything, to block ON DEMAND. I think this option would be popular, because it lets the user lack the smack down on bad websites, while being much more friendly to the good ones. It’s the way I would like the software to work, speaking as a user, not just as a website owner. This active censorship could even have the effect of discouraging annoying ads from being run in the first place.

I wrote to a few developers of the largest ad blocking products to suggest this change, and I was greeted with indifference and even rudeness - not surprising. They already know their software is costing us money. Maybe the proper negative attitude toward software with this flawed design will eventually convince these companies to listen. This issue needs better public awareness. Webmasters that rely on ad revenue to stay in business should be aware of the harm being done to them personally by this software.

Related Articles

Browser Makers Warned Against Ad Blocking
“The end of free Internet content will come when Web browsers start blocking online advertisements by default, a DoubleClick executive has warned.”

Is Norton Blocking Your Internet Marketing Efforts?
“Even though these products are sold as “Security” THE DEFAULT IS SET TO BLOCK ADS”

Norton Antivirus 2004 Ad Blocking - Tough Call?
“If banner ads fail, more and more sites will be forced into a pay model, and the days of the “Free Internet” will be almost over.”

Wikipedia - Ad Filtering

Legitimate products

These appears to be more legitimate products, only blocking popups and adware, but not stripping ads from webpages.

Stopzilla
Pop-up Stopper


Moving Day

February 26th, 2008

I’m moving this week so there won’t be any updates.

I will post some SWF technology tests as soon as SWF encryption software is released for ActionScript 3 - should be within a month.

Do me a favor and link to JetpackHQ if you have a website, help spread the word!


Theft Prevention

February 21st, 2008

One of the biggest challenges Flash developers must face is just how easy it is for people to steal your source code. SWF files include basically your complete source code, sure there are no comments included, but good programming is self documenting. Unfortunately all your variable & function names are kept intact. This means that any schmo could come along and get the complete source code to Jetpack, and create their own version from my hard work. This isn’t simple software piracy, it’s closer to actual theft, where someone else is profiting from your work. Even if the hacked game is not sold, there is revenue from ads, or just increased site traffic. A copyright helps, but still there are many examples of flash games being reskinned, and published as original works.

This is why I haven’t released any flash demos yet, I’m trying to find a resolution to this problem before releasing a simple demo that contains my entire source code. There are tools out there to encrypt ActionScript, but none of them work with ActionScript 3 yet - and from what I understand, a separate tool is needed to obscure variable names, a feature that is very important to protecting code.

Maybe this issue is why there are very few large games created for Flash? Still, I intend to continue on this path, at least for this game.


3D Tile Test

February 16th, 2008

One of the big changes for Jetpack 2 is a 3D look. I don’t want to go full 3D - 3D has its place but it often hurts playability. A good example is Civilization 4 - IMHO it got a lot uglier and less fun when they made the switch to 3D graphics. Jetpack will have a form of faux-3D, similar to isometric but at a slightly different angle.

I created a level importer for the old Jetpack levels, and also imported all the old graphics to use as placeholders until I get new art. I decided to have all tile pieces be square, and create angled versions for walls & floors on the fly. This creates a strange effect when using the old graphics. The screenshot below looks really low res and blurry - don’t worry, that will change once I get an artist. But this is (probably) the resolution and faux-3D look the game will have. It will fit in 800×600 in full screen mode.

Old-school low res graphics being manhandled into a faux-3D environment

The tiles in the old Jetpack were 12×12. These are 28×28, or if you measure the whole cube with wall & floor, 36×36. The new levels/maps/rooms will be a couple tiles bigger in each direction. The faux 3D tiles are presenting a problem that I didn’t anticipate being so tricky, when doing depth ordering. I’m going to put that off until later.

The issue I’m dealing with now is collision detection. In the old jetpack, the tiles were fixed in place, and collision detection could be done based on a simple grid. For Jetpack 2, I may want the tiles to be movable, and I also want semi-realistic physics, so more complex collision detection is required. I’m not planning on doing any special polygon handling or rotating - this will be strictly circle & rectangle simulation. The method I’m planning on using is: when a collision is imminent, step each object forward until right before the collision, then store that collision in a list sorted by time of impact. The collisions are processed in order by time. I’m hoping this method will be fast and accurate enough to handle something like 50 ping pong balls bouncing off eachother. That may be too optimistic. We’ll see how it works.

 


Vaporware

February 13th, 2008

Back in 1993 the world was my oyster.

I don’t like oysters, but the point is I had a future. A plan. But I dropped the ball. I fell into that all too common trap for programmers, taking on more than you can handle, and underestimating development time. Instead of working on new small games like Jetpack 2, I put years of work into a massive game engine project that was doomed to failure from the start. Once you’ve put 5 years into a project, it’s hard to convince yourself to abandon all that effort. It was sad, but I finally realized that the project would be obsolete before it was complete. In the meantime I was delivering pizza to pay the rent. What can I say, I lacked proper guidance.

I put the next 5 years into an online dating site, Cybersoulmate.com (now defunct). I think it could have been the first social network, before Friendster or Myspace, if I had prioritized things differently. I got up to 100,000 members before those other sites came along and stole the show. I think my biggest mistakes on that project were putting looks ahead of features, and putting fun-to-implement features ahead of those that were more important to users. Still I met my wife from my site, so it wasn’t a total wash.

I also put in a few scattered years at a couple of large software companies. Pretty dull. And all this time I was just wanting to make games. Maybe I should have gone to a game company, but all I heard were bad things, places that work you 80 hours a week and keep you in golden handcuffs, like cutting off your royalties as soon as you leave. Why are there no companies that just want to make cool, original games and treat people fairly? And these days it seems like your only option is to work on another d@#n first-person shooter clone, fine tuning some shiny 3D effect. No thanks. And on a completely different topic, I’m really sick of C++. With the fancy tricks people have to do just to keep the language viable, you can’t even read C++ code without spending a week learning what 200 custom macros do. Not that ActionScript is paradise, but at least you can read it in a reasonable amount of time. But I digress.

It sucks to spend years on a project and have it fail, or have to abandon it. Having done both, I am but a shell of a man. I have only a tiny sliver of the energy and excitement that I had as a youth. Like the mollusk, I long only for the rising tide of success to wash over the dry rock of broken dreams that I tenaciously cling to with my single muscular foot. A foot that tastes delicious sauteed in butter and lemon. Creating a successful game would be rejuvenating. And hopefully bring the bling.

The world is my mollusk.


Welcome to JetpackHQ

February 12th, 2008

Hi, I’m Adam Pedersen. I created the PC game Jetpack when I was 19, way back in 1993. A new version of Jetpack has been a long time coming, but I’m determined to get it done in 2008. JetpackHQ.com will eventually become a Jetpack portal, for sharing mission packs and add-ons. For now, it will just host this blog chronicling the development of the new Jetpack.

Why a blog?

  • I thought it would be cool to interactively chronicle the creation of a video game. I plan to post alpha & beta versions of the new Jetpack as they are created - not downloads, but embedded in the blog. That’s right, the new Jetpack is going to be created in Flash. No groaning - Flash has gotten a lot better since Adobe took over. And there will be a standalone exe version too.
  • This seems like a fun way to communicate with Jetpack fans, hear your ideas, and get the game well tested before release. Also the encouragement of Jetpack fans will keep me motivated and on task.
  • Like the first Jetpack, this is being done on a shoestring budget. Hopefully the blog will encourage donations of art, sounds, & music!

Back in 1993 I ran a BBS (look it up kids), and I remember not thinking much of it when someone mentioned some new “world wide web” thing that was supposed to be a big deal. That’s where I’m coming from: old school. Not punchcards old school, but at least 5 1/4 floppy disks old school. I got into programming in the late 80’s, back when games were fun, and new gameplay ideas were being tried by everyone, not just the freelancers. That’s my focus: fun gameplay. That means realistic physics, a highly interactive world, and lots of room to be creative.

About Jetpack

If you’re new to Jetpack, it is a classic platform style game inspired by Lode Runner, Jumpman, Pitfall, Bruce Lee, and various other games from my misspent youth on the Commodore 64. The original Jetpack ran on an 8086 5mhz. It has been downloaded over a million times since my site www.adeptsoftware.com went online in 1997.

Jetpack 2 was supposed to be released back in 1995. Then 1999. Then 2000. Things came up - more on that later. It’s 2008, and it’s time to get busy. Check this blog every few days for the latest project updates!

Adam Pedersen


  • Archives