Forum Replies Created
-
AuthorPosts
-
I think it uses some png compression by default thus artifacts.
PNG uses loseless compression – if there are artifacts it’s a bug (possibly mine or STBs).
Also I found that mx2cc allow us to write weird code:
That *is* pretty weird, but it sort of makes sense (to me). I guess it’s a bit like x+=Null where x is an int. I can live with this wrinkle. All other results are what I’d expect (and what I think people would intuitively expect) anyway.
So I don’t even know where to begin.
Welcome to my world!
Perhaps try and get a plain WebSocket javascript test app working with your server first? This would probably be my approach – make sure server is working before trying to get clients working, as at this point it’s not even known whether monkey2 sockets work with emscripten. I’d actually be surprised if there’s not some tinkering required, as there has been on EVERY os so far.
GetValue <T>:T ( key:String,value:T=Null )
I quite like this, but I thought your original point was that GetValue should *fail* if ‘key’ can’t be found? I actually like this idea. Perhaps we could have both, eg:
Monkey123Method GetValue:V( key:K )Method GetValue:V( key:K,defaultvalue:V )In this case, it’d be possible to get exactly current behaviour by using ‘GetValue(key,Null)’ but it’d also pick up existing bugs where you expected something to be in a Map but it wasn’t.
> There is an default (t) in c#
This is pretty much ‘Null’ in monkey2, eg:
Monkey12GetValue:T( key:String,value:T=Null )should be about equivalent (as long as type of ‘T’ can be determined of course).
This is largely why I made Null ‘context sensitive’ (again – it was in bmx, I goofed in monkey1) – so that generic methods etc. could ‘Return Null’ and so on without caring what type was being returned.
Indeed, in monkey1 containers there is some awful code like:
Monkey12345678Global _NULL_:TMethod Get:T()...blah...Return _NULL_EndJust to get the same behaviour you can now get in monkey2 from ‘Return Null’! You learn more from your mistakes than your successes etc.
Is there ANY way I can send and receive data over the internet using Emscripten?
You will need to set up a server that handles the websocket protocol I believe. I have no idea how to to this myself, but according to this it may be possible to do in monkey2:
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers
It doesn’t look *that* painful, although I wont be attempting myself anytime soon sorry. And getting it hosted is another issue altogether if you don’t want to run the host yourself. But if you do get something going I’d be happy to help if I can.
If f1 returns 5 and f2 returns 10 then f1+f2 should return 15.
Nothing is being invoked though and IMO, f+=f1 should ‘mean’ the same as f=f+f1, regardless of the types of f and f1.
operator += is used as ‘subscription’ operator for a long time
Bah! I hate this ‘reasoning’ for adopting something! To me, ‘+=’ only makes sense because it is possible to ‘add functions’ in the first place with ‘+’ (well, it’s supposed to be…). So there is no ‘subscription’ operator, there is just function addition and ‘+=’ is just an assignment shortcut like all the other forms of ‘+=’.
Returning ‘null’-values of different types can be very insidious.
You’re probably right, although it does allow the above ‘magic’ to work. Ditto other tricks like non-intrusive ref counting, eg: ‘_refs[obj]+=1’ will ‘just work’.
I’m not really opposed to changing it so that [“blah”] where “blah” is not in the Map causes a runtime error instead. I doubt it’ll cause many/any problems in existing code, but it will break the code at the top you were initially so happy about! Will think about it…
I feel like I still don’t take full advantage of first class functions, even though I understand how they work now
I’m a bit the same way, still learning a lot of this stuff. I do think ‘signals’ (ie: ‘Field Changed:Void()’ style members) are often a way better way to go than virtual methods in many situations.
Is it expected behaviour?
Almost, you’re definitely supposed to be allowed to chain functions together, although ‘f=f+F2’ should work too, will fix!
and passing by reference could be useful in some designs!
I do have a safer ‘Var’ feature on an internal language features todo list…
December 1, 2017 at 7:54 pm in reply to: Rotation and Draw Primitives at Virtual Resolutions using native res? #12062Actually, my idea is bollocks anyway, it’d just ‘pointilize’ everything.
Nope, this cannot be done.
Yeah, mojo3d bananas are really just ‘tests’ right now – ditto with mojo3d-loaders and mojo3d-physics.
In fact, I’m trying to get into the habit of adding more tests to modules so it can pay to have a browse through the entire modules dir.
Hopefully it all makes sense though – that is my goal!
camera.Rotation = Null ‘ Entity.Rotation is not a thing. Boo!
This should work! I just tested entity.Rotation by adding this at the top of OnRender in (very latest) ducks demo:
Monkey123Local yrot:=_ducks[0].Rotation.y_ducks[0].Rotation=New Vec3f( 0,yrot+1,0 )_ducks[0].Rotation=Null also works here too…
[edit]
Maybe Rx / Ry / Rz extension properties are what you searching for.
Bingo. Just went to add pitch, yaw, roll, and they’re already in there as Rx, Ry, Rz, LocalRx, LocalRy, LocalRz. I may add Pitch, Yaw, Roll equivalents too…will think about it.
Also Vec3 struct have Yaw and Pitch properties, but suddenly haven’t Roll.
Vec3 has never had roll – vectors in general can’t have roll as they are infinitely thin, ie: there is no ‘sideways’ *to* roll! Matrices can though as they really represent an entire ‘space’.
Very cool!
It’s like a magic – we don’t put value into Map
The magic here is thanks to this code…
Monkey12evt["walk"] += Lambda()...…being converted by monkey2 to…
Monkey1234Local tmp:=evt["walk"]tmp+=Lambda()...evt["walk"]=tmpFor the first line, since the map doesn’t actually contain “walk”, a null value is returned by evt[“walk”].
A null function value is a NOP function (ie: it doesn’t do anything and returns ‘null’) but is still a normal, valid function (just like a null int, ie: 0, is a normal int) and can therefore be used with ‘+’.
The last line is what actually puts the value into the map – magic!
November 30, 2017 at 7:28 pm in reply to: Rotation and Draw Primitives at Virtual Resolutions using native res? #12042Can’t think of anything off hand. Possibly a shader could be used to ‘snap’ vertices, but then you’d end up with a lot of overdraw and it would be likely to be considerably slower.
I think the ‘draw stuff offscreen’ approach is pretty much the way HW expects things to be done these days. I have also recently found a ‘blit framebuffer’ GL extension that should make this even faster in some cases, not that I’ve ever found it to be too slow or anything so far.
-
AuthorPosts