• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
robt

Compiling with Marmalade

14 posts in this topic

Has anyone tried using AngelScript with [url="http://www.madewithmarmalade.com/"]Marmalade[/url] (formerly known as the AirPlay SDK)? I'm having some problems, some of may just be newbie issues, but I've been poking around (trying to remember how C++ works) and I'm starting to think there's an incompatibility with the way AngelScript expects preprocessor directives and the way Marmalade sets them (Using VS2010 Express atm).

If you don't know how it works, Marmalade creates the VS project and solution files automatically from a platform agnostic .mdk file, so I don't have direct control over the settings (and they are not the defaults). I can change them, as long I don't mind losing those changes later. If you can suggest any options I might try, I'll give them a go and see what happens.

I also posted some details of my experiences so far over on the Marmalade forums, so I won't re-post it all here:
[url="http://www.madewithmarmalade.com/devnet/forum/7207"]http://www.madewithm...vnet/forum/7207[/url]

Since those posts I've been trying to trace through the header dependencies to figure out what is trying to include the Win32-specific stuff, and so far I've tracked it back to a quagmire of conditional defines in as_config.h which I haven't picked through it in detail, but it looks like these could be making some assumptions about the platform that don't match the settings Marmalade is using.

At this point I'm getting a bit lost though, as my knowledge of C++ is too out of date to know what to try next, and the conditionals in as_config.h are pretty complicated. If my guess is correct, some of these conditionals might need tweaked to work with Marmalade, or perhaps changing some preprocessor directives is all that is needed? If you need any more detailed information about the compile options etc., let me know and I'll post them.

- Robert
0

Share this post


Link to post
Share on other sites
as_config.h is indeed intended to identify compiler and target system, and it will do this using the well known preprocessor defines. If Marmalade uses different preprocessor defines, then it will be necessary to modify as_config.h to allow it to understand these defines.

The first thing to figure out is what preprocessor defines are given by default for Marmalade. Normally there is some option to allow the compiler to output the defines. Consult the manual for Marmalade to find out how to do that. If the option doesn't exist, then perhaps the defines are documented in the manual.

Ones you know which defines are provided, post them here and I'll help you determine the changes needed for as_config.h.
0

Share this post


Link to post
Share on other sites
[quote name='Andreas Jonsson' timestamp='1328061879' post='4908255']
The first thing to figure out is what preprocessor defines are given by default for Marmalade.
[/quote]

OK thanks, I will see what I can do. I can easily give you my preprocessor command line options from VS. I'm not sure if there's another way to easily dump the preprocessor definitions. Any pointers you can give me on extracting the information would be a big help because I'm not fully up to speed with the way VS does this stuff - the last time I did any C++ it was Turbo C++ 3.0 for DOS! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

However perhaps the bigger problem is going to be what happens when trying to compile for other platforms. Someone on the other forum has suggested that I wrap it up in a cross-platform subproject, so I'm going to give that a go and see if it helps any. This might help with getting it to compile on my Windows development system, or it might not, but I will try it and see if I can learn anything more in the process of doing it.
0

Share this post


Link to post
Share on other sites
For reference here's my complete compiler command-line taken from the config window in VS:

[CODE]/I"c:/marmalade/5.2/modules/iwutil/h" /I"c:/marmalade/5.2/modules/iwgeom/h" /I"c:/marmalade/5.2/modules/iwresmanager/h" /I"c:/marmalade/5.2/modules/iwgl/h" /I"c:/marmalade/5.2/modules/iwgx/h" /I"c:/marmalade/5.2/modules/iwgxfont/h" /I"c:/marmalade/5.2/modules/iw2d/h" /I"c:/marmalade/5.2/s3e/h" /I"c:/marmalade/5.2/s3e/h/ext" /I"c:/marmalade/5.2/s3e/h/std" /I"c:/marmalade/5.2/s3e/h/std/c++" /I"c:/marmalade/5.2/s3e/h/ext_legacy" /I"c:/marmalade/5.2/s3e/h/legacy" /I"." /ZI /nologo /W3 /WX- /Od /Oy- /D "_WIN32" /Gm /EHsc /RTC1 /MTd /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Debug_FirstGame_vc10_x86\FirstGame.pch" /Fa"Debug_FirstGame_vc10_x86\" /Fo"Debug_FirstGame_vc10_x86\" /Fd"Debug_FirstGame_vc10_x86\vc100.pdb" /Gd /showIncludes /analyze- /errorReport:queue[/CODE]

The project is called "FirstGame". Because Marmalade creates the VS project/solution automatically, it sticks _vc10 onto the end automatically, hence here it is called "FirstGame_vc10". Here I am compiling to x86 (Debug) / Win32. I also tried compiling to x86 (Release) / Win32 in case that makes a difference, but got exactly the same result.

