Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
Are you wanting T to be a generic type? I think you’re just missing the <T> after the class declaration..
Monkey1Class Store<T>For something that’s still pre-release I’d say it’s very stable, and also very fast
I use a javascript linter which basically underlines syntax and other common errors like undefined variables (picks out typos), and it also alerts to bad coding practices, like only putting an “end” instead of “end if” as I’ve been doing
There’s some more info about the SublimeLinter here http://www.sublimelinter.com/en/latest/about.html
That actually raises an interesting point, I always used a prefix for classes to avoid potential clashes with other mods, but now we have namespaces I guess that’s not so necessary.
Thanks for the new version
I wonder how easy a monkey2 Linter would be to make…
Thanks! All fixed now. Thought there might be other issues as I had to merge some changes but obviously couldn’t test
Got this pretty much all working now
I do have one issue though, I just started updating the docs but now for some reason it hangs when compiling, doesn’t get passed “Parsing”:
[/crayon]Monkey123456[crayon-5cba91cf99207484642078 inline="true" ]C:\monkey2\bin>mx2cc_windows makemods timelinefxMX2CC V0.011***** Making module 'timelinefx' *****Parsing...I’m not sure sure what I’ve done other then add in some docs. Latest version is on github: https://github.com/peterigz/timelinefx.monkey2
Ahh the end if fixed most issues, thanks. It still doesn’t seem to highlight Interface or Class though eg:
Monkey12345678Interface tlQuadTreeEventMethod doAction:Void(ReturnedObject:Object, Data:Object)Method doAction:Void(ReturnedObject:Object, Data:Object, Result:tlCollisionResult)EndClass tlQuadTreeEndThanks for this
For some reason sometimes things don’t get highlighted (see attched), any idea why that might be? Sometimes other things like Method or Class don’t get highlighted either.
Attachments:
Thanks Mark, yes I actually realised what you meant about the += and edited my post before you saw I think. I did add that operator to my vec class and it did help so that’s good.
That’s good about Top too, I was hoping it’d be the same as Last
Thanks, fixed. Although I still have work to do on some of those quadtree methods. Is there an equivalent to .Last for stacks by the way? I’m guessing Top is the same as First?
I see what you mean about += operator, yes that does seem to sort it. The Clone method really kills it though (about 500k less), a bit odd?
[/crayon]Monkey123[crayon-5cba91cfa44aa314469513 inline="true" ] Method Clone:tlVector2()Return New tlVector2(x, y)EndBut then again I get different results elsewhere and clone seems fine. I think I’ll just put it down to the compiler and how it evaluates things in its own exotic way!
My latest round of optimisations is now up to 5.6mill/sec which I’ll settle for for now, really pleased with that. I’ve learnt quite a few things along the way, and also some oddities. It’s definitely ok to modify the fields of a struct in some cases so I won’t worry to much about that, for example this:
[/crayon]Monkey123456789[crayon-5cba91cfa77f7588486945 inline="true" ] Method TFormBoundingBox()'After the bounding box is updated, it needs to be moved into world space.boxoffset.x = tl_corner.xboxoffset.y = tl_corner.ytl_corner.x+=world.xtl_corner.y+=world.ybr_corner.x+=world.xbr_corner.y+=world.yEndworked out quicker than:
[/crayon]Monkey123456[crayon-5cba91cfa77fe346607620 inline="true" ] Method TFormBoundingBox()'After the bounding box is updated, it needs to be moved into world space.boxoffset = tl_corner.Clone()tl_corner+=worldbr_corner+=worldEndSo I guess if your struct already exists and you need to clone it or change values then it can be ok. But in this case:
vec.Normalise()
Where the normalise method modifies the fields of the vector was quite a bit slower than:
vec = vec.Normalise()
Where it returns a new normalised vec. It’s really nice that mx2 gives you that extra control to make a difference with the speed of a program.
I think I’ll aim towards the immutable approach as that seems to make more sense to me, and it helps to make structs stand out more in my head. I’m happy that just using them as they are is enough for a big speed boost
I looked at circular queues for particles; they look interesting but unfortunately my particles are quite complex with variable lifetimes, so will just have to use a normal stack I guess.
Try adding
New AppInstance
At the start of main, I think that initialises a load of stuff in mojo so it’s ready for use.
That’s interesting, so if I have a method in a struct it shouldn’t modify the field values I should create a new struct with updated values and return that? It’s making more sense now, I still have it in my head that creating things puts load on the GC but of course that doesn’t happen with structs because they’re on the stack. It seems kind of the other way round with structs in that it’s cheaper to create and let them go rather then change their values.
Thanks for the info on particles I’ll look into that
Vec2 in std needs a type to specify whether is an integer or a float vec, so you can use either 1 of 2 aliases:
Monkey12345Local vec1:Vec2i 'integerLocal vec2:Vec2f 'Float'or justLocal vec3:Vec2<float> - 
		AuthorPosts
 
		
		
	
