Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - IQpierce

Pages: [1] 2
help / Scale problems: <65% scale invisible!
« on: Mon, Nov 19, 2012 »
I was messing with a new feature of my game last night and I discovered one of the effects I use in the game just seems to always be invisible when its scale.x/y values are < 0.65. I had to do a lot of testing to narrow it down to this problem, and I've never seen anything like that before in Flixel.

Then again, I don't know that I've ever scaled anything down that far, I don't use scaling a lot due to its performance implications. I need it in this case though.

Has anyone seen this before or solved the problem? Thanks for any help or insight you can provide.

releases / FlxSWFStates - Level creation in Flash/FLAs!
« on: Fri, Aug 24, 2012 »
I meant to share this before... luckily that means it's *fairly* mature, or at least I've been using it a lot and I see few or no bugs with it. My friend Chris is participating in Ludum Dare (I'm jealous, I wish I had time) and is going to use Flixel... I packaged this up a bit to share it with him, and thought I might at least share it with others.

I've tried DAME and looked at Ogmo and just didn't feel like it was worth my going through the learning curve. I realized that what I really wanted was simple: WYSIWYG (What You See Is What You Get) level design, putting things in 2D space... and that was all. And the frustrating thing was that I can do that easily in other Flash work I do: just make an FLA with the content I want, bam, done.

But Flixel doesn't use the Flash display list and is just a different world from anything you can make with an FLA, right? It seemed like an easy gap to bridge, so I tried bridging it.

FlxSWFStates will:
1. Load a SWF file
2. Look at all the DisplayObjects on the "stage" (root display list) of that SWF
3. Create an FlxSprite OR ANY OTHER DERIVED CLASS from each DisplayObject
4. Give the new FlxSprite the x/y/width/height of the original DisplayObject
5. Optionally give the new FlxSprite the pixels of the original DisplayObject [no, animations are totally unsupported, sorry; rotation also not supported yet]
6. Assign any variables to the new FlxSprite, which you can define in Flash using the Component Inspector (e.g. you can set "vector.x => 50" and the object will have its vector.x value initialized to 50 when created... works for any variable names on your custom classes too).
7. It will then add this FlxSprite to your FlxState. If your FlxState defines a certain custom function, it will go through that function, otherwise it falls back on simply calling add().

There are "Dynamic" and "Embedded" implementations of the Populator which you can use. Embedded uses a SWF that has been compiled (longer compilations, faster at runtime); Dynamic uses a SWF file that's loaded in on-the-fly at runtime (faster compilations, slower at runtime). I prefer Dynamic because you can reload your level's SWF without having to restart the game, allowing for super-fast iteration (which I am addicted to).

Here's the library itself, which is meant be put under the flixel "plugin" folder (though I'm not sure if this is the right place for it at all, oh well):

And here's a minimalist example project that uses it:

(This game was originally something I created in 20 minutes in a nightclub during GDC with Robin Arnott and Rodain Joubert... it's terrible... but at least it can serve as a demo of this plug-in now!)

Here's a bunch more details on where things live in the test project, copied from the email I sent to my friend earlier....

- The FLA file for the level lives in data/levels. Its publish settings are set to publish a SWF under bin-debug/levels/. This is a weird setup for FLA/SWFs, but I had problems getting dynamic-SWF-loading working unless the level SWFs were underneath the same folder (bin-debug) as the game SWF.
- The FLA also includes the libsrc folder, there are a couple of my classes that it has to be aware of.
- Note the component settings on every object in the level. You can set what class a MovieClip should be turned into in Flixel (in this case "Sun" or "Planet"); and you can put arbitrary name/val pairs that will be set on the object at initialization. One planet starts out with a velocity.x = 50 name/val pair.
- Note that BaseSWFLevel takes care of identifying what type of object is being added, and putting it in the right group. Good place to hook up other massaging/handling of those things.
- There's also a hook for after the entire SWF has been loaded in.
- Note that the SWF is loaded in AT RUNTIME so you can totally do the following for maximum productivity:
   - Play the level, and find there's a change you want to make
   - Go to the level FLA, make the change, republish the level SWF.
   - Reload the level (you don't even have to relaunch the game!!!), for instance by stepping out to the main menu and back in, or with a dev hotkey
   - Bam, you're running the changed level, no need to rebuild or relaunch whooo
- The actual SWFState code lives under libsrc/org/flixel/plugin/FlxSWFStates. Note that two classes in there (ObjectProxy and ObjectProxyParent) are things that can be used for Components in the FLA. Note how the object linkage and component setup in the FLA library is setup for the Sun and Planets in there. These examples all use ObjectProxy I think; if you want to do parenting, it works, but you have to make the parent objects be ObjectProxyParent components for the code to recurse into them and find the ObjectProxy children at runtime. I know that this makes no sense, so ask me for more details/examples if you're really curious about this capability... basically it lets you use the Flash MovieClip hierarchy for more modular setup.
- The actual pixels of the thing in the FLA will be used on the sprite created, by default. Making this a great prototype art tool. Zero support for animations though. You can always uncheck "use pixels" on any element's component settings, if you want to set up its visuals in code instead.

Hopefully that's more than enough to get people started. My hope is that this can be a significant alternative for a way to design levels for Flixel, even though it will clearly have some pros/cons compared to the other methods (this has absolutely zero special support for Tilemaps, I've never used them, yes I know they're a popular Flixel feature, sorry). And of course this isn't helpful to indies who don't have Flash, I know.

But hopefully it's useful to the community! Enjoy and let me know if you add capabilities, or discover major bugs, etc.

iOS / Re: Dynamic FlxSprite coloring
« on: Tue, May 29, 2012 »
Whoops, thanks for catching that tokyotron! I had messed around that code early in Connectrode development and totally forgotten it was another necessary change.

iOS / Dynamic FlxSprite coloring
« on: Sun, Apr 29, 2012 »
I was emailing "initials" about this the other day, he gave me a bit of a starting point for this discovery...

The original Flash version of Flixel of course allows you to do things like "sprite.color = 0xff0000;" to instantly tint an FlxSprite to be red. When I developed the prototype of my game Connectrode in Flixel, I colored all of the sprites this way in the Flash version...

...Then I brought Connectrode over to the iOS version of Flixel and discovered this capability didn't work! There's a "color" member on FlxSprite's on the iOS version; but if you set it, nothing happens. At that time, I just made special textures for each color, and moved on.

It's a year since then and I'm trying to do a "thank you" update to Connectrode, to thank all the players who bought the game out of solidarity last month (when some drama went down between me, Zynga, and my former CEO). One thing I had always wanted to do was make my "matching colored tiles" game playable by people who were colorblind. To allow for this, I wanted to let players choose their own colors for the 6 piece types used in the game - so, I looked into solving dynamic tinting for real.

Turns out this is pretty simple. Go to the function FlxSprite.renderSprite()... look for the line "glPushMatrix();"... and right after that line, add these lines of code:

Code: [Select]
float redMultiplier = ((float)( _color >> 16 & 0xff )) / 255.0f;
float greenMultiplier = ((float)( _color >> 8 & 0xff )) / 255.0f;
float blueMultiplier = ((float)( _color & 0xff )) / 255.0f;
float alphaMultiplier = _alpha;
glColor4f( redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier);

The color tinting of FlxSprites will now work exactly as you'd expect. Hope this helps folks!

games / Re: Connectrode: pure puzzle game for iOS
« on: Sat, Jul 30, 2011 »
Connectrode was mentioned in Adam's interview on the TouchArcade podcast.
Nice work.
Oh nice! I actually got to show Adam a prototype build of the game a few months ago . Just listened to that, still need to finish listening to the rest of the podcast...

Hadn't heard of The Blocks Cometh before, will have to check it out. Just saw a video... thought maybe I should send them a link to my method for using a different font! Looks fun though.

games / Re: Where I Go At Night
« on: Fri, Jul 29, 2011 »
1. This is a really great game, even just playing it alone and "roleplaying" each role is quite fun.
2. One should not be allowed to play as the Werewolf without listening to the monologue from the end of I Am Wolfman.

games / Re: Connectrode: pure puzzle game for iOS
« on: Sun, Jul 24, 2011 »
Yeah, I like to err on the side of sharing info like that... I always thought that being featured by Apple would mean a lot more sales than that, personally...

For a game that we're making $.70 on per sale, I don't think the current pace is going to make any of us filthy rich. But maybe it will at least up paying for the MacBook Pro that I used to make it... that would be nice. :)

But now I'm itching to make some kind of experimental game that has no commercial value whatsoever... :)

Haha, awesome... I had felt a bit guilty for using an open-source engine like Flixel and yet not really contributing much back to the community... glad to know my wall of text above (and the source code snippet) has already been of practical use to someone. :)