Here's an edited compiler output with header dependency tracing on, so you can see what's happening:

[CODE]1> as_atomic.cpp
1> Note: including file: d:\marmalade projects\firstgame\lib\angelscript\source\as_atomic.h
1> Note: including file: d:\marmalade projects\firstgame\lib\angelscript\source\as_config.h
1> Note: including file: d:\marmalade projects\firstgame\lib\angelscript\source\as_memory.h
1> Note: including file: d:\marmalade projects\firstgame\lib\angelscript\source\as_criticalsection.h
1> Note: including file: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windows.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\excpt.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\crtdefs.h(44): fatal error C1189: #error : ERROR: Only Win32 target supported![/CODE]

(edit: The indentation makes it look like there's a line missing - I just double checked this, there isn't, it's just the way the trace is rendering on the forum)

BTW, I had a look in crtdefs.h to see what was causing the error, and it's the following lines (starting line #43):

[CODE]
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
[/CODE]

And you may have noticed that _WIN32 [i]appears [/i]to be defined in the command-line options, so I don't know what's causing that.
0

Share this post


Link to post
Share on other sites
Someone over on the other forum has got it working, with a number of modifications, some of which could possibly be improved - see:

[url="http://www.madewithmarmalade.com/devnet/forum/7207"]http://www.madewithm...vnet/forum/7207[/url]

I'm still in the process of experimenting with what they've posted.
0

Share this post


Link to post
Share on other sites
The Marmalade community seems to be really thriving. You got lots of useful tips from them in a very short time frame. :)

I haven't really had the time to check out what Marmalade really is, but if it is using the MSVC10 compiler on Windows I see no reason why you cannot use the windows libraries to compile on Windows too. For the same reason I really think the default as_config.h should work without the need for changes (though I'll happily make changes if you find that something does need to be modified).

I'm not sure what's up with the _WIN32 define. I do not explicitly define this in my projects, yet it still works. I should think it is a compiler flag for MSVC.

Have you installed the Windows Platform SDK? It doesn't come with the MSVC Express versions so you need to install it separately. This might be why some of the things don't work as-is.

AngelScript comes with a project for MSVC10. I suggest taking a look at that and comparing it against what Marmalade generated for you. Perhaps it might give you some hint of some other things that may be missing.

If the code for multithreading support is giving you a hard time you can turn it off all together by defining AS_NO_THREADS, that way you don't have to worry about the individual settings like AS_POSIX_THREADS and AS_NO_ATOMIC.

--

I knew about the article on codeplea, but I hadn't see the follow up tests by Pekuja. I'm happy to see my efforts to optimize AngelScript have paid off. :) Thanks for bringing that to my attention.
0

Share this post


Link to post
Share on other sites
[quote name='Andreas Jonsson' timestamp='1328234021' post='4908961']
I haven't really had the time to check out what Marmalade really is, but if it is using the MSVC10 compiler on Windows I see no reason why you cannot use the windows libraries to compile on Windows too. For the same reason I really think the default as_config.h should work without the need for changes (though I'll happily make changes if you find that something does need to be modified).

I'm not sure what's up with the _WIN32 define. I do not explicitly define this in my projects, yet it still works. I should think it is a compiler flag for MSVC.
[/quote]

The really strange bit is that it is being defined - I can see it on the command-line - and yet when it gets to that part of the code, seemingly it is not defined. I don't recall it being possible to undefine a constant in C++ so this confuses me. I'll probably figure it out after I get more familiar with Visual Studio. I may have misunderstood how those command-line arguments work.

You are right that if the target platform is Windows then it should work. The only thing is, I'm not sure the target actually is Windows even though the config profile is called x86 Win32. It is definitely x86, but it compiles a binary that is run on an abstraction layer called [url="http://www.madewithmarmalade.com/devnet/docs#/api/s3eapidocumentation.html"]S3E[/url]. When you compile and build your project, it loads up an S3E simulator, which acts like a phone or tablet in a window.

[quote name='Andreas Jonsson' timestamp='1328234021' post='4908961']Have you installed the Windows Platform SDK? It doesn't come with the MSVC Express versions so you need to install it separately. This might be why some of the things don't work as-is.[/quote]

I don't recall installing it explicitly, but I must have done because it's there - in fact you can see it in the header trace. I suppose it could be the wrong version. I will look into that.

[quote name='Andreas Jonsson' timestamp='1328234021' post='4908961']AngelScript comes with a project for MSVC10. I suggest taking a look at that and comparing it against what Marmalade generated for you. Perhaps it might give you some hint of some other things that may be missing.[/quote]

Also one of the first things I did - I was able to build the default project with no problems whatsoever, it just seems to be compiling with Marmalade options that creates problems. This also suggests that the SDK is correct.

