Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

  1. Tchom

    Day-night cycle colors

    Awesome. Thanks bid
  2. Tchom

    Day-night cycle colors

    I'm working on a 2d farming rpg and I've written a shader that tints the scene based on that time of day it is in the game. What I'm trying to work out is what RGB values should correspond to what time of day. Does anyone have any ideas or references?
  3. Tchom

    What Language Do I Use?

    FlashDevelop is an extemely useful and free editor for AS3 development (with rad code-hinting)
  4. The two languages aren't really comparable in that  way. AS3 is a high-level language, with very abstracted graphics drawing. If you're after a gentle transition from AS3 to something else, I'd suggest Java over C++ as its more similar (though, probably not quite as useful in the long run) and OpenGL. If you have an Android device, Java and OpenGL ES is a lot of  fun to learn. I'd also suggest OpenGL ES2 over OpenGl 1.x as well, because its almost the same standard as WebGL and writing your own shaders is a useful life-skill. I'm sure what I just said is probably a  lot to  take in, but just do some research  into the things I just mentioned and it might help you decide where to go next. I've been a Flash programmer for a couple of years and have been transitioning to other languages to make games and this was a comfortable road for me. Of course, if you're just trying to make a game as quickly as you can, Unity is a pretty neat engine with a lot in common with Flash.
  5.     Yeah, I worked that out with some experimentation .   Is there a more typical way to colour light?
  6. I implemented those suggestions and that helped heaps. I had my own brainwave (slapped myself for not thinking of it before), and added a limit to the distance from the light that attenuation and colour would be calculated at.   if(distance < limit) { diffuseDiff = clamp(dot(v_Normal, lightVector), 0.0, 1.0); diffuseDiff = diffuseDiff * (1.0 / (1.0 + (u_LightPower* distanceSquared))); gl_FragColor.rgb *= vec3(1.0) / ((vec3(1.0) + ((vec3(1.0) - u_LightColours)*diffuseDiff))); } Hopefully that might help someone else
  7.   Oops, sorry about the confusion. I come from a Flash background, so I'm stuck in the habit of using FPS as a measurement of efficiency (I'll get better). My original and target speed was 16.6ms per frame, but it increase to 22.ms after three light, 33.3ms after four, etc etc.   What's the theory behind this line? Is it necessary?   This line determines how much to tint the fragment's rgb by each light's rgb. If 'diffuseDiff' is 0, then gl_FragColor.rgb would just be multiplied by vec3(1.0). If 'diffuseDiff' is 1, gl_FragColor.rgb is multiplied by the full value of vec3(u_LightColours[i]).   Thanks heaps guys. I'll try implementing this when I get home from work and report back on the difference. I really appreciate the help.
  9. Is it null when you pass it into the renderer? Or just after you call Render()?   It may be you're trying to render before the bitmap is finished loading. Try:   package { //import stuff public class Renderer { var mBitmapData:BitmapData; var mPoint:Point ; var mRect:Rectangle ; var mDisplayBD:BitmapData; public function Renderer(bitmapdata) { mBitmapData = bitmapdata; this.mDisplayBD = bitmapdata; mPoint = new Point(); mRect = new Rectangle(); mPoint.x = 0; mPoint.y = 0; } public function LoadBitmap(URL:String) { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, OnComplete); loader.load(new URLRequest(URL)); } private function OnComplete(event:Event) { mBitmapData = event.target.content.bitmapData; } public function Render(posX,posY,clipX,clipY,width,height) { if(mBitmapData != null){ mDisplayBD.lock(); mPoint.x = posX; mPoint.y = posY; mRect.x = clipX; mRect.y = clipY; mRect.width = width; mRect.height = height; mDisplayBD.copyPixels(mBitmapData,mRect,mPoint); mDisplayBD.unlock(); } } } }
  10. I'd use a 3d-engine with orthographic projection. 
  11. I think class variables in AS3 are internal  by default.    have you tried:   public class Entity extends Sprite { protected var mPosX:Number; protected var mPosY:Number; public var renderer:Renderer; or use a getter function public class Entity extends Sprite { protected var mPosX:Number; protected var mPosY:Number; protected var mRenderer:Renderer; public function Entity():void{ ... } public function get renderer():Renderer{ return mRenderer; }         :
  12. @L.Spiro   Thank you! Great answer and a super helpful link! I really appreciate it!
  13. Hey guys, I looking for some advice/insights into render batching. I've been building my own game engine for Android (OpenGL ES 2.0) and at the moment, I feel like I am handling my game object rendering very inefficiently.   Currently, I have GameObjects that have are stored in a list in a GameWorld. GameObjects have a reference to a texture and a mesh. At the moment, all I do is loop through the GameObjects in my renderer, binding textures and unbinding them object by object. My understanding is that binding is quite an expensive process. So, I guess my question is... does anyone have an elegant way to handle this?   Some of the ideas I had were:   - Sort the GameObjects list on the texture id (possibly also expensive to do) so that objects with the same texture render together - Instead of an array with everything in it,  GameObjects of the same type are kept in their own arrays, and each one of those is looped through with only one 'bind' call required per group.   I hope I was clear enough to create some idea of where I'm at and what I'm trying to do, I can't wait to hear your feedback.
  14. Tchom

    New to Coding - Strategy Game

    For a browser based game, I'd suggest coding with Javascript/HTML5. There is a very strong course on Udacty (which is also free), that can teach you most of the stuff you'll need to know code-wise.
  • Advertisement

Important Information



Sign me up!