BlitzMax options extendibility?

BlitzMax Forums/BlitzMax Beginners Area/BlitzMax options extendibility?

RupeB(Posted 2015) [#1]
Been a heavy Blitz3D user and just got started with BlitzMax, trying real haed to grasp few things. I wonder if BlitzMax supports the same extension and libraries via declarations or how does that work?

I imagine it differs as .dll is Windows only? What are the options in BlitzMax to add for example lowlevel access to OS in the same way Blitz3D did?

Thanks!


Henri(Posted 2015) [#2]
Hi,

if you want to interface C/C++ code with Blitzmax there is a tutorial in MaxIDE / Help / Language / Advanced Topics.

As for WinAPI (Windows libraries) you only have to define the needed function(s) inside 'Extern "Win32" / End Extern' - block and that function comes available in main program.

Example MSDN function:
a https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
Extern "win32"
	Function ShellExecute(hwnd:Int, lpOperation:Byte Ptr, lpFile:Byte Ptr, lpParameters:Byte Ptr, lpDirectory:Byte Ptr, nShowCmd:Int) = "ShellExecuteA@24"
End Extern


Notice that the = "ShellExecuteA@24" - part is optional and is only needed if you want to make your function name different than the actual function inside Windows .dll - file (in this case the actual name is ShellExecuteA). The @24 part tells the linker that parameters take 24 bytes in total (pointers & Ints are 4 bytes in basic Blitzmax).

-Henri


col(Posted 2015) [#3]
Welcome to BlitzMax!

Don't be afraid to experiment with the other OSs too, Windows really doesn't live up to the 'be all - end all' reputation that it likes to thrust down everyone's throat. It just shouts louder and is therefore heard by more of the masses. The other OSs are just as, if not more, powerful and are actually easier once ou get away from the hand-holding that windows imposes upon its programmers.

To compliment what Henri was saying...
All OSs have the ability to statically/dynamically load/unload external libraries. BlitzMax can load and use both static and dynamic libraries for all OSs. You can even include the source of those libraries if you know what you're doing. With time and experience you'll be amazed at BlitzMax can do! There are interfaces and binding code written to interface into just about anything and everything you can think of.

Search the forums for some great samples/codes.


RupeB(Posted 2015) [#4]
Thanks !! happy to come aboard.

Yes actually I'm thinking to put aside all other tools and simply focus on BlitzMAX for while and see where that takes me.

Are there any ways to extend BlitzMAX to draw efficient glowing vectorgraphics or play/stream videos on MacOS?


col(Posted 2015) [#5]
You can choose to the Max2D rendering framework ( that you have the source for, in the BlitzMax/mod/ folder ) or create you own full blown 2d/3d renderer directly with the opengl commands within your blitzmax code. If you know windows reasonably well then you can also use directx commands directly in your blitzmax code too. If any of the opengl/directx commands aren't available then you can write the interface yourself :-) You can do anything you want here including all types of shaders - ( vertex / pixel / geometry / tesselation / compute shaders ) and create any effects you could possibly dream up.
Playing/streaming is quickly achieved using code from this code archive.
EDIT:-Oops my mistake, you wanted video for MacOs, however as vlc is cross platform you can probably use that archive as a basis for using vlc on the Mac and write the interfacing code yourself - you know - for learning ;-)

The key point is that out of the box, BlitzMax is quite basic ( although you do get more than a standard c/c++/c# installation offers!! ), but its really surprisingly powerful and extensible ( via importing c/c++/assembly or importing/loading in libraries ) so if you have the energy and willpower then anything is possible. You'll probably find that pretty every topic you could think of has already been discussed/debated/written already so searching the forums is definitely the first port of call.

The archives are a treasure trove of all kinds of goodies, also the blitzmax programming forum ( as opposed to the beginners forum ), and also search Bruceys repo for tons and tons of code for all manner of things - where he gets the time I shall never know :D. There's tons of gold nougats of code spread around, and there are still plenty of very experienced programmers here to help out if you need it - replies may be slow lately but I'm sure that you will get a reply.

Also feel free to give Bruceys BlitzMax-NG a go too ( written in BlitzMax ). Its a full compiler/transpiler so that you can compile your exact same blitzmax source to x86/x64/arm for desktop OSs/raspberry pi/android etc. Its still in development and is quite far along too. Although at this stage you may want to get more comfy with the standard BlitzMax and see what you can do with that until you get some experience under your belt with it as 'Max-NG does require you to be comfortable and have at least some understanding of its build processes.


RupeB(Posted 2015) [#6]
Thanks for the heads up.

I checked around and I 1st thought that VLC or Pantsons mod (or MMPEG) might fit the bill. The only useful movie formats that I ever could consider would be MP4 / AVI / MOV.

But then I found WebM (LIBPVX) which seem to eat all those for breakfast (and is smaller than mp4) free and open, also I reccon what's okay for youtube is okay for me. I donīt really need a specific format just "because" they are common and still widely in use, I could happily just use the format of tomorrow right now. I think this would be a good pick.

Itīs royalty-free and libvpx has a really simple API.

http://www.webmproject.org/code/

Any thoughts about this? Have I missed something important?


xlsior(Posted 2015) [#7]
Make sure to check the licensing for the Codec used in addition to the library that plays it back -- these video files tend to be container formats, and depending on the codec that you use -inside- of the container may require separate licensing as well, regardless of who created the library/interface.

(a .avi container can contain content in dovx, xvid, depending on CODEC used, .AVI can be dozens of different formats: e.g. divx, xvid, mp4, DV, M-Jpeg, WMV, Sorenson, H.263, H.264, MP3, and many others)


RupeB(Posted 2015) [#8]
Webm seem to be just a container of V8/V9 nothing else, and itīs a subformat to the industry standard Matroska (.msv) so thatīs nice.

No chapters and no menus though, but thatīs overkill for me, it still has everything else such as subtitles, 3d and the lot. Also it uses Vorbis ogg (or Opus) as audio.

I thought for a while if I would miss M4A (container for AAC which is lossy and Apple's ALE/ALAC which is lossless) or FLAC, but no, OGG & MP3 would do just great.

https://en.wikipedia.org/wiki/Comparison_of_video_container_formats
http://www.matroska.org/


xlsior(Posted 2015) [#9]
I thought for a while if I would miss M4A (container for AAC which is lossy and Apple's ALE/ALAC which is lossless) or FLAC, but no, OGG & MP3 would do just great.


Keep in mind that MP3 is still protected by several patents which won't expire until 2017 in the USA -- meaning if you use MP3 in your game you're supposed to be paying license fees.

http://www.tunequest.org/a-big-list-of-mp3-patents/20070226/


RupeB(Posted 2015) [#10]
Ya Iīm really starting to appriciate ogg for that very reason. The only minus is Itīs a drag with alots of conversion back and forth, as mp3 is THE format used everywhere,.
But as far as quality and filesize goes itīs pretty much interchangable, ogg is perhaps even better at low bitrates.

The only problem is when you need lossless audio (with graphics thereīs always PNG !) but with audio you suddenly forced to use standards thatīs practically RAW format with some sugar coating (WAV or AIFF), and you canīt use Appleīs formats for the same reasons why you canīt use mp3s.

I found a free lossless format and itīs even smaller than most other lossless formats that exist. It has got a great name too ;)

http://www.monkeysaudio.com/


RupeB(Posted 2015) [#11]
One thing I love about B3d was that it could plot pixels reliable.

You could get 5000(cheap netbook) - 15000(normal nonehighendcomputer) pixels per 60 fps. And from there things only got better, never EVER things got worse. You could count on those pixels being there on time.

But the thing is; you would get it 100% stutterfree. Stutterfree as in each and every millisecond is stutterfree for hours. Regardless of imperfect driver and garbage collection and "bad" OS's and other things that people normally blame for stuttering when they have gear they know should be able to do their thing.

With BlitzMax you could easly 10.000+ pixels BUT - 99% stutterfree. This is how most modern things act today. itīs always that "99% hickup free" regardless how massive or how small workloads you throw at a modern device, thereī always that 1% of shit.

I really appriciate that 100% quality well before a million polygons, so thatīs my main issue with swapping tools.


col(Posted 2015) [#12]
Yeah mpeg licensing will be a pain for a few years just yet, but it's slowly losing its grip.

As far as the stuttering goes, I don't know why brl didn't implement the same tweening method ( you can search the forums for existing 'max tweening code :) ) that b3d has but as I said the standard 'Max is quite basic and the drawing commands are about as un-optimised as you can ever imagine - but of course in 'Max you can roll your own optimised 'multi-plot' code that could also fit comfortably within the Max2D framework which you couldn't do in b3d. Try to imagine 'max as a midway point between b3d and c++ - you get the language and the ability to create something great but with a sample graphics framework just to get things on screen. btw there are some 3d games written in 'max and there's obviously no way Max2D is responsible for those :-)


Brucey(Posted 2015) [#13]
I prefer FLAC to ape, but each to their own :-)


RupeB(Posted 2015) [#14]
Actually I donīt find tweening, delta or fixed rate logic work well for splatting graphics on the screen smoothly
Only following the all mighty god of vertical blanking of the graphicscard.

Tweening and all that makes things move more evenly over time (especially interpolation is a must in 3D i guess).
But thatīs more about matching logic part and the graphics part (which should work PERFECTLY on its own before even touching anything else).

Using tweening to cover up missed vertikal blankings is bad practice in my book.