Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
Ahh, cool… thanks, Mark.
Weird, I get an invalid image error on chalky.png here, using latest itch.io release.
Yeah, take your time, we’ll still be here!
Yeah, I did read that, so will just wait, was just amusing myself anyway… at least it sounds like I was using it properly!
Nah, I’ve tried that:
Monkey1234567891011#Import "<reflection>"#Import "<std>"Using std..Function Main ()Print TypeInfo.GetType ("std.graphics.Color") ' Nope!EndThis results in “Caught signal:Memory access violation”.
Don’t get that here on 7!
Been having a bit of fun with this. Add/remove 100 cubes at a time via plus and minus keys:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159#Import "<std>"#Import "<mojo3d>"Using std..Using mojo..Using mojo3d..' ----------------------------------------' Application name...' ----------------------------------------Global AppName:String = "My 3D Game"' ----------------------------------------Function CreateEasyBox:Model (color:Color = Color.Aluminum)Local box:ModelLocal boxmesh:MeshLocal boxmaterial:Materialboxmesh = Mesh.CreateBox (New Boxf (-0.5, -0.5, -0.5, 0.5, 0.5, 0.5))boxmaterial = New PbrMaterial (color)box = New Model (boxmesh, boxmaterial)Return boxEndFunction AddBoxes (stack:Stack <Model>, number:Int)For Local loop:Int = 1 To numberLocal box:Model = CreateEasyBox (New Color (Rnd (0.4, 1.0), Rnd (0.4, 1.0), Rnd (0.4, 1.0)))box.Move (Rnd (-100, 100), Rnd (-100, 100), Rnd (-100, 100))box.SetScale (Rnd (1, 10), Rnd (1, 10), Rnd (1, 10))stack.Push (box)NextEndFunction RemoveBoxes (stack:Stack <Model>, number:Int)number = Min (stack.Length, number)For Local loop:Int = 1 To numberstack.Pop ().Destroy ()NextEndClass Game Extends Window' Basic 3D scene requirements...Field scene:SceneField camera:CameraField light:LightField boxes:Stack<Model>Method New (title:String, width:Int, height:Int, flags:WindowFlags)Super.New (title, width, height, flags)scene = Scene.GetCurrent ()camera = New Cameralight = New Lightlight.Move (-50, 50, 0)light.Rotate (0, 90, 0)light.ShadowsEnabled = Falseboxes = New Stack<Model>EndMethod ProcessInput:Void ()' If Keyboard.KeyHit (Key.Space) Then light.ShadowsEnabled = Not light.ShadowsEnabledIf Keyboard.KeyHit (Key.Escape) Then App.Terminate ()If Keyboard.KeyDown (Key.A)camera.Move (0.0, 0.0, 0.5)EndIf Keyboard.KeyDown (Key.Z)camera.Move (0.0, 0.0, -0.5)EndIf Keyboard.KeyDown (Key.Left)camera.Rotate (0.0, 1.0, 0.0, True)EndIf Keyboard.KeyDown (Key.Right)camera.Rotate (0.0, -1.0, 0.0, true)EndIf Keyboard.KeyDown (Key.Up)camera.Rotate (1.0, 0.0, 0.0, True)EndIf Keyboard.KeyDown (Key.Down)camera.Rotate (-1.0, 0.0, 0.0, True)EndIf Keyboard.KeyHit (Key.Equals) Or Keyboard.KeyHit (Key.KeypadPlus)AddBoxes (boxes, 100)EndifIf Keyboard.KeyHit (Key.Minus) Or Keyboard.KeyHit (Key.KeypadMinus)RemoveBoxes (boxes, 100)EndifEndMethod OnRender (canvas:Canvas) OverrideProcessInput ()For Local box:Model = Eachin boxesbox.Rotate (1.0, 2.0, 4.0)Nextscene.Render (canvas, camera)canvas.DrawText ("Cursors plus A/Z to move", 20, 20)canvas.DrawText ("Use - and + to add/remove 100 boxes (currently " + boxes.Length + ")", 20, 60)RequestRender ()EndEndFunction Main ()' Windowed mode...Local width:Int = 1920Local height:Int = 1080Local flags:WindowFlags = WindowFlags.FullscreenNew AppInstanceNew Game (AppName, width, height, flags)App.Run ()EndI notice that it gets slow very quickly (like, around 1,000 cubes), but I think it’s at least partly because mojo3d isn’t doing visibility culling yet — a 10,000-cube demo in Blitz3D runs very well when the camera is in the middle of the cube ‘cloud’, but slows down as you back out to view more, while similar numbers cripple mojo3d at the moment, regardless of how many are in view!
Here it is online via Emscripten — works for me in Firefox and Opera; Vivaldi didn’t like it and I don’t have any other up-to-date browsers installed!
http://www.hi-toro.com/temp/mx2/Incube.html
Click within the canvas and hit + to get started!
Oh, and I LOVE that this worked for removing cubes from the stack and the scene!
Monkey1stack.Pop ().Destroy ()Not sure if mx2 checks Windows version (yet?).
Do mx2 executables fail on XP? Any error messages?
Does a simple non-mojo app work, compiled in console mode, like this?
[/crayon]Monkey123[crayon-5cba8e66e0853880663186 inline="true" ]Function Main ()Print "Hello"EndA quick scan of /modules and /src turns up no obvious OS version checks, but it’s possible angle or sdl might do this. Wouldn’t imagine the backend C++ compiler prevents XP by default, though not sure if mx2 forces something in the build options…
… and a stripped-down version without the demo cube or camera controls. Shows nothing, just ready for you to take over! [Updated]
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758#Import "<std>"#Import "<mojo3d>"Using std..Using mojo..Using mojo3d..' ----------------------------------------' Application name...' ----------------------------------------Global AppName:String = "My 3D Game"Class Game Extends Window' Basic 3D scene requirements...Field scene:SceneField camera:CameraField light:LightMethod New (title:String, width:Int, height:Int, flags:WindowFlags)Super.New (title, width, height, flags)scene = Scene.GetCurrent () ' Important!camera = New Cameralight = New LightEndMethod OnRender (canvas:Canvas) Overridescene.Render (canvas, camera)RequestRender ()EndEndFunction Main ()' Windowed mode...Local width:Int = 640Local height:Int = 480Local flags:WindowFlags = WindowFlags.CenterNew AppInstanceNew Game (AppName, width, height, flags)App.Run ()Endit’s what mojo3d and all cpus and fpus and the standard C libs and a ton of equations and algorithms and 3rd party libs and 99% of programing languages and apis etc etc etc use – suck it up!
Yeah, but apart from that… (Ha ha/ouchie.)
Is a set of degree variants do-able for people who aren’t actually CPUs/GPUs/math libraries?
Can be worked around if not, obviously…
Just realised my two ‘asides’ got missed!
- Not sure if I should be checking for keypresses during OnRender, as that seems wrong going by mx1;
 - Should RequestRender be at the start of OnRender, or at the end? Does it matter?
 
