Cross-platform Development in Monkey2

About Monkey 2 Forums Monkey 2 Development Cross-platform Development in Monkey2

This topic contains 5 replies, has 4 voices, and was last updated by  abakobo 6 days, 8 hours ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15886

    Abe _King_
    Participant

    TLDR; Before I put work into writing externs I’d like to know which ones work on which platforms, specifically C++. 

    TLDR2; I am also rather curious if the upcoming WASM version of Monkey2 will be able to interface with JavaScript?

    As I get a bit further in my game development I’m thinking about additional features I want to add. Since Monkey2 has excellent cross-platform capabilities I really want to take full advantage of this feature. I plan on utilizing all of the available exports and so my question is really about some limitations I’m concerned about.

    I understand the easiest answer and most preferred option is to code entirely in Monkey2, but I am someone who will always choose to use an existing tool instead of making my own version when possible. That being said, is it possible we can know or have a list of what native files Monkey2 can use and what platforms they do/don’t support?

    I plan on making using externs for these two things in particular:
    https://github.com/mobius3/tweeny( C++ )
    https://gameanalytics.com/features ( C++ )

    I will be doing C++ because I suppose that is the most widely supported language outside of pure Monkey2.
    Thanks!

    #15888

    DruggedBunny
    Participant

    Try this, from Ted2Go’s Help menu (sorry, not easy to link directly!)…

    Help -> Browse Manuals -> Monkey2 Users Guide -> Language Reference -> Build System.

    See System Imports and Local Imports, which list native file types.

    I think to some degree plain C++ will work cross-platform, as the current wasm target uses emscripten to convert the code to Javascript… but I imagine that would also depend on the specific library and what it needs on the target platform. (Heading into realms of cluelessness now… )

    #15889

    Abe _King_
    Participant

    Thanks, DruggedBunny! I knew I’ve seen this somewhere, I just couldn’t seem to find it again – it’s been like over a year since I read it. I really appreciate your help 🙂

    If I have questions I can’t find on that page I’ll make sure to post back here!

    #15891

    Mark Sibly
    Keymaster

    I am also rather curious if the upcoming WASM version of Monkey2 will be able to interface with JavaScript?

    Yes, but only of course to the degree that wasm can, ie: I think wasm can only currently import ‘plain’ javascript functions. It can’t yet access the entire DOM, but that’s apparently coming.

    You will also be able to import’prebuilt’ c++ libraries (hopefully at runtime) which is how bullet and other existing c++ libs will be handled.

    #15919

    Abe _King_
    Participant

    That’s good to hear! Whenever the release of the new version happens I will be taking a good look at those & other features!

    So I did take a look at the build references table, and it seems just list what file types Monkey2 can interface with. There’s really nothing, directly, indicating what exports each file type/language supports.

    So right now, the easiest thing for me to ask is, if cross-compatible code is my goal then I should stick with Monkey2 and C++ as though both work on every export right now, right?

    Thanks!

    #15921

    abakobo
    Participant

    AFAIK Monkey2 is 100% compatible with C++11 and ANSI C, as long as your code is system agnostic!

    The only problem I got till now is endian.h on Mac (not system agnostic but every monkey2 system is “little endian” so you can bypass it) or sources that includes some other libs that are not especially available on every platform (not system agnostic again).

    For non cross-platform things, I’ve seen no Limits.

    Note that Unions, Generics and other things cannot be imported from C++ (Monkey2 is not C++). You’ll have to wrap it in some C++ code if you really need that part of your lib into monkey2. The frequent std::string and std::vector are a bit problematic and would deserve a convenience interfacing like CString/libc.char_t[] exists for const char*/char *.

    My wrapper for box2d has successfully been tested on every available system I have (i.e. Windows, Mac, Linux, Android, IOS, Emscriptem). (box2d is C++)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.