January 22, 2019, 06:09:05 PM

Author Topic: BlitzMax (NG) - New Standard Modules?  (Read 159 times)

Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
BlitzMax (NG) - New Standard Modules?
« on: January 07, 2019, 10:04:25 PM »
While I posted this on the bmx-ng github issue page already, here a short repetion:


New standard modules
Brucey wrote a big bunch of modules which fill a gap almost any Blitzmax developer will reach once in a (bigger) projects lifetime.
Default brl-modules (brl.mod and the 3rd party modules pub.mod) for example lack convenience functions to retrieve user directories - which was not required on ancient Windows OS but nowerdays is needed for proper functionality (write access to certain directories is limited now).

For now Brucey already adds "sdl.mod" as new default module collection - and I am pretty sure there are some other "small" modules which could get added to the list of default modules (maybe also call it "must have").

Pay attention to something: a default module should be not as big as eg. "libxml.mod" as it should get auto-imported if you do not use the framework command. They should provide some barebone functionality. So back to the "xml" example I would prefer some lightweight XML-lib (tinyxml or so) which does a good but not perfect job with adding 4-5KB to the executable, instead of 1MB.

Naming scheme
while "brl.mod" initially stood for Blitz Research Labs it was suggested to interpret them as "Blitz Runtime Libraries" - which could allow to use brl.mod as "namespace" of the new default modules too.
I would not be against a "default.mod" or "base.mod" ... namespace. Something which each blitzmax-user can recognize as something which is a "provided by default" thingy.

Structure
pub.mod is there to house the "wrappers" for 3rd party libraries. Maybe this one can get reused too? Brl.mod then contains types helping to use the pub.mod-modules (so in essence they provide containers and helper functions to work with the 3rd party libraries).
Talking again about the XML stuff this means "libxml.mod" would belong to "pub.mod" as it wraps the libxml code. Within brl.mod (or something similar) you would then package serialization stuff utilizing the libXML module. Most "game" blitzmax-developers should prefer writing SerializeObject(obj, filename). Similar to calling LoadImage() instead to directly communicating with FreeImage-code.


... more at the source: https://github.com/bmx-ng/bmx-ng/issues/45



There I already made a lot of suggestions - and others contributed too. The idea is to find out what the "average joe"-BlitzMax user assumes to get provided by a language toolkit like BlitzMax. So provided XML/JSON support, serialization, ... and so on.

Maybe some of you - who do not lurk around in the issues on the bmx-ng repo at github - are willed to post their ideas here too? It's your chance to help creating the language package you like to have had 10 years ago ;-)



bye
Ron

Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
Re: BlitzMax (NG) - New Standard Modules?
« Reply #1 on: January 07, 2019, 10:12:47 PM »
Stuff like "xml", "json", filetype support, ... are best done by reusing a wheel someone already (re-)invented - aka using 3rd party libraries and wrapping them. This allows to keep maintenance consuming less work hours (others update and fix stuff - you "just" need to update the wrapper).

This means - if you suggest something less trivial (so no one-file.bmx-solutions like TLinkedList, TMap ... stuff which is self-contained in its own file) then you might already have a look if there is a library existing - having a liberal licence (allowing for the static linking we want to do).

While some libraries are "feature complete" (like libXML) you might want to have a look if there is a lightweight solution available too (like tinyXML or smallXML or ...). You often do not need all features and packaging all those big libraries into your binary (without "framework command") ... you would get longer compilation/linking times and of course bigger files if you do. So sometimes "less is more". Still we want those features which make game creation a bit more convenient.

- png/jpg support (no need for tiff, tga, ... as default one)
- streamed ogg audio (albeit mp3 is free now too)
- maybe even video playback (ogv ... for cutscenes ;-))
- joypad/joystick support
and so on and so forth


Some stuff might be doable with existing modules - other stuff (dunno, Steam?) not. Still some of these things are essential for nearly every "today's game" (so not Steam ;-)). These "essentials" is what I was asking you for.


bye
Ron

Offline fielder

  • Jr. Member
  • **
  • Posts: 52
Re: BlitzMax (NG) - New Standard Modules?
« Reply #2 on: January 08, 2019, 08:25:11 AM »
for example.. all my applications are using these modules:

Code: [Select]
Framework brl.standardio
Import brl.retro
Import BRL.wavloader
Import BRL.FreeTypeFont
Import BRL.PNGLoader
Import bah.clipboard
Import bah.volumes

?MacOS
Import BRL.glmax2d
Import brl.freeaudioaudio
?win32x86
Import brl.d3d9max2d
Import brl.directsoundaudio
Import "application32.o"
?win32x64
Import brl.d3d9max2d
Import brl.directsoundaudio
Import "application64.o"
?Linux
Import BRL.glmax2d
Import brl.freeaudioaudio
Import "-ldl"
?


Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
Re: BlitzMax (NG) - New Standard Modules?
« Reply #3 on: January 08, 2019, 11:07:07 AM »
They are already standard modules ... without "Framework" at the top of your source code you would already import many many of these modules (all the brl.* stuff).

"clipboard" is what I suggested too - to be shipped with NG, same for "volumes". Both are mandatory these days. For a more complete list have a look at the linked issue in the first post.


bye
Ron