EDIT: Interestingly, VPN wasn’t blocked this time, just realised on hitting Submit that I hadn’t disabled it. Must be particular IPs that are blocked.
Gah! That’ll teach me to copy/paste — I used http://wasted.nz/codearcs.php?code=510 !
What’s the main reason for using radians instead of degrees now? I’m vaguely aware it has, er, beneficial properties… mathematically… but is pretty darn impossible to visualise a simple ‘turn by x amount’ from my end, whereas 0-360 is just like a compass. People talk about turning 45 degrees, 90 degrees, etc, in the real world.
Not a major deal, I suppose, but it seems awkward and inefficient to have to call a function to get what I’m after. I wonder if the C++ compiler optimises the call away? I suppose the conversion has to happen somewhere if the GPU or 3D API is after radians…
I use PIA for my VPN service (one of the biggest providers out there) and I haven’t run into this anywhere else — assume it’s built into the board software, though. Admittedly, I don’t really post much in general, but it’s a bit of a PITA to have to disable it just to post here — just realised I need to do that now!
Thanks all!
Aside #3, OT!
Is it intentional that the forums don’t allow posting via a VPN? It either silently fails, or (as I’ve seen once) gives a message saying “Forbidden. Sender blacklisted”, with a “request number”…
I can only post here if I specifically disable my VPN
You should destroy it before making it appear somwhere else
…
Disable collision, place body at new position, enable collision, seems like a better idea
Whatever works best with Bullet, I’m sure it could be wrapped in a nice “Entity.Warp”-type command that takes care of the ugly details of manually repositioning an entity within the physics system!
Pretty sure that Newton allowed manual repositioning of physics objects, so ought to be do-able one way or another…
Weird, same here! PBR demo runs at 1% CPU while showing, but 5-7% when minimised. Back to 1% when showing again.
 - 
		AuthorPosts