Forum Replies Created
-
AuthorPosts
-
There has been some mojo3d architectural changes since I first posted this example so I fixed it to run with the current mojo3d module.
Also, how can I remove the old file attachment from my initial post?
Lately I’ve been contemplating coding a personal share management/trading system… But I have actually retired from coding (and all other keyboard-intensive activities) for medical reasons (cubital tunnel syndrome), and have been much better for it, physically. Mentally though, I do miss my daily monkey2 coding sessions…
But it’s good to see other people progressing well in their projects. Keep it up everyone!
Wow.
Linux distro: manjaro-xfce-17.1.2-stable-x86_64 – Fresh install and update.
Today’s Monkey2 develop branch code.
“./rebuildall2go.sh”, Monkey2 fully compiles without dependency-related errors. No additional package downloads were necessary.
Bananas run wonderfully desktop target, debug and release.
What the hell is going on?! That’s too easy!
The only caveat is I had use the terminal to launch the IDE (./”Monkey2 (Linux)”) because the Thunar file manager thinks that file is a “shared library”.
For Linux Mint 18.3 Cinnamon (fresh install and full update as of today) I installed the following:
Through Synaptic:
g++ package
Through terminal: sudo apt-get install
libpulse-dev
libx11-dev
libxi-dev
libgl1-mesa-dev
libopenal-devMonkey2 1.1.09 (github develop branch) “./rebuildall2go.sh” compiled without errors. All the bananas and Mojo3D tests compiled/ran without issues for desktop debug/release target. Quite impressive, actually…
As for emscripten, I’m not that masochistic…
I’d probably do it like this:
* Load the sprite sheet/atlas into a pixmap.
* Create the masks in one hit and store them in a single I8 pixmap.
* Utilize the Pixmap Data pointers for performance reasons.
* Hope that Mark doesn’t say it is “unsafe” to do it like that.Example (provide your own suitable PNG file):
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182#Import "<std>"#Import "<mojo>"#Import "spritesheet2.png"Using std..Using mojo..Function Main()New AppInstanceNew MyWindowApp.Run()EndClass MyWindow Extends WindowMethod New( title:String="Simple mojo app",width:Int=1024,height:Int=768,flags:WindowFlags=Null )Super.New( title,width,height,flags )tileSet = New TileSet("asset::spritesheet2.png", 32, 32)EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()canvas.DrawImage(tileSet.imgAtlas, 0, 0)canvas.DrawImage(tileSet.imgAtlasMask, tileSet.imgAtlas.Width, 0)canvas.Flush()EndField tileSet:TileSetEnd'==============================Class TileSetPublicMethod New(url:String, tileWidth:Int, tileHeight:Int)Local pmAtlas := Pixmap.Load(url, PixelFormat.Unknown)If Not pmAtlas Then RuntimeError("Could not load spritesheet: " + url)Local tileCount := (pmAtlas.Width / tileWidth) * (pmAtlas.Height / tileHeight)Local pmAtlasMask := New Pixmap(pmAtlas.Width, pmAtlas.Height, PixelFormat.I8)Local pmAtlasDataPtr:UByte Ptr = pmAtlas.Data + Cast<UByte>(pmAtlas.Depth - 1)Local pmAtlasMaskDataPtr:UByte Ptr = pmAtlasMask.Data + Cast<UByte>(pmAtlasMask.Depth - 1)Local pidx:ULong = 0While pidx < (pmAtlas.Width * pmAtlas.Height)If pmAtlasDataPtr[0] > 0pmAtlasMaskDataPtr[0] = 255ElsepmAtlasMaskDataPtr[0] = 0EndifpmAtlasDataPtr += Cast<UByte>(pmAtlas.Depth)pmAtlasMaskDataPtr += Cast<UByte>(pmAtlasMask.Depth)pidx += 1WendimgAtlas = Image.Load(url)imgAtlasMask = New Image(pmAtlasMask)pmAtlas.Discard()EndField imgAtlas:ImageField imgAtlasMask:ImageEndOkay, I’m back to “retirement”…
.
Thanks for the heads-up. Take as much time as you need…
Ahhh, like a “hypermaze”:
http://www.astrolog.org/labyrnth/maze/hyper.gif
http://www.astrolog.org/labyrnth/hypermaz.htmIndeed, that would be an absolute nightmare to navigate, though, even with a map.
Yes, the demo is coded against the latest monkey 2 dev branch where mojo3d is now using degrees instead of radians…
@Mark
What do you mean by ‘real’ 3d maze? Multiple levels high, stacked like a tower? Or “free-form” movement?Thanks for the links Mark. I’ll try that when my spare SD cards arrive…
I just tried compiling monkey2 on my Pi Zero W with Raspian OS installed and encountered the following:
pi@raspberrypi:/media/pi/USB Stick/monkey2/scripts $ ./rebuildmx2cc.sh
***** Rebuilding mx2cc *****
mx2cc version 1.0.9
***** Making module ‘monkey’ *****
Parsing…
Semanting…
Translating…
Compiling…
Build error: System command ‘arm-linux-gnueabihf-g++ -std=c++11 -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -O3 -DNDEBUG -I”/media/pi/USB Stick/monkey2/modules/monkey/native” -I”/media/pi/USB Stick/monkey2/modules/” -c -o “/media/pi/USB Stick/monkey2/modules/monkey/monkey.buildv1.0.9/raspbian_release/build/_1src_2monkey_0monkey.cpp.o” “/media/pi/USB Stick/monkey2/modules/monkey/monkey.buildv1.0.9/raspbian_release/src/monkey_monkey.cpp”‘ failed.arm-linux-gnueabihf-g++ -std=c++11 -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -O3 -DNDEBUG -I”/media/pi/USB Stick/monkey2/modules/monkey/native” -I”/media/pi/USB Stick/monkey2/modules/” -c -o “/media/pi/USB Stick/monkey2/modules/monkey/monkey.buildv1.0.9/raspbian_release/build/_1src_2monkey_0monkey.cpp.o” “/media/pi/USB Stick/monkey2/modules/monkey/monkey.buildv1.0.9/raspbian_release/src/monkey_monkey.cpp”
/media/pi/USB Stick/monkey2/modules/monkey/monkey.buildv1.0.9/raspbian_release/src/monkey_monkey.cpp:14:1: error: ‘bbInit’ does not name a type
bbInit mx2_monkey_monkey_init(“monkey_monkey”,&mx2_monkey_monkey_init_f);
^***** Fatal mx2cc error *****
It looks like generated object file name discrepancy issues. The actual files in the monkey.buildv1.0.9/raspbian_release/build/ directory are named like:
_1_1_1native_2bbarray.cpp.o
Is this something I can fix at my end? I’m not properly familiar with the build tool chain yet…
Then again it might be better if I stick with plain old C for my Pi experiments, rather than try to hack monkey2…
Mark did have plans to create an IAP module and release it for sale on itch.io like he has done for the AdMob module.
Certainly if he wants to take a break from mojo3d to code it, that might be a good idea. (Probably only take him 10 minutes anyway. LOL, j/k.)
But what’s the potential market? There’s Playniax, therevills, maybe Xaron. Who else would buy an IAP module for 30 bucks or so?
I think the real problem is the lack of quality control at certain major online publishers (e.g. Steam). These days they’ll publish almost anything provided you can reach the ever-lowering *financial* bar of acceptance. “Quality control” doesn’t seem to factor into it any more.
Unity makes it ludicrously easy to make a “prototype” that beginners (or charlatans) mistakenly believe is worthy of publication. The online publishers are happy to “list” such games because they get a cut of the sale regardless of “quality”.
Consequently the gamers have to sort through the mountain of garbage. Much of it starts with the “made with Unity” logo so of course they’ll associate Unity with crap games, despite the fact an experienced developer can produce quality games with it.
I’m guessing it has to do with the quantity of models in the scene. (I suspect Mojo3D is not fully optimized for higher numbers of models yet).
Whenever a model is created it is added to the scene. You have to “hide” it to remove it from the Scene’s Models stack and then “show” it to add it back onto the stack.
I have coded a retro-style dungeon test where the levels are made out of a grid of cubes (I tried Pakz’ approach by generating meshes but could not get the texturing working correctly – it was using an earlier version of mojo3d).
To get 60fps I have to maintain a visible models stack which calculates the visible models based on the camera’s grid location and how many cells are visible around it. When the camera moves into a new cell all currently visible wall/floor/ceiling models are hidden and the newly visible ones are recalculated and shown. The “pop-in” effect is hidden by a black fog at the relevant distance.
I was directly manipulating the Scene’s Models stack but I believe Mark posted recently that we should not do that because it’s an “internal” property. You should use a model’s/entity’s Hide() and Show() methods.
I can post a code example in another thread if you’re interested…
using Entity.Destroy() is the correct way to remove something from a scene (assuming it works!).
Just tried Destroy() and it does indeed work for terrain objects. Thanks for the tip.
I just discovered my bug was forgetting to clear the scene’s Terrains stack, so on each runtime call to my generate function a new terrain model was created. It looked like an addition to the existing terrain model… FFS, I’m making a lot of rookie mistakes lately I’m just about ready to quit coding forever…
-
AuthorPosts