Announcement

Collapse
No announcement yet.

WorldSpawn official WIP thread

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • lol, found this in my code Well, at least it is consistent . It could be worse, right? I could have just made a long string of every constant equaling the next and ending with = Number.POSITIVE_INFINITY; Actually I couldn't really do that since it's constants but, you get the idea.

    I know the reason I did this. BSP2 has extended limits and I didn't/don't know what they are. My engine would throw errors regarding MAX's being exceeded when I tried to load a BSP2 so I just made it all a number so far out in space it would crash long before it ever reached it... but hopefully not crash and simply let me load the damn bsp.

    Code:
    		// fuck this stupid file. these were quake limits but they aren't mine
    		// set everything to a gabillion and worry about the truth later
    		public static const MAX_HULLS:uint		= 9999999;
    		
    		public static const MAX_MODELS:uint		= 9999999;
    		public static const MAX_BRUSHES:uint		= 9999999;
    		public static const MAX_ENTITIES:uint		= 9999999;
    		public static const MAX_ENTSTRING:uint		= 9999999;
    		
    		public static const MAX_PLANES:uint		= 9999999;
    		public static const MAX_NODES:uint		= 9999999; // because negative shorts are contents
    		public static const MAX_CLIPNODES:uint		= 9999999;
    		public static const MAX_LEAFS:uint		= 9999999; //johnfitz -- was 8192
    		public static const MAX_VERTS:uint		= 9999999;
    		public static const MAX_FACES:uint		= 9999999;
    		public static const MAX_LFACES:uint 		= 9999999;
    		
    		public static const MAX_TEXINFO:uint		= 9999999;
    		public static const MAX_EDGES:uint		= 9999999;
    		public static const MAX_LEDGES:uint		= 9999999;
    		public static const MAX_TEXTURES:uint		= 9999999;
    		public static const MAX_MIPTEX:uint		= 9999999;
    		public static const MAX_LIGHTING:uint		= 9999999;
    		public static const MAX_VISIBILITY:uint 	= 9999999;
    MAX_HULLS was actually still set at 4. I set it to 9999999 in the post cause it's hilariously stupid
    Last edited by MadGypsy; 06-06-2017, 02:51 PM.
    http://www.nextgenquake.com

    Comment


    • I never understood engine limits. If the map is too big to run smooth, the author will need to revise his map. Why force him to revise if its not necessary?
      'Replacement Player Models' Project

      Comment


      • I agree with you and disagree with you. I agree in the sense that using 20 year old quake limits is useless but I agree with limits in the sense that current engine limits should be defined. Without defined limits my engine would just crash but with them my engine will throw an error that tells the author exactly what has to be addressed. However, in many cases the author will have a headache over the error. Consider if MAX_LEAFS was exceeded.
        http://www.nextgenquake.com

        Comment


        • Yeah, thats a fair point. The only thing worse than a crash is an unexplained crash
          'Replacement Player Models' Project

          Comment


          • I've learned to juggle buffers fairly well. I mean somebody like spike or maybe even Baker may disagree with how I am doing something for some technical reason that I am unaware of, but mostly everything seems to run well no matter how much shit I throw at the GPU. The only exception is dynamic light. I know why dynamic light is so crappy, though. I'm just not sure how to fix it. Light is definitely not a strong suit for me by any stretch of the imagination. If it was up to me to invent light, every game would either be black as night or fullbright... Lol. I straight up don't understand the math. I am confident I could learn the math but someone would have to one-on-one teach me. Reading technical studies and watching videos just leaves me even more confused. I watched something with Carmack explaining light and I think my brain melted long before I stopped watching the video.
            http://www.nextgenquake.com

            Comment


            • @MadGypsy
              Thanks for explanation!

              My god. I write and supervisor. I have last day I got problem with my left eye. But I need take rest because my doctor says I shouldn't use much at computer. Sorry for long wait for my bsp. I am still writing and fixing structure...

              I don't know if you always use "forEach(function): But It is maybe bad performance because forEach(function(...):void); is really 20x or 30x slower than for loop. If you check for loop performance example:
              Code:
              package
              {
              	import flash.display.Sprite;
              	import flash.text.TextField;
              	import flash.utils.getTimer;
              	
              	public class TestFor extends Sprite
              	{
              		public function TestFor()
              		{
              			var time:uint = getTimer();
              			var vec:Vector.<Number> = new Vector.<Number>;
              			for ( var i:int in vec)
              			{
              				vec[i] = 1;
              			}
              			
              			var tf:TextField = new TextField();
              			tf.width = 200;
              			tf.x = tf.y = 5;
              			tf.text = "for: "+(getTimer()-time)+"ms";
              			addChild(tf);
              			
              			for each(var j:int in vec)
              			{
              				j = 2;
              			}
              			
              			var tf2:TextField = new TextField();
              			tf2.width = 200;
              			tf2.x = 5;
              			tf2.y = 25;
              			tf2.text = "for each: "+(getTimer()-time)+"ms";
              			addChild(tf2);
              			
              			vec.forEach(
              				function(k:int, ...args):void
              				{
              					k = 3;
              				}
              			);
              			
              			var tf3:TextField = new TextField();
              			tf3.width = 200;
              			tf3.x = 5;
              			tf3.y = 45;
              			tf3.text = "for: "+(getTimer()-time)+"ms";
              			addChild(tf3);
              		}
              	}
              }
              Nice test for example fast performance with for loop vs forEach(function(...):void)


              I try other method with UrlLoader like PaperQuake ( very old initial Quake works under Flash 9 / 10 / 11.2<. ) Github PaperQuake

              I write just halflife.wad loads UrlLoader and format is binary.
              Code:
              package
              {
              	import flash.display.Bitmap;
              	import flash.display.BitmapData;
              	import flash.display.Sprite;
              	import flash.display.StageAlign;
              	import flash.display.StageScaleMode;
              	import flash.events.Event;
              	import flash.net.URLLoader;
              	import flash.net.URLLoaderDataFormat;
              	import flash.net.URLRequest;
              	import flash.utils.ByteArray;
              	import flash.utils.Endian;
              	
              	public class TestWadLoader extends Sprite
              	{	
              		private var loader:URLLoader;
              		private static const MAX_PALETTE_COLORS:int	= 256;
              		private static const MAX_NAME_LENGTH:int	= 16;
              		private static const QCHAR_WIDTH:int		= 16;
              		private static const QNUM_GLYPHS:int		= 256;
              		
              		public function TestWadLoader() 
              		{
              			if (stage) init();
              			else addEventListener(Event.ADDED_TO_STAGE, init);
              		}
              		
              		protected function init(e:Event = null):void
              		{
              			stage.align = StageAlign.TOP_LEFT;
              			stage.scaleMode = StageScaleMode.NO_SCALE;
              			stage.frameRate = 120;
              			
              			/**
              			 * Load path halflife.wad to loader
              			 */
              			loader = new URLLoader();
              			loader.dataFormat = URLLoaderDataFormat.BINARY;
              			loader.addEventListener(Event.COMPLETE, onLoadComplete);
              			loader.load(new URLRequest("halflife.wad"));
              		}
              		
              		protected function onLoadComplete(e:Event):void
              		{
              			loader = e.target as URLLoader;
              			parse(loader.data);
              		}
              		
              		protected function parse(ba:ByteArray):void
              		{
              			ba = new ByteArray();
              			ba.endian = Endian.LITTLE_ENDIAN;
              			ba.position = 0;
              			
              			if(ba.readMultiByte(4, "iso-8859") != "WAD3")
              				throw new ArgumentError("Invalid or unsupported Wadf file");
              			
              			var cnt:int = ba.readInt();
              			var ofs:int = ba.readInt();
              			
              			var directories:Vector.<Object> = new Vector.<Object>(cnt);
              			
              			ba.position = ofs;
              			
              			var width:int, height:int, x:int, y:int, alpha:uint;
              			var pixels:ByteArray 		= new ByteArray();
              			var indexes:ByteArray		= new ByteArray();
              			var palette:Vector.<uint>	= new Vector.<uint>(MAX_PALETTE_COLORS);
              			var bmd:BitmapData;
              			
              			for(var n:int = 0; n < directories.length; n++)
              			{
              				directories[n] = {
              					offset:		ba.readInt(),
              					csize:		ba.readInt(),
              					dsize:		ba.readInt(),
              					type:		ba.readByte(),
              					comp:		ba.readBoolean(),
              					dummy:		ba.readShort(),
              					name:		ba.readMultiByte(MAX_NAME_LENGTH, "iso-8859-1")
              				};
              			}
              			
              			for(n = 0; n < directories.length; n++)
              			{
              				ba.position = directories[n].offset;
              				
              				if(directories[n].type == 0x40 || directories[n].type == 0x43)
              					ba.position = MAX_NAME_LENGTH;
              				
              				width = ba.readInt();
              				height = ba.readInt();
              				
              				if(directories[n].type == 0x46)
              				{
              					width = 256;
              					ba.position += (8 + (QNUM_GLYPHS * 4));
              				}
              				
              				if (directories[n].type == 0x40 || directories[n].type == 0x43)
              					ba.position += 16;
              				
              				if (indexes.length > 0) indexes.clear();
              				
              				ba.readBytes(indexes, 0, width * height);
              				indexes.position = 0;
              				
              				if (directories[n].type == 0x40 || directories[n].type == 0x43)
              				{	
              					//skip mips - the engine should generate these
              					for (var s:int = 1; s < 4; ++s)
              						ba.position += ((width >> s) * (height >> s));
              				}
              				
              				ba.position += 2;
              				
              				for(var i:int = 0; i < palette.length; i++)
              				{
              					alpha = ((i == (MAX_PALETTE_COLORS - 1)) && (directories[n].name.charAt(0) == "{"))? 0x00 : 0xFF;
              					if (directories[n].type == 0x40)
              						palette[i] = (alpha << 24 | i << 16 | i << 8 | i);
              					else
              						palette[i] = (alpha << 24 | ba.readUnsignedByte() << 16 | ba.readUnsignedByte() << 8 | ba.readUnsignedByte());
              				}
              				
              				if (pixels.length > 0) pixels.clear();				//reset
              				
              				for (y = 0; y < height; ++y)						//pixels columns
              					for (x = 0; x < width; ++x)						//pixels rows
              						pixels.writeUnsignedInt( palette[ indexes.readUnsignedByte() ] );
              				
              				pixels.position = 0;
              				
              				bmd	= new BitmapData(width, height, true);	
              				bmd.setPixels(bmd.rect, pixels);
              				
              				if(directories[n].name == "AAATRIGGER")
              					set_image("AAATRIGGER", bmd);
              				
              				var bm:Bitmap = new Bitmap(bmd);
              				bm.scaleX = bm.scaleY = 4;
              				this.addChild(bm);
              			}
              		}
              		
              		protected var img:Object = {};
              		protected var IMG:Vector.<BitmapData> = new Vector.<BitmapData>();
              		
              		private function set_image(byName:String, bmd:BitmapData):void
              		{
              			if (img[byName] == undefined)
              			{	img[byName] = IMG.length;
              				IMG.push(bmd);
              			} else throw new Error(byName+" already exists in the library");
              		}
              	}
              }
              But it not okay. like error message because wad is null byte, eh?


              Lol. I am using Flash Builder 4.6 without "enable strict mode" I know like FlashDevelop and Visual Studio Code with NextGenAS too
              Who use Mac OS X or Linux than you can use VS Code with NextGenAS

              And did you listen about dts2as? Who doesn't like to create new AS3 library ( swc ) or pure AS3 ( as ).
              If you want Away3D.d.ts into swc or into pure Actionscript 3.

              But dts2as has sometimes critic errors.. .

              Comment


              • I actually knew forEach was slower. And I'm a naughty programmer because I use it anyway due to how the func arguments let me work with every part of the vector. I don't know about 20x slower. That seems a bit of a stretch....maybe that's right but it seems unrealistic.

                edit - According to your numbers it is aboutish 50% slower. Which is substantial in itself. Maybe I'll stop being lazy and go fix all that.

                NextGen As3 is like strong typed JavaScript. I got in an argument with the developer over it and he thinks it's As3 because it uses the same parser. I don't give a fuck what parser he is using, the syntax is strong typed JavaScript with way too long namespaces.

                If I'm not mistaken you can put a Porsche engine in a VW Bug... That doesn't make it a Porsche.
                Last edited by MadGypsy; 06-08-2017, 12:37 PM.
                http://www.nextgenquake.com

                Comment


                • I rewrote all my forEach loops to a standard for loop and made some other small optimizations for my loader, and my first-stage BSP parser. By "first-stage" I mean that all byte data gets parsed to a struct and all images (sans-mips) get parsed to bitmap data and sent to the library.

                  For e1m1, I have from load to completed "first-stage" parse happening in 7/10ths of a second (the number in the ugly text box in the below image).



                  I believe while loops are even faster than for. For some reason I want to say I read that somewhere a long time ago. If so, I could make this parser even faster. I actually could make it even faster right now, regardless because, I am not storing mips but the parser is getting them. I could simply comment out the loop, and copy/paste the guts "loopless" so it only happens once.

                  edit: I commented out the mips part and it saved a whopping 0.013 of a second.
                  Last edited by MadGypsy; 06-09-2017, 08:57 AM.
                  http://www.nextgenquake.com

                  Comment


                  • @SSBoxer

                    Your benchmark script is totally wrong. This is how you do it, bro (below). You can't just keep subtracting time from getTimer without resetting time to the current getTimer() before each operation. Also, why make a textfield for every test? Just append the text to the first TextField. I don't see how you got for...in to work at all*. for...in only accepts string for the iterator because it's only purpose is to iterate the names of an Object.

                    (*Ah) I use strict... cause I want my stuff to work as it was intended. Turning strict off so you can abuse operations is really poor programming. I substituted your for...in with a classic for loop. However, I am really perplexed how you got any of this to work considering you were trying to loop something that you never assigned a length to. That's some amazing and impossible shit right there. Technically your numbers are how long it took to make TextFields and had nothing to do with loops. I ran your script after fixing the for...in error and everything was 0ms. What kind of system do you have? A 133 with 256mb of ram and a completely destroyed registry?

                    Also, you set vec to accept Numbers but your for each had j set as int. Whereas this will fly due to all ints qualifying as a Number it is sloppy and reduces the clarity of the script. I didn't change this next thing I am going to say in the below script but, if you are only going to assign int values why set the value type to Number (float) in the first place? Your "supervision" needs more accuracy.

                    Code:
                    package
                    {
                    	import flash.display.Sprite;
                    	import flash.text.TextField;
                    	import flash.utils.getTimer;
                    	
                    	public class TestFor extends Sprite
                    	{
                    		public function TestFor()
                    		{
                    			var t2:uint;
                    			var tf:TextField = new TextField();
                    			
                    			tf.width = 200;
                    			tf.background = true;
                    			tf.backgroundColor = 0xffffffff;
                    			addChild(tf);
                    			
                    			var i:int = 0;
                    			var vec:Vector.<Number> = new Vector.<Number>(500000);
                    			var t:uint = getTimer();
                    			for ( i; i < vec.length; ++i )
                    			{
                    				vec[i] = 1;
                    			}
                    			
                    			
                    			t2 = getTimer();
                    			tf.text = "for: " + (t2 - t) + "ms";
                    			
                    			t = getTimer();
                    			for each(var j:Number in vec)
                    			{
                    				j = 2;
                    			}
                    			
                    			t2 = getTimer();
                    			tf.appendText("\nfor each: " + (t2 - t) + "ms");
                    			
                    			t = getTimer();
                    			vec.forEach( function(val:Number, n:int, self:Vector.<Number>):void
                    				{
                    					val = 3;
                    				}
                    			);
                    			
                    			t2 = getTimer();
                    			tf.appendText("\nforEach: " + (t2 - t) + "ms");
                    			
                    			t = getTimer();
                    			i = -1;
                    			while ((++i) < vec.length)
                    			{
                    				vec[cd] = 4;
                    			}
                    			
                    			t2 = getTimer();
                    			tf.appendText("\nwhile: " + (t2 - t) + "ms");
                    			
                    		}
                    	}
                    }
                    and as you can see, nothing is faster than a while loop. I tested this script about 25 times and while is always 0.


                    here is a benchmark with 1 million iterations. The while benchmark is more accurate this way. With only 500000 iterations it was probably claiming 0 milliseconds because it was completing faster than flash could update it's internal time. This makes sense because half of 16ms is 8ms and flash is probably updating every 10ms...or so. It actually has to be a little faster than that or it would be impossible to get time that wasn't a multiple of 10. Also, by using int for the timer is a cheap way of using Math.round(). In other words (ex) var i:int = 1.3; won't throw an error. It will return 1. I never checked if the getTimer() func returns a Number but if it does capturing it with int is reducing accuracy.
                    Last edited by MadGypsy; 06-09-2017, 10:22 AM.
                    http://www.nextgenquake.com

                    Comment


                    • @But it not okay. like error message because wad is null byte, eh?

                      you are sooooo determined to try and circumvent the perfectly good loader package I gave you (Importer.as and dependencies). I do not understand why. How many times do you have to get a bunch of errors and problems before you realize you are wasting your time?

                      Why are you throwing ArgumentError if magic isn't "WAD3"? ArgumentError IMO is just a way for you to write shitty code. Let's say you had a function and it needed to accept multiple types but not just any type. You could check the type in the function and if it doesn't qualify as one of the types yu want you could throw an ArgumentError. However, this is terrible programming methods. In order to make this work your argument would have to be a wildcard. So, basically ArgumentError promotes you to do your own type checking. That's dog shit code.The proper way to do that would be to create an interface and implement it with your own custom types. Then the function could accept the interface as the type allowing you to put anything that implements the interface into the function as an argument.

                      for instance, let's assume you wanted to allow a function to accept any array-like type. You don't use a wildcard and then check for length or something, followed by throwing an ArgumentError if the value does not have a length. You would do something like...

                      public interface Iterable...

                      public class CustomArray implements Iterable extends Array...
                      public class CustomVector implements Iterable extends Vector...

                      public myFunc(arg:Iterable)

                      public var myVec:CustomVector;
                      public var myArr:CustomArray;

                      myFunc(myVec) or myFunc(myArr)

                      The reason why is very simple. Let's say you did it the wildcard way and let's say the length property was what determined whether or not the value qualified. Well, string has a length property but, you cannot access the parts of a string with a key. So, your ArgumentError would never be thrown but a new Error of another kind would as soon as it hit a line like this

                      arg[n] = whatever;

                      or this

                      arg.push(whatever);

                      or any other thing that gels with array types but not string type.


                      Why are you casting e.target to URLLoader (the type it already is) and assigning it to your loader? Your class already defines and uses the loader. If anything just ignore e.target and use the loader directly. e.target is just a reference to your loader in the first place (although MAYBE e.currentTarget is your loader). You are basically saying "cast and assign me to a reference of myself" unless it is being stored in .currentTarget which means you are basically casting some nonsense to URLLoader. This is why I wrote a reusable script for loading and managing files. For one, with a reusable script you just use it and you don't have to worry about this stupid shit. For two, why would you want to invent a new loader every time you need to load something? I would highly suggest you study design patterns and understand them. Even though you may not go as far as to program everything to interfaces you will learn some very important concepts and as you get better you can write sort of hybrid scripts that utilize the concepts without bloating your code with the strict design patterns.

                      Here, read this book about 5 times. It's about 600 pages and guaranteed to make you want to cry it is so complex. However, if you are prepared to spend about a year trying to understand it and then about another year getting good at it you will come out of it all as one hell of a programmer. It actually took me around 3 years to lock it down. However, I was super high for that entire 3 years, so....

                      Stop doing this (n++) and do this (++n) instead.
                      Last edited by MadGypsy; 06-09-2017, 12:00 PM.
                      http://www.nextgenquake.com

                      Comment


                      • I turned all my for loops into while loops and now my "first-stage" parse of e1m1 (+ file load) is down to 0.656 thousandths of a second. I seriously doubt I can get it any faster than this. I also made sure that no vars were being created within a loop. I also made sure that as much as possible no vars were instantiated with "new WhateverType()". As much as I could it is all done with direct assignment of results or at the very least a direct assignment of empty (ex) var arr:Array = [];

                        Last edited by MadGypsy; 06-09-2017, 03:04 PM.
                        http://www.nextgenquake.com

                        Comment


                        • Sorry you're right.
                          Yeah you say that. You're angry programmer, uuuh.... That is not nice But I thought any programmers are not angry to forum. If programmers have experiences or have not experiences. That is normal. I am not angry just I am like I have bit experience. That is why. I am sorry for that.

                          I am shy because I forget knowledge since AS3 whole contents.
                          You know I tried to unsupported iterator for Haxe from forEach() like this nice trick.
                          From AS3:
                          Code:
                          directories.forEach( function(val:Object, n:int, dir:Vector.<Object>):void 
                          {	dir[n] = {
                          		offset:		bytes.readInt(),
                          		...
                          	}
                          });
                          To Haxe version:
                          Code:
                          private function forEachDyn<T>(fromVecDyn:Vector<Dynamic>, fn:Dynamic->Int->T):Void
                          {
                          	for (i in 0...fromVecDyn.length) fn(fromVecDyn[i], i);
                          }
                          Result to Main.hx
                          Code:
                          var byte:ByteArray = new ByteArray();
                          byte.position = 0;
                          var myVec:Vector<Dynamic> = new Vector<Dynamic>();
                          forEachDyn(myVec, function(val:Dynamic, n:Int):Void
                          {
                          	myVec[n] = {
                          		offset:    byte.readInt()
                          		...
                          	}			
                          });
                          Or for static method like this CustomIterator.hx
                          Code:
                          var myVec:Vector<Dynamic> = new Vector<Dynamic>();
                          CustomIterator.forEachDyn(myVec, function(val:Dynamic, n:Int):Void
                          {
                          	myVec[n] = {
                          		offset:    byte.readInt()
                          		...
                          	}			
                          });
                          If you want add more parameter than you make sure
                          Code:
                          private function forEachDyn<T>(fromVecDyn:Vector<Dynamic>, fn:Dynamic->Int->Vector<Dynamic>->T):Void
                          {
                          	var vec_dyn:Vector<Dynamic> = new Vector<Dynamic>();
                          	vec_dyn = fromVecDyn;
                          	for (i in 0...fromVecDyn.length) fn(fromVecDyn[i], i, vec_dyn);
                          }
                          I hope my good iterator for haxe helps you.
                          Thanks. Today morning from Germany I have idea from my head. I fix like unsupported iterator for Haxe.

                          // EDIT: If you got common error like "Missing return cpp.Void" tthat it is bug. Before I already tested and compiled successful and minutes later it happens cpp.Void throws error if it hasn't already to execute function from <T>.

                          // EDIT 2: Sorry it is gone fixed.
                          Do not forget! Make sure check "import cpp.Void" exists than you need remove because it is conflict of Haxe-Void and cpp.Void. Lol!
                          Now it fixed
                          Last edited by SourceSkyBoxer; 06-10-2017, 06:37 AM.

                          Comment


                          • Angry programmer...meh, more like disgruntled. I give you working code, basically definitive code so you can move forward and you keep trying to (un/re)write it but, then complain of issues. You waste both of our time with that. I didn't need to strip down and explain the content manager if you weren't going to use it. I wouldn't need to explain your new problems if you would just use it. Did you consider that? I'm not mad, I'm frustrated/disappointed. Considering the circumstances maybe you are a bad student. What good student keeps trying to overwrite the teacher? What teacher wouldn't get progressively more annoyed with that?

                            Put yourself in my shoes. What if you gave me help I needed and I kept wasting both of our time? Would you be "happy programmer". Would you even want to keep helping me?

                            In that, I am actually "super nice programmer". No matter how much you stay stuck on one thing that I already made sure you shouldn't be stuck on, at all, I keep helping you. I didn't have to spend a half hour yesterday pointing out your mistakes... but I did. I could have spent that time programming or getting laid or a number of other things that are more productive to me.

                            Importer.load(filename, handler);

                            public function handler(e:Event):void
                            {
                            if(e.type == Event.COMPLETE) {
                            var thing = Content.someGetter(name);
                            ...do something with thing...
                            } else throw some error

                            }

                            You can put this gist anywhere in your entire source to get anything. The only thing you have to do is make sure "someGetter" exists in the Content class. Why would you want to do this any other way? Why do you keep trying to remake my system by essentially rewriting it everywhere you need a load?

                            @someGetter

                            For instance Content.text(filenameWithoutExtension)
                            In this case "text" represents someGetter. If you need a custom getter like (ex) Content.bsp simply copy/paste one of the getters in Content.as and modify it to point to a new Vector in Lib.as. I don't know how I could make it any more simple. If you are using my RegEx method in Importer.as simply add the new file extension to the appropriate expression. If not, add a new argument for it in the appropriate conditionals.

                            USE MY DAMN CODE! lol
                            Last edited by MadGypsy; 06-10-2017, 07:56 AM.
                            http://www.nextgenquake.com

                            Comment


                            • Meh,

                              I have tried _callBack.call() into Haxe?
                              I think I need to write CallBackForDynVoid(_callback, this, event);

                              Or did you resolve it? I have replaced forEach(function()) into iterator-functions finish and Copy past from Lib because it doesn't recognise objects and Vector<classname>

                              Importer and Content replace both extends EventManager

                              Than I hang off because handle doesn't know haxe so close...

                              Comment


                              • @your HaXe loops

                                That may work but, it is a very bad way to go. Dynamic is the equivalent of a wildcard in your implementation. It can also be an actual Dynamic (ie anonymous struct) and those have incredibly poor performance on static targets because a reverse lookup needs to be performed every time you want a field. Also your code will become heavily bloated as you write a billion lines of Reflect to access those fields. Also we already established that forEach loops are slow in AS3 so, inventing one in HaXe is not going to be fast. Do not use Vector in HaXe except where some other API expects it. Use Array. Go look at Vector.hx and you will see why. However, in a Lib.hx sense I use Map<String, SomeType> and completely forego the (ex IMG[img[someName]]) method.

                                @callback.call() in HaXe

                                Just use callback()

                                I know HaXe was meant to replace and extend As3 but, technically they are apples and oranges. If you intend to program in HaXe the As3 way you are going to have a lot of issues. I have spent about a year deeply studying HaXe and I'm going to tell you flat out at this point in your experience you need to choose one or the other and get good at it. Failure to do so is guaranteed to make sure you never get anything done. I had like 20 years of flash under my belt before I went to HaXe. So, for me, I just had to learn HaXe and I was able to use a shit ton of flash experience as a control. You do not have this luxury.
                                Last edited by MadGypsy; 06-10-2017, 08:25 AM.
                                http://www.nextgenquake.com

                                Comment

                                Working...
                                X