iOS / Fonts in Flixel iOS - source/example included!
« on: Sun, Jul 24, 2011 »
So I just released Connectrode ( this month and it's doing well on iOS, currently featured by Apple and #10 in puzzle games, yay! It was made in Flixel iOS... someone on the "Games" board asked me how I handled the fonts/text in it and I thought I'd give a detailed answer here.

Okay so, custom fonts. Text and fonts were DEFINITELY the biggest pain in the ass of making this game. I probably spent over 12 hours just messing with font stuff, figuring it out and trying to get it to work (also counting wasted time of trying to do all the text embedded in images and headaches around that).

Long story short, to get my own font working, I had to go copy the FlixelFont.m file, look at its long array of glyphs (flixelUnicharToGlyphMap), and then basically use trial-and-error to try switch over the font glyph indeces in that array with the font that I had imported instead. It was horrible and took forever.

Some advice if you try to go down this road yourself:
1. To figure out what the indices for the characters you want are in the font you're trying to use, I heard someone recommending using "FontExplorer X Pro" (for Mac at least) which lets you see what all the glyph indices are for your font.
2. To clarify what's going on here: this array is a way of saying, for each and every possible Unichar character, where it can find the glyph for that character inside the font's data. Fonts can have a completely different ordering for this data. But that's what flixelUnicharToGlyphMap is for: each entry in that array is for a possible Unichar character, and if you want that char to show up, you put an entry at the right point in the array for the index of that character in your font.
3. The difficulty is knowing 1) which unichar index corresponds to the actual characters (this I believe can be easily determined by looking at the unichar character-code definition I believe), and 2) where that character is within your font (this is what you would find out with FontExplorer X Pro... or, if you're a masochist like me, with hours of trial-and-error, plugging different indices in at random, seeing what shows up on screen when you try to render text with that font, and trying to figure out patterns).

So to hopefully save you guys a bunch of trial-and-error, I will attach here the font file we used (it's a publicly-available font called OCRA), as well as my ConnectrodeFont.h file (which is again a copy of FlixelFont.m, except thatI have my own version of the flixelUnicharToGlyphMap in which I've made it more readable for recognizing where things go, and have commented the indices of some important alphanumeric and punctuation characters).

Fonts are clearly not the strong point of this iOS engine, but if you really want to try to do them, you can dig into all this stuff, and hopefully the digging I've already done will save you a ton of time in getting it up and running!

Post in this thread if you try to hook up your own fonts following this example and get stuck or can't figure out what's going on, I'll be happy to try and help!

UPDATE: Looks like I can't attach fonts, check out the font at

games / Re: Connectrode: pure puzzle game for iOS
« on: Sun, Jul 24, 2011 »
Thanks for the kind words guys! This game is turning out to be pretty successful, we were featured by Apple on Thursday and have been getting about 850 sales a day since then! :O We're doing the $.99 thing so that hasn't gotten too lucrative yet but hopefully it'll keep going!

I really need to be more active on these forums since this engine made all of this possible...! So let's do this: I have some promo codes  left to get this game for free! We only have a limited # of them, but I'll say that 5 of them are earmarked for Flixel forum members... PM me if you want one, first come first serve! Save that $.99! :)

Next, go check the iOS forums for answers to those questions about text... text and fonts were a HUGE headache but I solved it with a lot of trial and error, and I'll share some useful info/code from what I did to put my own font in.

