Sterne

Monkey Forums/Monkey Code/Sterne

taumel(Posted 2013) [#1]
Hi, today i gave a coding lesson to a friend of mine. When we stepped into OOP, things went a bit rough for him in Unity, so i switched to BlitzMax, where everything was fine. After we finished the starfield in BlitzMax, i was curious how monkey would deal with it and, apart from Unity, converted it to monkey too.

BlitzMax has the smallest source size, then comes monkey and with a larger gap there is Unity (due to that everything is generated by script). Surprisingly everything worked out just fine (i had 72b on the hard drive, building for Glfw, everything on OS X). I wish Ted would offer some sort of IntelliSense.

Why a starfield? Dunno, i like old skool starfields. :O) They once fit into a bootblock and i thought this would be a nice example to demonstrate several aspects. Anyway, here is the code (not polished, just as things evolved during the day) for monkey and BlitzMax, enjoy.

monkey v72b Glfw


monkey's Glfw config file


BlitzMax v1.49



impixi(Posted 2013) [#2]
Nice.

OT: BlitzMax is still great. It keeps pulling me back for certain tasks that Monkey cannot yet handle without fuss. eg GUI-based batch image file processing tool. Plus it's nice having a "close-to-the-metal" compiler that does not require half a dozen intermediary toolkits/SDKs additionally installed.


taumel(Posted 2013) [#3]
Yup, i had a couple of weird experiences with early monkey versions, so, in order to avoid running into unneeded possible issues i went straight with BlitzMax (battle proven). But at least in this case it wasn't necessary and on top monkey's language is cleaner.


Sammy(Posted 2013) [#4]
Compilation error (Monkey 75d) GLFW, works on HTML5 but I would guess its going about 1FPS on HTML5.


..\main.cpp(5165): error C2026: string too big, trailing characters truncated

Build FAILED.



taumel(Posted 2013) [#5]
Well, then i'm happy i was using monkey v72b.

Defining a 12kb star, even 197kb when trying out bigger more detailed stars, isn't a problem there. I removed the original LoadImage function in order to provide the gfx within the text and decided against writing a small function to generate a stars's image due to a better workflow. This way you can choose whatever generation method or existing texture you like, easily extract the RGB values from a TIFF and let monkey convert those into the wanted ARGB INT format.

Dunno, is this limitation (reduction of a single String size) in V75d more permanent?

As for HTML-5, this is supposed to look good via Glfw. You could reduce the number of stars, alter some parameters for their generation but writing a different star routine which keeps the performance restrictions of HTML-5 in mind probably is the better option then.


Sammy(Posted 2013) [#6]
I have no idea, this may be something to do with my version of GLFW or 75d, I was kinda hoping someone with 75d could confirm or deny the problem is specific to this version of Monkey.


SLotman(Posted 2013) [#7]
Remove SetColor from HTML5 and it will run much faster. HTML5 has a problem tinting images on the fly (it's not a *monkey* problem, but a HTML5 problem in general).

And it compiles fine here on Monkey 75d, MingW and html5.


impixi(Posted 2013) [#8]
Heh, didn't try it on Monkey. Just BlitzMax - runs very well on that. LOL.


taumel(Posted 2013) [#9]
@SLotman
Yeah but without SetColor it's not quite the same, you can go quite crazy with parameters and textures if you want to.

Btw. we had a few hours for a second session and somehow stumbled into z-sorting stuff. Does monkey offer some sort of built in Quicksort? I couldn't find anything and so we implemented a few ones (quick, radix, ... bubble). You learn to appreciate the faster ones when you're waiting.