[quote name='Andreas Jonsson' timestamp='1328234021' post='4908961']If the code for multithreading support is giving you a hard time you can turn it off all together by defining AS_NO_THREADS, that way you don't have to worry about the individual settings like AS_POSIX_THREADS and AS_NO_ATOMIC.[/quote]

That does sound like a possible cleaner way to make it work. I can add the custom define to the .mkb file (the Marmalade x-platform project file) which means it will "just work" ™ (in theory)... I'll give it a shot and see what happens.

Does AngelScript handle concurrency the same, regardless of whether or not it's compiled with AS_NO_THREADS? If it behaves differently, I may need to consider which behaviour is preferable, and whether it works consistently across all target platforms or not.

[quote name='Andreas Jonsson' timestamp='1328234021' post='4908961']I knew about the article on codeplea, but I hadn't see the follow up tests by Pekuja. I'm happy to see my efforts to optimize AngelScript have paid off. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Thanks for bringing that to my attention.
[/quote]

No problem, thanks for all the hard work on AngelScript and the help with this [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Maybe you should ask Lewis from Codeplea if he could do some updated graphs with newer versions of the languages he compared. I nearly ruled AngelScript out of my initial shortlist on the basis that the performance was worse than several others in all categories, but the later version appears to be better in almost all performance tests and about average (small enough) in size. It's much harder to tell from the raw numbers than from looking at the graphs though. It would be good to see that, and also have the old ones up for reference, because the rate of improvement an interesting metric in itself (I would imagine Lua for example hasn't changed much at all over the same period - if anything, more mature languages tend to gradually become more bloated, not get both smaller and faster like AngelScript has)
0

Share this post


Link to post
Share on other sites
[quote name='robt' timestamp='1328243519' post='4909004']
The really strange bit is that it is being defined - I can see it on the command-line - and yet when it gets to that part of the code, seemingly it is not defined. I don't recall it being possible to undefine a constant in C++ so this confuses me. I'll probably figure it out after I get more familiar with Visual Studio. I may have misunderstood how those command-line arguments work.

You are right that if the target platform is Windows then it should work. The only thing is, I'm not sure the target actually is Windows even though the config profile is called x86 Win32. It is definitely x86, but it compiles a binary that is run on an abstraction layer called [url="http://www.madewithmarmalade.com/devnet/docs#/api/s3eapidocumentation.html"]S3E[/url]. When you compile and build your project, it loads up an S3E simulator, which acts like a phone or tablet in a window.
[/quote]

A define is undefined with #undef :)

Sounds like it isn't Windows after all. Which makes me wonder how MSVC comes into the picture.

Is the code always built to this S3E format, regardless on which platform your running Marmalade? I mean, is the compiled product platform independent, in the sense that the same file compiled on Windows can be executed on an S3E simulator running on Linux?

[quote name='robt' timestamp='1328243519' post='4909004']
Does AngelScript handle concurrency the same, regardless of whether or not it's compiled with AS_NO_THREADS? If it behaves differently, I may
need to consider which behaviour is preferable, and whether it works consistently across all target platforms or not.
[/quote]

AngelScript can still be used in a multithreaded application, but the application will have to be extra careful to avoid having multiple threads accessing the engine in parallel.

[url="http://www.angelcode.com/angelscript/sdk/docs/manual/doc_adv_multithread.html"]Manual: Multithreading[/url]
0

Share this post


Link to post
Share on other sites
I read a little about Marmalade. While I still have some doubts about how it handles the lowlevel stuff, such as function calling conventions across platforms, it is pretty clear to me that Marmalade should probably be considered a platform on its own, with its very own configuration in as_config.h.

As it is mostly targeted for mobile devices, I don't think you'll lose anything by declaring AS_NO_THREADS, however if you want to support multithreading you should likely use the AS_POSIX_THREADS, and you'll have to figure out from the team behind Marmalade, on how to do atomic operations. Using AS_NO_ATOMIC will work, but it is much slower than if the Marmalade provides proper atomic operations, because the AS_NO_ATOMIC simulates atomic operations with critical sections that needs to be entered, exited, with each access.

I'm very curious to know how Marmalade deals with all the different native calling conventions, but in the event that AngelScript doesn't work with the native calling conventions in the way that Marmalade does it you may need to define AS_MAX_PORTABILITY, which turns off support for native calling conventions. Instead you need to register the application functions using the generic calling conventions. The autowrapper in the add-ons will help you implement the wrappers with very little effort.

It would be good to know if there is a specific define that Marmalade provides for the code in as_config.h to automatically detect that the library is being compiled for Marmalade. If there is none, then I suggest you define MARMALADE in the project settings and change as_config.h to use that for detecting the situation.
0

Share this post