Oh and one more note: if I started this project today, I probably wouldn't bother with Flixel iOS... I would do it in Flixel AS3 and try to export to the iPhone using Flash CS5.5 or Flash Builder 4.5.1.  I've heard that their new version of the Adobe AIR flash exporting for iOS has MUCH better performance as of an update they did last month. I haven't evaluated this yet myself... but I have a feeling that I could have saved myself about 2.5 of the 6 months I spent finishing and polishing this game if that update had come out last year instead of last month!

Oh well, Semi-Secret is still awesome for sharing the Flixel iOS library, and I'm certainly glad they did! And aside from the fonts (and the lack of any good tweening option in Cocoa, at least that I could find), I really enjoyed making this game in this engine!

games / Connectrode: pure puzzle game for iOS
« on: Sun, Jul 10, 2011 »
Connectrode, a simple but addictive indie puzzle game made using Flixel iOS, is on the App Store for $.99!

Video on YouTube:



How to play:
Repeat after me - this is NOT a match-3!
There are "chip" pieces on the board and you are given "connector" pieces each turn to place onto the board. If you place connectors so as to "close the circuit" between multiple same-colored chips, then that whole chain of chips and connectors will be cleared from the board. The real trick is that placing a piece can block off parts of the board (new connectors can't be moved through walls of other pieces) - so each piece placement may limit you placing pieces on future turns.
Simple rules, but some complex challenges quickly emerge once you start playing (especially on the harder difficulty levels). There's some subtle scoring rules that can make the game much more challenging for those trying to maximize their score (connecting 3 chips is much trickier than connecting two).

I'm a professional game programmer but I also do indie projects (as "Deep Plaid Games"), and I love prototyping games in Flixel. I decided to design the most addictive puzzle-style game for iOS that I possibly could. I prototyped the mechanics in Flixel for AS3... after dropping the project, my wife encouraged me to mess with it again... suddenly I found gameplay that I fell in love with... the very next day, Flixel iOS went open-source, so I basically stayed up that whole night and ported my code from AS3 to Objective-C!

Later I got in touch with some other awesome Austin indies to finish what was by then called "Connectrode":
  • Brandon Boyer put me in touch with Dale Austin, who did fantastic work with the art and the video
  • My friend Brad Lewis (who worked on I Dig It on iOS and now works for Bioware) helped with art during early development
  • Robin Arnott (who made an awesome art game, "Deep Sea") did the sound effects
  • David Pencil compsed the music (he did the soundtrack for Penny Arcade: The Series, season two).

I'm proud of it as a well-designed, elegant puzzle game... and I love the graphics and sound that the team put together. Since it's a kinda personal game (I was the sole game designer and programmer), I dedicated it to my wife Laura, who encouraged me to pursue the project.

Designing a truly "easy to learn, hard to master" game was an incredible challenge. I hope to do more complex and experimental indie game projects at some point... but for now I'm proud to have made a "pure puzzle game" that I think ranks up there with the best in the genre! Hope others try it and enjoy it! Feel free to ask questions, or share impressions if you try the game.

Shay Pierce
CEO and Wombat Defenestrator
Deep Plaid Games, LLC

iOS / Re: game dev contest with 100K Prize
« on: Fri, May 20, 2011 »
Thinking about it. My Flixel iOS game is a puzzle game aimed at the casual market and it's nearly complete, seems like good timing...

iOS / Re: iOS Canabalt Problems/Solutions
« on: Fri, May 13, 2011 »
Higher in this thread, there were some posts about Retina issues. I posted the workaround I had settled on:

Ultimately my fix was simple: in my FlxGame's primary init function, where it calls [super initWithOrientation...], I no longer ever pass in TRUE for the "useTextureBufferZoom:" parameter (the code provided with Canabalt was passing in TRUE when using an iPads or Retina display). I do however change the "zoom" parameter to be 2.0 when Retina is enabled - and everything just works, the game is scaled up 2x.

Note that I'm not making an iPad game, just an iPhone game that I need to be sure works on iPhone 4... so I haven't tested how this changes iPad behavior yet. In other words, YMMV.

However axcho later posted that he had consulted with Eric Johnson and fixed the Retina issues properly! (But it sounded like there were still issues with rotated textures.) Not sure what happened with that. It looks like neither that, nor anything else, have gone into the official git branch of iOS Flixel, which hasn't been updated since December:

axcho, do you have somewhere we could pull your additions from?

iOS / Re: Anybody looking for a job in iOS
« on: Fri, May 13, 2011 »
My company website is I work exclusively and solely on indie games based around the ideals and philosophy of Abraham Lincoln. I forgot to mention that if your iOS project doesn't directly promote the ideals and philosophy of Abraham Lincoln, then I will not only reject your business offer, but I will put on my stovepipe hat, form an army, and send them to your home to put down your shortsighted rebellion, just like Abe would have done.

My email ID is 2.

I look forward to your further communications regarding this dynamic opportunity, which I just find to be as exciting as ****.

iOS / Re: Anybody looking for a job in iOS
« on: Thu, May 12, 2011 »
My employer, International Solutions for Advanced Information Inc. LLC, would like to express their desire and intent to get in on this ****. We've performed a detailed evaluation of the communications in this thread and found that the keywords used within are absolutely off the ****ing charts in terms of having something to do with products that we think we'd like to know how to develop. We'd like to extend a welcome to you and ask how our company and yours can get together and engage in a triple-X throwdown (by which I mean developing iOS applications while exploiting our core competencies to their maximum potential). Let us know your earliest convenience for discussing these matters over a Cobb salad or some ****, I don't know.

iOS / Re: iOS Canabalt Problems/Solutions
« on: Thu, May 12, 2011 »
That's great to know about goshki, thanks for pointing it out!

I don't know if I'll have a chance to evaluate it with Flixel on my current project, but we are redoing a lot of animations and menu stuff right now. If I do try it with Flixel then I'll be sure to post about my experiences with it here on the forums.

releases / Re: FlxCaveGenerator
« on: Fri, May 6, 2011 »
Cool stuff. I'm always surprised by how few references to cellular automata techniques when I read articles about procedural level generation; I've used it on some past projects to terrific effect.

I once did a 2D map generator for a top-down game, where I wanted to randomly have certain cities, forests, and rivers on the map. I ended up coming up with some neat cellular automata techniques to "tease out" the shapes and configurations I wanted for these different terrain elements. For instance, any filled tiles that were completely off on their own would become a City; large blobs of filled tiles would become a Forest; and I would do some iterative massaging to encourage long linear strings of filled tiles to appear, and make those be Rivers.

It was an interesting process of both looking for naturally-emerging configurations that were close to what I wanted, and then doing a few cycles of processing to encourage those shapes to take even more of the shape I needed them to. All this seems very well-suited to Flixel and its tile-based nature.

iOS / Re: iOS Canabalt Problems/Solutions
« on: Wed, Apr 27, 2011 »
I actually started to write a fairly elaborate Tweening class to use in my Flixel iOS project (that would dynamically execute a "setXXX" selector on an object every frame where "XXX" was the property name you provided), but I had some trouble implementing it. Then I realized that I could get 90% of the effect I wanted by using the velocity and acceleration parameters on the sprites I wanted (similar to how the Canabalt code "tweens" in the background on the opening screen). It requires tweaking of numbers to get right but I got UI elements (FlxSprites, etc.) smoothly scrolling onto screen, etc. It was a decision to "cut with the grain" and work with the strengths of the engine, even though it wasn't exactly what I wanted.

A tweening solution would be a fantastic addition to Flixel iOS - I assume that most Flixel developers, like me, just use the awesome greensock libraries for tweening on AS3. Not having an equivalent available for iOS is frustrating... if anyone knows of a Cocoa alternative that has even 50% of the features of greensock's stuff, please please share.

Awesome! Is this officially the first "3rd-party" (non-Semi-Secret) Flixel game on the app store?

If you're comfortable with it, you should share your experience on the App Store! I put out a $.99 game last year that gets about one sale a day at this point - which is a bit depressing. I'm hoping that I can do a bit better with the current (Flixel) game I'm developing!

Nice! Would be great to see a video of it in action. :)

Pages: [1] 2