Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Pablo 12:50 AM on 4 August 2014 Permalink | Reply  

    Lucky Duckies! 

    I just released the web version of the game “lucky duckies”

    http://bnpla.com/play/lucky-duckies

    I still dont know how to upload the mobile version to the android market, so i’l lhave to investigate a bit more before releasing the other version.

     
  • Pablo 2:41 PM on 31 July 2014 Permalink | Reply  

    My First Mobile Game! 

    I managed to port one of my flash games into an Android tablet, here’s a preview video!

     
  • Pablo 4:24 PM on 19 June 2014 Permalink | Reply  

    Alternativa3D two sided texture 

    It is so simple… you just basically have to set the culling property of the draw unit of your material to Context3DTriangleFace.NONE

    that will draw both sides of each polygon. In  my case, to do this, i got a copy of the TextureMaterial class into my proyect source directory and changed the visibiity of the method getDrawUnit to protected. Then, you just override it in your own material’s class and set the culling protperty of the return value of the super.getDrawUnit then return the same value:

    override protected function getDrawUnit(program:TextureMaterialProgram, camera:Camera3D, surface:Surface, geometry:Geometry, opacityMap:TextureResource):DrawUnit {
    
    var du:DrawUnit = super.getDrawUnit(program,camera,surface,geometry,opacityMap);
    du.culling = Context3DTriangleFace.NONE; // <-- THIS MAKES THE MATERIAL TWO SIDED!
    return du;
    }
    

    Source: http://forum.alternativaplatform.com/index.php?showtopic=3986&p=22123

     
  • Pablo 9:04 PM on 18 June 2014 Permalink | Reply  

    AGAL, PNG blending & Transparency (bug)? 

    So, to make this short, i was trying to find out how to make a fragment shader to be able to put several PNGs one on top of the other and have them mix togheder, i achieved that by using this code:

    • t3 = temporal variable.
    • t0 = transparentPNG with just lines and shading. It is a “tex”… a png that has just shading information.
    • t2 = base color “skin color”.  Just a color, no alpha. 
    • c1.w = 1 the number one.

     

    "sub t3.xyz, t0.xyz, t2.xyz", // shading color - base color.
    "mul t3.xyz, t3.xyz, t0.w", // multiply the above value by the alpha value of the shading layer.
    "add t2.xyz, t2.xyz, t3.xyz", // add the above value to the base color.

    That works fine, BUT it has an issue. If you draw a semi transparent white line for example, since colors in PNG are premultiplied by their alpha values, you will get a greyish color on top of the base color. So white %50 alpha will make the color below to look darker. To solve that, you have to remove the premultiplication ( idk if there’s a more optimal way to solve this, this is how i did it with the knowledge i have right now…). The color components of a PNG are multiplyed by their alpha component. If you divide them by their alpha you will inverse the operation, obtaining the original color without alpha.

     "div t0.xyz, t0.xyz, t3.w" , //Remove premultiplication by dividing by the alpha.
    "sub t3.xyz, t0.xyz, t2.xyz", 
    "mul t3.xyz, t3.xyz, t0.w",
    "add t2.xyz, t2.xyz, t3.xyz"

    Now there’s another issue. In SOME computers, it will work fine. but in some others, the new line added will turn fully transparent pixels into black pixels. Any pixel that has an alpha values greater than cero will look fine…. to solve that, you have to remove the premultiplication using a new number, that will be equal to the alpha value of the shading layer BUT it will be 1 (fully opaque) if the alpha value is equal to CERO. Final code…

     "sub t3.w, c1.w, t0.w", // t3.w = 1 - alpha value of shading layer. ( c1.w = 1 )
    "sge t3.w, t3.w, c1.w", // t3.w = 1 if the value above was CERO, else ONE
    "add t3.w, t3.w, t0.w", // now we ADD the alpha value. CERO will turn into ONE, the rest will remain the same.

    "div t0.xyz, t0.xyz, t3.w" ,
    "sub t3.xyz, t0.xyz, t2.xyz",
    "mul t3.xyz, t3.xyz, t0.w",
    "add t2.xyz, t2.xyz, t3.xyz"

    now it should work fine and the PNG will blend correctly with the base color just like in photoshop.

    If you (the reader) know a better solution, please post it as a comment below, because i want to know how to do this properly. I’m just starting to learn this, so mabe i just made a complete mess and i dont know it. 

     
  • Pablo 11:42 AM on 1 June 2014 Permalink | Reply  

    “Stack underflow” error only in Release mode. 

    Today i came across a very weird error, that showed, only in release mode:

    VerifyError: Error #1024: Stack underflow occurred.

    Apparently, after googling the web, it happens (one of the many reasons…) when the compiler compiles by error a trace statement. 

    In general, trace() calls get ignored in release mode, but if they appear in the code in non conventional ways, they can enter the swf file and trigger that error.

    In my case, i was tracing something if some condition was true, but i wrote it this way: 

    some_variable && trace(“variable is true”);

    apparently that was the error making the trace enter the published swf bytecode. 

    My solution was to remove that line and i wont be using that type of tracing anymore. 

    More usefull info about this subject here: 

    http://stackoverflow.com/questions/6270837/how-to-debug-a-runtime-stack-underflow-error

     

     
  • Pablo 8:48 PM on 17 May 2014 Permalink | Reply  

    UV Scrolling Material for Alternativa3D 

    Originally created by David Jones i modified his class in order to add this features:

    1. currentFrame set/get property. Number of frame from the Texture Atlas used.
    2. Allows to specify which padding you used in the texture atlas (the empty pixels surrounding each frame/sprite) This  is usefull because if all the Sprites are next to each other you will see the borders acting weird. Leave a padding of 2 pixels to have clean borders. (remember the padding is the same you use when creating the TextureAtlas)
    3. Make it work with a bidimensional texture atlas. When you export a MovieClip from Flash as a texture atlas, it will wrap the sprites if they go outside the width of the image. The class can guess how many sprites per row because it assumes all sprites have the same size. This class is meant to be used to animate, so all sprites must have the same size.
    4. Allows to scroll the opacityMap aswell. You have 2 choises: 1) scroll the same way as the diffuse map. 2) do not scroll, use the entire map.
    5. Allows to set a custom “totalFrames”, because flash sometimes creates a big image to make it a power of two and not every inch of the image is used by sprites. So you can manually set how many frames the atlas has. Else, it will be calculated based on the image dimensions and how many sprites can hold the width and height (taking into account the padding also)

    Download the class and example files.

    LIVE DEMO (click image below, no preloader 172kb):

    You will see in the demo, in the left, the UVScrollMaterial is set to not scroll the opacityMap. In the right, the opacityMap is treated also as a textureAtlas in the same way as the Diffusemap. Both in sync.

    Imagen

     

     
    • David 12:56 PM on 18 June 2014 Permalink | Reply

      Nice work man, i like the improvements!

      • Pablo 8:43 PM on 18 June 2014 Permalink | Reply

        thanks, since then i been digging a bit more into AGAL, so i had made a few more materials for my game to be able to change skin colors, faces, etc… but im working with fragment shaders only so far, and just manipulating colors (blendings), nothing fancy like lighting and stuff like that. My knowledge so far is very basic.

        Finally, the game im making is gonna be multiplayer (turn based, not realtime) i’m almost about to finish it. Would you be interested in becoming a BETA tester when it gets to beta stage?

      • Pablo 9:07 PM on 18 June 2014 Permalink | Reply

        check out this post, i wodner if you know something that i’m missing mabe?

        http://tracehello.wordpress.com/2014/06/18/agal-png-blending-transparency-bug/

        it is about creating a shader to stack PNGs one over the other.

  • Pablo 9:04 AM on 6 November 2013 Permalink | Reply  

    Chrome making weird random requests 

    I was working with fiddler and came accross some weird requests that chrome was doing to some random hosts, all thouse requests always failed, apparently this is not a malware or virus, it seems that chrome does that to prevent DNS Hacking to happen and altering it’s autocompletion behaviour.

    More reading here:

    This is actually legitimate behaviour. Some ISPs improperly respond to DNS queries to non-existent domains with an A record to a page that they control, usually with advertising, as a “did you mean?” kind of thing, instead of passing NXDOMAIN as the RFC requires. To combat this, Chrome makes several HEAD requests to domains which cannot exist to check how the DNS servers resolve them. If they return A records, Chrome knows to perform a search query for the host instead of obeying the DNS record so that you are not affected by the ISPs improper behaviour.

     

    More:

    http://serverfault.com/questions/235307/unusual-head-requests-to-nonsense-urls-from-chrome

    http://productforums.google.com/forum/#!topic/chrome/hl0Knv7p4-4

     

     
    • locoma 1:28 AM on 17 March 2014 Permalink | Reply

      that is actually kind of awesome

    • Georgefix 5:35 AM on 19 March 2014 Permalink | Reply

      мошенники – мошенники в интернете, черный список интернет магазинов мошенников.

  • Pablo 8:31 PM on 5 August 2013 Permalink | Reply  

    AS3 Shell Sort vs Array.sortOn 

    I came across with this algorithm Shell Sortinghttp://wonderfl.net/c/ihy9

    It is faster than Array.sort only if you sort Numeric arrays, if you try to sort objects, like when you sort DisplayObjects on their X or Y properties, then the Array.sortOn is WAY faster. So, for sorting objects, Array.sort it’s still the fastest option.

    If you want to sort an array of numbers, then Shell Sort is faster.

     
  • Pablo 9:07 AM on 14 July 2013 Permalink | Reply  

    Sony Vaio Backlit control 

    I was removing bloatware from my vaio laptop and somehow i ended up with the keyboard shutting down the lights a few seconds after i clicked a key. Going to start > Control Panel > Vaio Control Center did nothing when changing the Keyboard and Mouse settings to keep the lights always on.

    The solution? I accidentally disabled the service called VAIO Event Service, which manages the event flow between the hardware and the VAIO control center. So i enabled that service by typing services.msc in the search box of windows, and regain control of the backlit functionality using the vaio control center.

     

     

     
  • Pablo 4:50 PM on 12 July 2013 Permalink | Reply  

    [SOLVED] Embedding bold font in AS3 Flash dynamic field 

    I has going insane trying to make this work… when you have a Dynamic TextField in flash, and you use HTML text with it, to make the itallic and bold fonts work you have to:

    1. embed each variation of the font.
    2. In the flash ide, type “bold itallic normal” inside the Dynamic TextField and give a bold style to the bold word, an itallic style to the itallic word and leave the other normal…

    Now, when you set the HTML using AS3, the <b></b> and <i></i> tags will work as espected using the embeded fonts.

    Idk why, but if the TextField doesn’t contains a bold font it wont show bold text… this is probably a bug or something…

    PS: im using Flash CS6. Hope this helps someone…

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Follow

Get every new post delivered to your Inbox.