Link to post
Share on other sites
[quote name='Andreas Jonsson' timestamp='1328312403' post='4909366']
I read a little about Marmalade. While I still have some doubts about how it handles the lowlevel stuff, such as function calling conventions across platforms, it is pretty clear to me that Marmalade should probably be considered a platform on its own, with its very own configuration in as_config.h.
....
It would be good to know if there is a specific define that Marmalade provides for the code in as_config.h to automatically detect that the library is being compiled for Marmalade. If there is none, then I suggest you define MARMALADE in the project settings and change as_config.h to use that for detecting the situation.
[/quote]

Yes, I've been going through the code that Kite posted over on the other forum (did you look at that btw?) and trying out a few things myself. I've come to the same conclusion: clearly there is a need for an additional define (Kite called it AS_MARMALADE in his version).

Marmalade doesn't define anything automatically, but it does allow you to add custom defines to your project with a block in the .mkb (or .mkf) file, like this:

[CODE]
defines {
AS_MARMALADE
AS_NO_THREADS
}
[/CODE]

The only thing in Kite's version that (maybe) isn't necessary is the following:

[CODE]
#if defined(AS_MARMALADE) // Marmalade.
#define AS_POSIX_THREADS
#define AS_NO_ATOMIC
#else
#define AS_WINDOWS_THREADS
#endif
[/CODE]

By also defining AS_NO_THREADS as you suggested, this bit isn't needed (and it's a bit of a hack anyway because it's in the Windows-specific part so there might still be build errors compiling for other platforms).

The other changes are necessary because certain functions are missing. For example, MSVC++ 9+ is detected so it is assumed that the _s (safe) versions of functions are available, but Marmalade does not provide these and does not include the default libraries (I presume it provides its own implementations of the ANSI libraries for S3E).

I don't know if the way Kite modified these files is the best option for full cross-platform support, or if it is better to include a conditional that sets up all the options for Marmalade irrespective of the compiler. I don't know what would happen now if you tried a compiler other than VC++ 10, but I suspect there could be similar issues with missing libraries. I'm not familiar enough with the structure to say for sure which would be best.

Kite's version does the job for me for now, but it would be good if a Marmalade configuration could be added to trunk. Using AS_MARMALADE as the de facto standard constant seems fair enough, as it's pretty easy to add to the Marmalade configuration.
0

Share this post


Link to post
Share on other sites
I saw that Kite managed to get it to work, but I can't find where he attached the code. Perhaps it is necessary to be logged in in order to see the attachments.

Do you mind posting the code here too?

As I said before, I'll gladly make the necessary changes to make AngelScript compatible with Marmalade. It will be great to have yet another supported platform that users can use AngelScript on.
0

Share this post


Link to post
Share on other sites
[quote name='Andreas Jonsson' timestamp='1328322449' post='4909403']
I saw that Kite managed to get it to work, but I can't find where he attached the code. Perhaps it is necessary to be logged in in order to see the attachments.
[/quote]

Yes, I did not realise that but it seems you are correct.

[quote name='Andreas Jonsson' timestamp='1328322449' post='4909403']
Do you mind posting the code here too?
[/quote]

I don't expect Kite will mind, so I have attached it.
0

Share this post


Link to post
Share on other sites
Thanks. I've checked in the changes to the SVN (revision 1152).

Kite got everything right. I just made a few minor changes to fit my own coding style.

I also made the library recognize either AS_MARMALADE or just MARMALADE to propertly detect the SDK. One or the other needs to be given in the project settings. You don't have to specify AS_NO_THREADS in your project settings to make it work. (you may want to anyway to get slightly better performance)

By the looks of it, the only thing that may need to be done on Linux or Mac for Marmalade may be to turn off the atomic instructions with AS_NO_ATOMIC. If you get a chance to try this on those other platforms, or perhaps someone else from the Marmalade community does, please let me know and I'll have those changes done as well.
0

Share this post


Link to post
Share on other sites
Thanks again! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

It still works for me. I've merged in Kite's other changes (in the add ons directory) to my local version, while using your version of as_config.h (as_debug.h is the same anyway).

Having been through and diffed the changes to the add ons, I think those are pretty safe to merge into trunk as well, just be aware that some of these files have been updated in trunk since version 2.2.2 which is what we've been working from. The attached patch file contains just the necessary changes by Kite, which should make it easy to merge in locally and review.

Note that these are just the minimum add ons required to get the Hello World example to run. It looks like these 3 are pretty essential for most things. If I find that I need any of the others and can get them to compile myself, I'll submit patches for those too. If there is wider interest over on the Marmalade forums I'll see if anyone can help with testing the patches on different compilers before submitting. If not, I believe I need to use GCC to compile ARM binaries so I'll get to that myself eventually.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0