Wintermute Engine Forum

Wintermute Engine => WME Lite => Topic started by: Mnemonic on May 24, 2013, 08:23:54 PM

Title: Any Linux developers out there?
Post by: Mnemonic on May 24, 2013, 08:23:54 PM
Hey folks, I was just wondering if there's anyone interested in adopting and maintaining a Linux build of WME Lite. It shouldn't be terribly hard, it's mainly about compiling the dependencies and preparing build files. Perhaps also preparing some way of distributing the games using WME Lite.

Sadly, I have zero experience with Linux development myself (last time I used Linux seriously was in the late 1990s :)) and I don't have time delve into it right now. But maybe you know of some skilled Linux developer who would be interested in helping with the project (or maybe you are one!). If so, please point them in this direction 8)
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 25, 2013, 11:57:37 AM
Hi Mnemonic,

I can give this a try when I'm finished pushing all my WME1 changes to you. I'm not too good at creating Makefiles or "./configure" scripts, but usually I get stuff to compile sooner or later :) So if nobody else steps up who has more experience in creating a proper Linux source package and handling dependencies in the right way, I can take a look.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 25, 2013, 02:48:01 PM
That would be awesome! :)
Title: Re: Any Linux developers out there?
Post by: 2.0 on May 25, 2013, 03:14:00 PM
Do I understand correctly that this is a little step in the direction of Android? :)
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 26, 2013, 05:01:42 PM
Hi Mnemonic,

I tried it the quick and dirty way, WME lite compiles for Linux (tested on Ubuntu 12.04 32 bit).

The compiler emits a lot of warnings. The one warning about "typedef ignored" I cannot silence without a source code change, so can you please apply commit 27cf77c from the forked version if it does not break the other builds?

Then there are a lot of warnings about using string literals which are passed to functions that do not define the character sequence as "const" - these I can switch off easily. I don't think you want to go through the painful process of fixing that ;)

Some more warnings appear that NULL is assigned to a non-pointer type - I switched them off as well. These would probably be easier to fix (and there's only a couple of them), but I don't know whether it is worth the effort.

The rest of warnings is here:
Code: [Select]
./BGame.cpp:4758:7: Warnung: mehrere Token am Ende der Direktive #else [standardmäßig aktiviert]
./BGame.cpp: In Elementfunktion »virtual HRESULT CBGame::ScCallMethod(CScScript*, CScStack*, CScStack*, char*)«:
./BGame.cpp:2088:32: Warnung: Format »%x« erwartet Argumenttyp »unsigned int«, aber Argument 3 hat Typ »crc {aka long unsigned int}« [-Wformat]
just FYI. Nothing serious I would say.

I tested the sample game, I could play it but it segfaulted on exit. I'll see whether that is in WME or one of the libraries.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 26, 2013, 06:51:37 PM
Thanks! I went through the warnings and fixed most of them (unused entities, missing braces, the #else you mentioned and others). I disabled the unused switch values and "conversion from string literal to 'char *' is deprecated" warning.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 26, 2013, 06:53:25 PM
Do I understand correctly that this is a little step in the direction of Android? :)
I don't really know, to be honest. Even though Android is based on Linux, I don't know how similar the toolchain is.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 26, 2013, 09:52:00 PM
Android is more difficult. SDL exists (and compiles), BASS exists. What's missing are freetype, freeimage and boost libs, which have to be provided for that platform.

I tried to compile as much as possible of WME lite for Android (without linking), just by providing the necessary include files. The freetype and freeimage headers are ok, but the boost headers don't work. I'll check the error message in detail soon. EDIT: Looks like Android does not understand "std::runtime_error"?

Furthermore, Android native C++ code does not like (or not support at all, I'm not sure) C++ exceptions (maybe because it's too difficult to pass them to Java in case the exception is not caught in native code). So the compilation of SXString.cpp fails. I haven't checked the code whether it is possible to live without the use of exceptions in WME lite, if just for the Android platform.

Mnemonic, what's your opinion about C++ exceptions, and do you think you can get rid of the boost library anytime soon?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 27, 2013, 07:04:32 AM
Even though the android NDK didn't originally support C++ exceptions, they are now supported (since NDK R5). According to this (http://stackoverflow.com/questions/4663291/android-ndk-r5-and-support-of-c-exception) they need to be explicitly enabled (I don't know if it's still the case with current NDK).

As for boost, yes, my plan (https://bitbucket.org/MnemonicWME/wmelite/issue/2/get-rid-of-boost-dependency) is to remove this dependency. It would simplify a lot of things. Can't give you any timeframe, though :)
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 27, 2013, 07:11:02 AM
For now, this looks useful: https://github.com/MysticTreeGames/Boost-for-Android
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 27, 2013, 06:13:51 PM
Hi Mnemonic,

thanks for the hints. With exceptions enabled, the STL target and the boost-for-android headers I can now compile all source files for Android. Now I need to find appropriate references (and time) to generate libfreetype and libfreeimage for Android. Then I can see whether it'll link :) And finally I will have to check how to glue SDL to WME of course, on Android there's no main().
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 29, 2013, 10:25:21 AM
Hi Mnemonic,

how does WME lite search for the game packages? In Android, I cannot simply add them to the "current" directory, so I would have to specify a dedicated path. I would want to supply this as an argument to WME's main(), so how can I do that?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 29, 2013, 02:38:21 PM
WME maintains a collection of search paths. The collection is filled in CBFileManager::InitPaths(). Currently WME Lite adds the current directory ("./") and on OSX/iOS it adds the application bundle path.

I have zero experience with Android. Does it have a concept similar to Mac app bundles?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 29, 2013, 04:27:03 PM
Ok, so for the moment I hardcoded "/mnt/sdcard/" so that I could at least run the demo project.

Android has several ways to supply resources, but once you hit the 50MB limit you can no longer ship it as one package (at least when installing via the play store). For that, Google has introduced "expansion files" which will be downloaded when you install the app.

Long story short, in the end your Java app wrapper knows where your files are supposed to be, so you need to get that information to WME. How about adding this to the arguments of main() in some way?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 29, 2013, 05:53:24 PM
Ok, I'm not sure I follow here. How will main() get the information, from where?
Isn't there some API function that returns the path where application data is stored? I did some quick search and couldn't the nativeActivity->externalDataPath (http://stackoverflow.com/questions/11294487/android-writing-saving-files-from-native-code-only) property be used for the purpose?

In any case, in WME Lite the command line arguments are parsed in CBPlatform::Initialize().
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 29, 2013, 06:09:38 PM
In Android, main() is not the starting point of an app. If you want to run native code, this has to be done via the Java-Native-Interface. So even in the case of WME which itself does not contain any Java, a small Java skeleton app is provided by SDL2 in order to let it run.

Furthermore I assume that any way to fetch the packages with the game data will be done in the Java domain, before WME is started (unless they are <50MB and they can be bundled with the app). In case of fetching via Google Play, there are libraries distributed by Google for that purpose.

In either way, the Java part of the app knows the path to the game packages, and could supply it to WME. I thought that the easiest (and maybe most platform independent) way is to add a cmdline switch for that. It could be useful for Windows and Linux where you have a command line (maybe Mac OS as well), and on Android it is supplied by the Java skeleton app.

Agreed, anything that is possible in Java is also possible to do in C, but it is more difficult to achieve and certainly not platform-independent.

I hope this clarifies a bit.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 29, 2013, 06:27:11 PM
It would be certainly possible to add a command line switch for registering more search paths. In fact, there already is a similar switch (-project) that's used to run the game from sources. It does chdir() to the specified directory, so that the engine finds files using the default "./" search path.

In this case, though, I don't think it would be a problem to add some platform-specific code to FileManager. There already are #ifdefs for OSX and iOS anyway :)

Also, please keep in mind the ports should implement the PathUtil::GetUserDirectory() method, i.e. the path where WME Lite stores user settings.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on May 31, 2013, 08:18:54 PM
For the moment I have hardcoded "/mnt/sdcard" so that I can at least test how wmelite works on Android. Graphics output and sound work, font display is currently broken (might be due to the pretty old libfreetype that I am currently including) and touch input has a strange offset (it currently shows the mouse pointer some 50 pixels below where I touch), so I can walk around in the demo but not use anything or talk to the person.

In order to fill out the platform-dependent sections, are the two places you mentioned all that I should check? Or should I just grep the sources for all #ifdefs?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on May 31, 2013, 08:34:25 PM
These are the vital ones. If you search for __IPHONE__ you'll find many other tweaks, but I don't know which of these (if any) would be relevant to Android.
For example, in iOS when the user switches away from your app, the app is supposed to save its state. WME Lite is using this event to automatically save the game.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 01, 2013, 10:11:10 AM
Ok, so I can take a look at the various defines soon. A similar mechanism to ask the app to save its state exists in Android as well, so I think this could be implemented in a similar way.

Meanwhile I did some more tweaks so that true type font rendering works. The correct way to fix this will be to add proper search paths. The only remaining major issue is now the touch offset. The game screen is aligned to the left bottom of the display, but the y-offset of the touch event is somehow added twice, so that the cursor is located always below the point where the touch happened. Do you have any idea what might cause this?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 01, 2013, 11:25:51 AM
The pointer position is handled in CBPlatform::GetCursorPos(). It tries to convert from display position to game position using current viewport and screen scale. Perhaps try checking what's the original reported position (that comes from SDL_GetMouseState) and which of the conversion breaks it?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 01, 2013, 12:31:43 PM
Thanks for the pointer. I found that there no viewport translation happens, which was strange. The real problem was from my point of view that the query for possible resolutions was #ifdef __IPHONEOS__ only, so I added a define for android. Voila - fullscreen graphics and proper coordinates :) So while there's probably still a lot of work to do, I'm glad that wme lite seems to start looking interesting on Android now.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 01, 2013, 12:45:54 PM
Woohoo, you rock ::rock

I noticed one more function that should be probably re-implemented for Android, the Game::GetDeviceType() method. On iOS it returns either "tablet" or "phone". The package loader uses it to load packages specific to device type.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 01, 2013, 03:05:57 PM
I have just checked where platform specific code is used in wmelite. I found these defines

   cat $i | grep "__WIN32__";
   cat $i | grep "__MACOSX__";
   cat $i | grep "__IPHONEOS__";
   cat $i | grep "_MSC_VER";
   cat $i | grep "__APPLE__";
   cat $i | grep "__IPHONE__";
   cat $i | grep "__OBJC__";

which indicate that some platform specific stuff is going on. I can check the corresponding files, and maybe add a "LINUX" or "ANDROID" define where applicable, once I am sure about the actual implementation. What makes me wonder though are the different defines for Apple platforms. Is there any reason for that, or shall I just ignore the different labels and carry on?

As for the Game::GetDeviceType() call, I currently don't know how to implement it properly. I need to check whether Android actually has such a distinction. The game I tested runs fine on an old Samsung phone (probably 4''), as well as Googles Nexus 7 and an older Acer tablet (10''), so is there any need to distinguish between phone and tablet?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 01, 2013, 03:29:23 PM
The #defines are a mixture of those defined by xcode and those defined by SDL (see SDL_platform.h) - that's why the IPHONE/IPHONEOS inconsistency. SDL already contains #defines for android and linux, so perhaps you can use those?

As for the device type, when WME Lite is loading game packages, and the package name matches the pattern xdevice_[device type].dcp, the engine will only load the package if the device type matches. This was meant for being able to create a universal game that will, for example, use a different UI on tablets and different on phones (phones need typically larger controls than tablets).
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 01, 2013, 03:48:09 PM
Ok, didn't know that SDL has its own defines, so I will use them.

I found quite some places in the code where platform dependent stuff is going on, so I was wondering whether you considered creating an OS abstraction layer to ease porting? I'm personally mainly interested in Linux and Android, so I'm also fine with just checking all the #defines, just wondering whether you want to collect all OS dependent stuff in one central place?

Now I understand where the device types come from. In Android I can probably ask for screen size and density - so maybe I can make a decision based on that. There are a lot of devices, and sometimes you cannot tell whether it is a phone or a tablet  :-\

I'll continue with asking you for platform-dependent functions that I do not understand, once I encounter them ;D
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 01, 2013, 05:08:14 PM
Ok so here now a bunch of questions about platform dependent stuff which I do not understand:

CBGame::CBGame():CBObject(this)
what are the effects of setting "m_TouchInterface"  and "m_ConstrainedMemory"?

what do "ShowStatusLine" and "HideStatusLine" script commands do?

CBRenderSDL::Flip() and CBRenderSDL::SetViewport(int left, int top, int right, int bottom)
what kind of IOS or SDL "bug" is the workaround for?

CBSoundMgr::Initialize()
what is the IOS specific tweak to BASS?

CBPlatform::Initialize(CBGame* inGame, int argc, char* argv[])
what's the event watch, and why would I want it?

CBPlatform::HandleEvent(SDL_Event* event)
what does the IOS specific code do?

I don't get at all what CSXStore class is for

For the rest it is clear to me what is meant, so I can implement the Linux/Android part. BTW I would like to add my changes of the regular WME to WME lite. I have one pull request for you and one more to come. Could you have a look?

There's one thing (maybe specific to Android) which could be added somehow, if possible. Android can show an "Options" or "Menu" key if the App is set up appropriately. This could be used to display a menu or options window in wmelite (like in regular WME a window can be shown which overlays the game). Is that something that can be done?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 01, 2013, 06:00:37 PM
CBGame::CBGame():CBObject(this)
what are the effects of setting "m_TouchInterface"  and "m_ConstrainedMemory"?
'm_TouchInterface' currently mainly increases the height of the dialog responses so that they are easier to select on a touch screen.
'm_ConstrainedMemory' disables caching of TrueType fonts to consume less memory. Probably no longer needed, it was an issue only on the old iOS devices with very limited memory.

what do "ShowStatusLine" and "HideStatusLine" script commands do?
On iOS the app can choose whether the status line (the top line displaying battery status, clock, operator etc.) is visible or not.

CBRenderSDL::Flip() and CBRenderSDL::SetViewport(int left, int top, int right, int bottom)
what kind of IOS or SDL "bug" is the workaround for?
Well, back then the screen rotation in SDL didn't work properly. I hacked it in, but viewports were terribly broken so I just didn't use them. This probably needs a revision.

CBSoundMgr::Initialize()
what is the IOS specific tweak to BASS?
It's supposed to allow "audio ducking" (if other audio is on, it's smoothly silenced and the game audio crossfades in) and also sets a sound category that allows muting game audio with a hardware mute button. Now that you mention it, I think it the value should be 6, not 5:) Gotta fix that.

CBPlatform::Initialize(CBGame* inGame, int argc, char* argv[])
what's the event watch, and why would I want it?
This is used to handle app deactivation (to autosave the game). Because of the way SDL events are handled, on iOS the app didn't receive the SDL_WINDOWEVENT_MINIMIZED event when the user deactivated the application, but only after the app's been restored. For that reason WME Lite registers this event watcher to receive the event in time. It might be fixed in the current version of SDL, I haven't tried.

CBPlatform::HandleEvent(SDL_Event* event)
what does the IOS specific code do?
You should enable this for Android too. Without this it's hard to press GUI buttons on a touch screen.

I don't get at all what CSXStore class is for
It allows in-app purchases using AppStore API. This is highly iOS specific. Even though Google Play supports in-app billing as well, I don't know if the APIs are similar enough to provide the same interface for WME scripts. Probably not.

BTW I would like to add my changes of the regular WME to WME lite. I have one pull request for you and one more to come. Could you have a look?
I don't see any pull request currently. I can grant you write access to the main repository, if you think it will make your life easier.

There's one thing (maybe specific to Android) which could be added somehow, if possible. Android can show an "Options" or "Menu" key if the App is set up appropriately. This could be used to display a menu or options window in wmelite (like in regular WME a window can be shown which overlays the game). Is that something that can be done?
Since there's no standard way of displaying an in-game menu in WME (it's completely under the developer's control), I think the best way would be to send some named event to Game object, and the game developers could handle the event as they see fit?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 01, 2013, 08:32:55 PM
Thanks for all the explanations, it'll take a while until I have understood and ported everything to Android/Linux. You'll see the progress in the wmelite fork anyway ;)

The pull requests I meant are for the original wme (wme1), I have one request and one more to come. Once this is all sorted out I would remove the fork.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 02, 2013, 01:35:01 PM
Oh yes, I'm aware of the pull request. I'm kind of neglecting regular WME while working on Lite :)

Speaking of WME Lite, some of the recent changes:
  * I removed boost dependency.
  * I added dependency on libtheoraplayer (http://libtheoraplayer.cateia.com/wiki/index.php/Main_Page). That's a big one, I'm afraid. I guess it will complicate the Linux/Android build. Perhaps I could add a preprocessor switch to disable video functionality so that the engine builds without the video libraries?
  * For the iOS project I added a DejaVu (http://dejavu-fonts.org/wiki/Main_Page) font. It gets copied to the app bundle and the engine will use it as a fallback if loading a TrueType fails. Perhaps the Android version should do the same?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 02, 2013, 05:54:08 PM
Quote
* I removed boost dependency.
Let me check whether Linux/Android still works.

Quote
* I added dependency on libtheoraplayer. That's a big one, I'm afraid. I guess it will complicate the Linux/Android build. Perhaps I could add a preprocessor switch to disable video functionality so that the engine builds without the video libraries?
For the moment that would be a good idea. I can enable it once I have integrated it.

Quote
* For the iOS project I added a DejaVu font. It gets copied to the app bundle and the engine will use it as a fallback if loading a TrueType fails. Perhaps the Android version should do the same?
Yes, I already added a callback to retrieve a path for searching fonts. Probably its not yet working, but at least I'm prepared :)
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 04, 2013, 08:02:55 PM
Removing boost worked for Linux and Android as well. No more boost dependency :)

The libtheoraplayer looks quite difficult, so I did a quick-and-dirty #ifdef to disable it temporarily, so that the builds are working again.

What do you think about merging the changes from the src/ subdirectory of the fork to your main repo? I can do that if you're fine with that. I would also like to add the linux/ and android/ subdirectory. Then I could delete these from the fork, and keep the fork itself just for compiling the dependencies.

Do you have an Android device and are interested in testing the current state of the port?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 04, 2013, 08:32:48 PM
Removing boost worked for Linux and Android as well. No more boost dependency :)
Yeah :) boost is nice, but was probably bit of an overkill for this project.

The libtheoraplayer looks quite difficult, so I did a quick-and-dirty #ifdef to disable it temporarily, so that the builds are working again.
libtheoraplayer comes with a CodeLite (http://www.codelite.org/) project. At least for Linux it might help?

What do you think about merging the changes from the src/ subdirectory of the fork to your main repo? I can do that if you're fine with that. I would also like to add the linux/ and android/ subdirectory.
Sure go ahead!

Do you have an Android device and are interested in testing the current state of the port?
No, unfortunately all my mobile toys are iOS :) But it should be possible to run in an Android emulator... somehow, right?
Title: Re: Any Linux developers out there?
Post by: Nihil on June 04, 2013, 11:21:26 PM
I have 2 Android devices I can test on, one running Android 4.2 and one with 2.3.something - if you tell me what to do I'm happy to test :-)
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 05, 2013, 06:30:53 PM
I tried 2 versions of codelite which both denied to load the libtheoraplayer project :( I'll have to investigate whats going wrong there.

I merged my changes into the repo now, now I'll have to do some cleanup to be able to package all Android dependencies into one .zip like for the other platforms. For LInux things are different, distributions package (almost) all dependencies already, except for SDL2, which is easy to install from source.

I have uploaded a sample Android app into the BitBucket wmelite project (https://bitbucket.org/MnemonicWME/wmelite/downloads/SDLActivity-debug.apk). If you want to test it, please install the app and put your data files in "/mnt/sdcard" (which hopefully exists on most devices and has enough space - and sometimes it is even identical to the physical SD card).

I have not worked with the emulator a lot - if you actually have a device, it is far more convenient to quickly upload the app onto it for testing & debugging. But I don't want to stop you from trying, just download the Android SDK (and NDK if you want to compile from source). After installing at least one platform incl. ARM system image, you can setup & run the emulator.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 05, 2013, 06:56:46 PM
Tried to test on my "china-made" ARM6 Android phone with 480*800 resolution. Application (1024*768) runs at portrait mode, scene is placed at the bottom of the screen, scaled to fit the width. But to move the cursor it was necessary to touch the top part of the screen. And it seems that clicks on GUI elements is works, but clicks on entities - is not.

Update: When I turned "on" auto-turn of the screen, the application was able to start in the landscape mode. Some shift between touch and cursor position is present. When application goes to exclusive mode (when it opens some windows) it seems that it lost controls (cursor hides).

data.dcp file was placed at the root of the SD card.

Performance on the 600-800 Mhz CPU is good.

Generally beginning quite nice :)
Title: Re: Any Linux developers out there?
Post by: Nihil on June 05, 2013, 08:13:42 PM
Yep, I get the same results here on both 2.3 and 4.2.2 - game starts in portrait mode in the lower third of the screen, and the touch area is in the top. Performance is good, sound is working fine

Really a great start!
Title: Re: Any Linux developers out there?
Post by: piere on June 06, 2013, 04:08:32 AM
My game company may be interested in working with someone that could help us port WME titles to linux and android. PM me is interested.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 06, 2013, 08:11:12 PM
I have uploaded a new build which forces the app to go to landscape mode independent of the screen orientation. Please test if you like.

I also added some debugging output to understand problems with touch offset. Please look for lines like these in the output of "adb logcat" (resp. in "/mnt/sdcard/wme.log" if you have debugging enabled):

V/org.libsdl.app(20467): 21:05:54: Orig w=1024 h=600 Transformed w=800 h=480 ratiox=0.78 ratioy=0.78
V/org.libsdl.app(20467): 21:05:54: BorderLeft=0 BorderRight=0 BorderTop=5 BorderBottom=6

The last line looks already suspicious to me, I will need to look into this.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 07, 2013, 12:28:55 AM
I don't understand correctly how to get wme.log? I.e. how to enable debugging? When I add wme.ini in the root of SD card (near to data.dcp) - is no result.
Default landscape mode is working.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 07, 2013, 08:25:05 AM
I'm sorry for not checking this in advance. It is currently indeed difficult to get wmelite on Android to find and use the wme.ini file.

Mnemonic, is there any reason why you chdir() to the directory where wme.ini resides (in CBPlatform::Initialize) instead of supplying the full path to CBRegistry::SetIniName?

I also saw that actually reading values from that file is #ifdef __WIN32__ only. For other platforms you probably had a settings.xml in mind. Do you have a template for that? Or is this not the place that is meant to enable debug mode?

In CBRegistry::CBRegistry the settings.xml is tried to be loaded from the local directory. Is it safe to call CBRegistry::LoadValues(false) afterwise, even if there were already settings loaded during constructor call?

Yes, this is quite a confusing collection of questions :o In the end I just want to find out how to get a wme.log file for people who are not familiar with the Android developer tools, and even if they are, the logging ringbuffer of Android doesn't have an endless capacity ;D so having a log file functionality handy would be nice.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 07, 2013, 09:42:14 AM
But maybe for the first time you can make logging unconditional by defult? I.e. in sources set corresponding flag to true?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 07, 2013, 02:46:36 PM
Mnemonic, is there any reason why you chdir() to the directory where wme.ini resides (in CBPlatform::Initialize) instead of supplying the full path to CBRegistry::SetIniName?
That's a good question. I... don't know :) I suppose it's to support running the game from sources (when developing the game). The individual game files are referenced using relative paths, so the executable's current path must be set properly for the relative paths to work.

I also saw that actually reading values from that file is #ifdef __WIN32__ only. For other platforms you probably had a settings.xml in mind. Do you have a template for that? Or is this not the place that is meant to enable debug mode?
Yes, wme.ini is Windows-only. The "portable" way is using settings.xml. WME Lite is using this file instead of Windows registry. The main settings.xml file is stored in user's settings directory (platform specific), but you can create a second settings.xml file in the game's folder. To enable debug mode, the file would look like this:

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<Settings>
  <Debug>
    <DebugMode>1</DebugMode>
  </Debug>
<Settings>


In CBRegistry::CBRegistry the settings.xml is tried to be loaded from the local directory. Is it safe to call CBRegistry::LoadValues(false) afterwise, even if there were already settings loaded during constructor call?
I think it's intentionally being called early on to avoid the chdir() you mention above.


Yes, this is quite a confusing collection of questions :o In the end I just want to find out how to get a wme.log file for people who are not familiar with the Android developer tools, and even if they are, the logging ringbuffer of Android doesn't have an endless capacity ;D so having a log file functionality handy would be nice.
Take a look at PathUtil::GetSafeLogFileName. If the log file cannot be created in current directory, this path will be used instead. Perhaps it could be changed to always use this "safe path" on some platforms.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 08, 2013, 08:50:09 AM
I uploaded a new build which unconditionally logs into "/mnt/sdcard/wme.log" for the moment. Please try if you have time.

Unfortunately, enabling debug mode itself is not a good idea - the engine will only run with 0,00000001 fps ;) probably due to the amount of font rendering in debug mode.

Mnemonic, what do you think about separating logging to file from debug mode? Currently you can't have one without the other, but it's not optimal for Android at least.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 08, 2013, 02:41:18 PM
If the log should be always enabled, then I'd vote for replacing the old log for each new session. Currently the log is appended to the file, so the log file can grow considerably (which is fine for development but probably not so fine for production code).

The iOS build has log always enabled too, but it doesn't write to a file but only to the console output, so it's only visible when the debugger is attached.

I'm surprised to hear the performance is bad when the debug mode is enabled. There shouldn't be much of a difference.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 08, 2013, 05:07:07 PM
No, the log to file should not be enabled permanently. It is a temporary solution until I understand why enabling debug mode (incl. log to file) keeps the game from running.

Similar to iOS (I guess) the logging to the in-memory ringbuffer is always enabled, which is probably fine (a lot of applications do this even when they are released); when the Android device is attached to a PC, that ring buffer can be displayed. But I guess not many people have the SDK installed (if comes for free, but if you don't really need it, there is not much reason to install), so having a log file is still desirable.

The real question is, as you say, why debug mode behaves so badly. I'll try to find that out.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 09, 2013, 12:11:52 PM
Debug mode is actually working fine (when enabled in the code), I just used an incorrect project which did not have a valid startup scene when in debug mode :-[ It runs a little slower than non-debug mode with the true type font used to show debugging info on the screen, but that's probably normal.

Now I tried to enable debug mode with the settings.xml file. That's more tricky. I used the file with a small fix so that the XML parser recognizes it
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<Settings>
  <Debug>
    <DebugMode>1</DebugMode>
  </Debug>
</Settings>
but then I found out that its not as easy as I thought. The Debug mode will only be used if read from the "local" settings.xml, because that happens very early, before the "non-local" settings.xml is read.

Although I haven't yet understood everyting about Android's file systems and paths yet, I am afraid that this won't work for this platform.

As far as I understand, the package creation process doesn't simply package all files from the project. It will package the Java code, add native shared libraries when they exist (actually, wmelite is "only" a native shared library on this platform), parse and add GUI elements (icons, layout xml, resource xml files), and so-called "assets". The only way to ship an arbitrary file in an app package is to place it in the "assets/raw" subfolder (50MB limit when the app is to be published in Google Play). All these files could actually remain in the app package (some even compressed) and will not be extracted to the file system. I think shared libraries are extracted so that they can be loaded with standard system calls when the virtual machine requests them.

When an app is started, it has a "private folder" to store application-private data. This is separated from the folders that are present in the app package. One consequence of this is (maybe also when you consider that Android tablets support "multi user" with different settings per user) that there is not an obvious relation between the paths where app settings are stored and where the app itself is installed. And it could be implemented differently by different manufacturers.

If game data exceeds 50 MB, another storage location for these so-called "expansion files" is added. They are stored on a different path, which depends on the location of Androids "external storage" concept.

Again, not 100% sure about all of this, but that's how it looks to me at the moment.

Long story short, the problem is that wmelite does not support that many different paths resp. methods to read (compressed) files that would be required for proper Android support. I'll need to think about this. In the meantime, I'll probably leave things as they are at the moment.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 11, 2013, 12:05:35 PM
Trying to define a way forward for Android.

There are 3 situations that need to be handled:

The header files can be found in a recent Android NDK. Unfortunately I cannot attach them here, and they are probably too long for embedding.

To handle the possibilities in wmelite, all file access should be abstracted, in order to implement the various methods described above. I could imagine coding the storage type in the file path, i.e. like an URI (file:///your/path/file.dcp, package:///your/path/package.dcp, asset:///asset/path/filename.xml, obb:///location/of/obb/to/be/mounted/path/inside/obb/filename.txt, and so on) and to instanciate a matching implementation of an abstract (I think in C++ speak it is "virtual") file access class.

Mnemonic, what are your thoughts about this? I think that if all file access in the end goes via "BFileManager.cpp", it should not be too hard to implement something like described. But since there are methods that return a FILE* its probably not that easy I guess?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 11, 2013, 02:05:02 PM
Mnemonic, what are your thoughts about this? I think that if all file access in the end goes via "BFileManager.cpp", it should not be too hard to implement something like described. But since there are methods that return a FILE* its probably not that easy I guess?
This blog post (http://www.50ply.com/blog/2013/01/19/loading-compressed-android-assets-with-file-pointer/) provides a solution for overriding the fopen() function  to access asset files. So that would solve reading. Then we'd "only" need to solve querying package files within the android asset files (should be doable, right?).

What about writing files? Will fopen work for creating files in some user's private directory? (for saving games, storing the settings, creating the log file)
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 11, 2013, 03:32:48 PM
Hi Mnemonic,

the blog post describes a nice way to solve a part of the problem. But in the end, it only makes assets work, and doesn't take care of having direct file access, or to deal with OBB files. I think we need to distinguish between the several methods.

Querying an asset directory for files is possible with the functionality provided, but whole iteration over a directory tree isn't - i.e. you need to know your directory in advance. I think that's ok because the asset subdirectories already follow a certain naming convention.

Checking an OBB mount is more flexible, because that one will be visible in the file system once mounted.

Writing files is a different story (I forgot about that one because there's not so much alternatives as for reading). There's a (user) private directory for every app which is r/w and can be used for savegames, settings... That one is easily accessible by wmelite, the Java part of the app can supply the correct path. Writing to the assets or the OBB is not possible. Furthermore, you cannot package files into an app which "automagically" occur in that app-and-user-private directory.

The log file is a different story, because the app-and-user-private directory cannot easily be read/written by somebody else, due to security of private data. On a non-rooted device, even the debug bridge won't allow access. Thus, the log file would have to go somewhere else, typically the "external storage" directory (Environment.getExternalStorageDirectory()). The same is true for the "local" settings.xml which cannot be written to the app-and-user-private directory from outside either.

So I think we need to solve the issue for reading/writing files for debugging (wme.log, settings.xml, maybe others?) which should go into a new "category" of directory.

A more difficult issue is to support, out of the possible options, at least these 3 possibilities to read files:


I can make the decision between 1. and 2. a compile time option. But I actually like how wmelite games for Android could be packaged without having to touch/recompile the native part of the app at all - so I'm still in favour of having a choice at runtime. Ok, the URI scheme might be over-engineered, but I like the idea behind it. Maybe we could encapsulate all file access in CBFile, where you already have defined virtual functions for file access? I guess they're just not implemented by any subclass yet? That could be a starting point.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 12, 2013, 03:10:05 PM
Hi!
Here is the log from Zopo C2 phone.

16:59: Scanning packages...
16:59:   Registered 323 files in 1 package(s)
16:59: Initializing scripting engine...
16:59:   Script compiler is NOT available
16:59: Loading string table...
16:59:   51 strings loaded
16:59: Orig w=1024 h=768 Transformed w=1920 h=1080 ratiox=1.41 ratioy=1.41
16:59: BorderLeft=240 BorderRight=240 BorderTop=0 BorderBottom=0
16:59: Engine initialized in 168 ms

The displayed art is OK, the cursor is displayed pixels 150-200 more right than the touch area.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 12, 2013, 03:39:08 PM
Hi Mnemonic,

I saw in the code that there's an offset from the renderer applied to the mouse position

Code: [Select]
void CBGame::GetMousePos(POINT* Pos)
{
CBPlatform::GetCursorPos(Pos);

Pos->x -= m_Renderer->m_DrawOffsetX;
Pos->y -= m_Renderer->m_DrawOffsetY;

But the values for m_Renderer->m_DrawOffsetX and m_Renderer->m_DrawOffsetY are never assigned after they are initialized to 0. Shouldn't they be set to the m_BorderLeft and m_BorderTop values computed in CBRenderSDL::InitRenderer?
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 12, 2013, 05:32:09 PM
But the values for m_Renderer->m_DrawOffsetX and m_Renderer->m_DrawOffsetY are never assigned after they are initialized to 0. Shouldn't they be set to the m_BorderLeft and m_BorderTop values computed in CBRenderSDL::InitRenderer?
No, not really. The m_DrawOffsetX/m_DrawOffsetY are indeed not used by WME Lite (it's a remnant of regular WME code), but the actual mouse position translation is done elsewhere, specifically in CBRenderSDL::PointFromScreen() and CBRenderSDL::PointToScreen(). CBPlatform::GetCursorPos() does the translation so the physical display position *should* be properly converted to logical game position.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 12, 2013, 05:42:30 PM
the blog post describes a nice way to solve a part of the problem. But in the end, it only makes assets work, and doesn't take care of having direct file access, or to deal with OBB files. I think we need to distinguish between the several methods.
What I meant was combining your filename idea with the overridden fopen. This custom fopen would handle the different file types internally and the rest of the code using FILE* would just work. In theory anyway.

The other way would be getting rid of all direct calls to C file functions and wrap them into some abstract class, as you suggest. Doable, but it's used in many places. See below.


Maybe we could encapsulate all file access in CBFile, where you already have defined virtual functions for file access? I guess they're just not implemented by any subclass yet? That could be a starting point.
CBFile is not the right place, though. It's a different level of abstraction. CBFile is a file abstraction from WME's point of view. WME doesn't care whether the file is a physical file, a file stored in a package, a memory file or whatnot.
What we need is an abstraction from operating system's point of view, if you know what I mean. So that the WME filesystem can ask "open a physical file, whenever it's stored in OS filesystem".
We need some kind of OSPhysicalFile class, that will encapsualte all FILE*, fopen, fclose, fseek etc. calls everywhere in WME code.
On most OSes it would just call the C functions as before, but on Android it would handle all the necessary translations.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 12, 2013, 08:01:00 PM
Hi 2.0,

I have uploaded a new build that writes the original (i.e. from screen) coordinates and their transformation to game coordinates into the log, roughly once per second. Can you please check what happens when you touch the 4 corners on the touch screen and the 4 corners of where your game is drawn? It would be interesting to see how these coordinates are transformed.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 13, 2013, 02:30:06 PM
Hi! Seems that this build is without logging. wme.log file isn't created in the root of sd card.
As for cursor coordinates - seems that they shifted in the X-axis for ~1.5 of width of black bar and remains unchanged everywhere independently of touch position.
The idea that the black bars on the sides of the scene uncertainty associated with the shift of cursor - quite possibly may be true. In this case shift width = width of the black stripe * scaling coefficient.

Hi 2.0,

I have uploaded a new build that writes the original (i.e. from screen) coordinates and their transformation to game coordinates into the log, roughly once per second. Can you please check what happens when you touch the 4 corners on the touch screen and the 4 corners of where your game is drawn? It would be interesting to see how these coordinates are transformed.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 13, 2013, 08:09:59 PM
Ooops, sorry. I uploaded a build with debugging enabled now.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 13, 2013, 09:09:54 PM
Here is the log:

Code: [Select]
23:18: ********** DEBUG LOG OPENED 13-05-2013 (Release Build) *****************
23:18: WME Lite ver 1.0.2beta, Compiled on Jun 13 2013, 21:03:22
23:18: Platform: Android
23:18:
23:18: Scanning packages...
23:18:   Registered 323 files in 1 package(s)
23:18: Initializing scripting engine...
23:18:   Script compiler is NOT available
23:18: Loading string table...
23:18:   51 strings loaded
23:18: Orig w=1024 h=768 Transformed w=1920 h=1080 ratiox=1.41 ratioy=1.41
23:18: BorderLeft=240 BorderRight=240 BorderTop=0 BorderBottom=0
23:18: Engine initialized in 160 ms
23:18:
23:18: Cursor point from screen x=0 y=0 <- left top of touch
23:18: Cursor point transformed x=69 y=0 <- in case of correct transform here is needed negative value of x etc
23:18: Cursor point from screen x=45 y=51
23:18: Cursor point transformed x=101 y=36
23:18: Cursor point from screen x=1896 y=29 <- right top of touch
23:18: Cursor point transformed x=1417 y=20
23:18: Cursor point from screen x=1887 y=42
23:18: Cursor point transformed x=1411 y=29
23:18: Cursor point from screen x=1887 y=42
23:18: Cursor point transformed x=1411 y=29
23:18: Cursor point from screen x=1879 y=1075 <- right bottom of touch
23:18: Cursor point transformed x=1405 y=764
23:18: Cursor point from screen x=44 y=1077 <- left bottom of touch
23:18: Cursor point transformed x=100 y=765
23:18: Cursor point from screen x=269 y=41 <- left top of scene
23:18: Cursor point transformed x=260 y=29
23:18: Cursor point from screen x=1679 y=1078 <- right top of scene
23:18: Cursor point transformed x=1263 y=766 <- right bottom of scene
23:18: Cursor point from screen x=260 y=1069 <-left bottom of scene
23:18: Cursor point transformed x=254 y=760
23:18: Cursor point from screen x=260 y=1069
23:18: Cursor point transformed x=254 y=760

On-screen debug log displays modified (transformed) coordinates, as I understand.
Seems that correct values are:
TransformX = (TouchX-BorderLeft)/ratiox
TransformY = (TouchY-BorderTop)/ratioy
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 15, 2013, 11:16:09 AM
I'm trying to understand what's happening. Strange thing is that when the transformation from screen to game coordinates is computed, this formula is used

Code: [Select]
point->x = point->x / m_RatioX - m_BorderLeft / m_RatioX + viewportRect.x;
point->y = point->y / m_RatioY - m_BorderTop / m_RatioY + viewportRect.y;

but when that transformation is to be reverted, the formula looks like this

Code: [Select]
point->x = MathUtil::RoundUp(point->x * m_RatioX) + m_BorderLeft - viewportRect.x;
point->y = MathUtil::RoundUp(point->y * m_RatioY) + m_BorderTop - viewportRect.y;

so my best guess is that the 2nd formula is missing the multiplication of the border with the ratio... But I'm really just guessing, I don't even have an idea why the viewport parameters are in. When the left top coordinates (0, 0) are translated, I would also have expected a negative X value. But due to the viewport correction, the X result is not -(240/1.41)=-170 but rather +69. Mnemonic, can you help me here?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 15, 2013, 12:41:27 PM
I have uploaded a new build with viewport transformation removed. It works for me using the demo project. Can you give it a try?
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 15, 2013, 03:05:46 PM
I have uploaded a new build with viewport transformation removed. It works for me using the demo project. Can you give it a try?
Now coordinates are ok, but to make a click it is need to make two touches. First touch places the cursor to correct place and the second - makes a click event.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 17, 2013, 07:29:58 PM
Hm, when running the wmelite touch demo I thought it was intentional. But I see the same behaviour in my "classic WME" project as well. I need to look into this.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 18, 2013, 06:31:59 PM
It might be an SDL issue. I have updated the library to the latest snapshot, and the behaviour is still not correct - but something seems to have changed... Needs more investigation.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 18, 2013, 07:03:15 PM
It might be an SDL issue. I have updated the library to the latest snapshot, and the behaviour is still not correct - but something seems to have changed... Needs more investigation.

But the windows and ios versions works correctly. It may be some specific android issue of course, but I think that is issue is only in this current build.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 23, 2013, 02:04:35 PM
New build, new try. I fixed an incorrect define in the Android version.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 23, 2013, 02:12:46 PM
I also uploaded a build with the WME touch demo project, now that embedding the game packages into the app works. Please test if you're interested.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 24, 2013, 10:57:47 AM
Interested, of course! :) But how to use it with my own project? As I understand, changing data.png to my own renamed data.dcp will not work?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 24, 2013, 01:51:40 PM
Yes, that would be too easy ;D You will need to build the Android Java wrapper with your modifications (including your data files). I need to check in the native libraries of the current build (or you might unpack it from the .apk), and then you should try to rebuild the "SDLActivity" Java part. You will need the Android SDK for that, and install the required dependencies for Android 2.3.3 (API level 10). Once you can build the Java part, adjusting it to fit your needs is not that difficult.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 25, 2013, 03:44:04 AM
Unfortunately, I have no expirience with the Android development, but already have Android SDK installed. Can you write small step by step tutorial with the information about development IDE and in which place of it it is necessary to set what parameters as it did Mnemonic for WME Lite? Is it needed such additional (external) dependencies for Androin compilation?

As for the touch issues in the new build - seems that now touches works correctly.

Yes, that would be too easy ;D You will need to build the Android Java wrapper with your modifications (including your data files). I need to check in the native libraries of the current build (or you might unpack it from the .apk), and then you should try to rebuild the "SDLActivity" Java part. You will need the Android SDK for that, and install the required dependencies for Android 2.3.3 (API level 10). Once you can build the Java part, adjusting it to fit your needs is not that difficult.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 25, 2013, 05:23:19 PM
I'll see that I start documenting the Linux and Android build procedure. The Wiki seems to be a good place to put it into. It will take a while though.
Title: Re: Any Linux developers out there?
Post by: 2.0 on June 26, 2013, 01:15:38 AM
Nice :) Will wait.
Title: Re: Any Linux developers out there?
Post by: Nihil on June 27, 2013, 10:45:33 PM
That's great progress, thanks a lot for all your hard work!
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 29, 2013, 10:44:35 AM
After adding all the required steps I found that it looks quite difficult to build an Android package, if you compare it to the steps required for the other platforms. I hope that this doesn't stop you from trying - it's not so difficult in the end. At least you do not need to build the C part of the app (unless you're interested of course).
Title: Re: Any Linux developers out there?
Post by: Mnemonic on June 29, 2013, 03:49:42 PM
Thanks a lot for all your porting efforts. You're a rockstar ::rock
Title: Re: Any Linux developers out there?
Post by: HCDaniel on June 29, 2013, 04:33:59 PM
Thanks for the praise :) There are still some things to do. I will enter them as issues in the bitbucket repo, to not forget them. Whenever there is time, I'll see what I can work on.
Title: Re: Any Linux developers out there?
Post by: Mnemonic on July 05, 2013, 01:17:57 PM
So I tried compiling the linux version of wme lite in Ubuntu in VMWare. I had to add "-lz" to the makefile to link zlib (is that normal?).

Now I get the executable, but it won't run because "Error initializing renderer". I suppose it's the result of virtualization. Still, nice progress, I'd say :)
Title: Re: Any Linux developers out there?
Post by: HCDaniel on July 05, 2013, 01:40:54 PM
I'll add that to the list of issues. Not 100% sure what's the difference between our systems. WMELite AFAIK does not depend on zlib, but freetype and/or freeimage might have a dependency. If their dependency to zlib is inherited, it might not be necessary to specify it for wmelite compilation - but all of it is just guessing at the moment. I'm really surprized that you need this dependency added, while it works for me on 2 different PCs... Hmmm :o
Title: Re: Any Linux developers out there?
Post by: Mnemonic on July 05, 2013, 01:50:55 PM
WME does use zlib, actually. The .dcp packages are zlib compressed and so are saved games.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on July 05, 2013, 02:24:20 PM
Ah yes, you're right. Now I even remember seeing some of the code that uses zlib ;) So it looks like adding the explicit reference to zlib is the right way to go. Thanks for the hint!
Title: Re: Any Linux developers out there?
Post by: HCDaniel on July 07, 2013, 07:55:52 PM
Hi Mnemonic,

trying to understand (and hopefully fix) issue #12 (and maybe #14 but I'm not sure).

I believe this is dependent on the ratio of game resolution vs. screen resolution, and has also something to do with the pixel size of the overlay picture, and the (original) coordinates of the upper left point where to draw the overlay.

What I can observe is that parallax scrolling is jumpy, so even if a background is supposed to scroll smoothly with half the foreground scrolling speed from left to right, it occasionally looks like it jumps back and forth one pixel. Plus, as already reported, some overlay graphics are drawn with a white border (in my case at the bottom of the graphics), whether they have a pixel offset I cannot say.

It is correct that all bitmaps are drawn in the CBSubFrame::Draw function? I wonder whether the computations, combined with casts to (int) could be responsible for a pixel offset of one in special situations. There seem to be more casts in CBSurfaceSDL::DrawSprite without rounding. What's your opinion on this? I don't want to add rounding to all these computations without understanding what's going on.
Title: Re: Any Linux developers out there?
Post by: metamorphium on January 10, 2014, 02:51:12 AM
Fixed this by removing -m32

Hi there, I am trying to compile WME lite on Ubuntu 13.10 and got pretty far, but now hindered by this:

g++ -c -o obj/PathUtil.o ../src/PathUtil.cpp -I../src -O2 -m32 -Wno-write-strings -Wno-conversion-null `freetype-config --cflags` `sdl2-config --cflags` -I/usr/local/include/bass/
In file included from /usr/include/c++/4.8/bits/stl_algo.h:59:0,
                 from /usr/include/c++/4.8/algorithm:62,
                 from ../src/PathUtil.cpp:27:
/usr/include/c++/4.8/cstdlib:178:10: error: expected unqualified-id before
Title: Re: Any Linux developers out there?
Post by: piere on January 11, 2014, 12:00:12 AM
Can a Linux build support 3D characters at all?
Title: Re: Any Linux developers out there?
Post by: HCDaniel on January 11, 2014, 01:33:20 PM
Hi,

wmelite itself cannot.

Regular WME seems to work quite well with "wine" in Linux. Haven't tested 3D though but I guess that D3D9 is now pretty well supported. 2D games work fine for me.

You could try to compile regular WME for Linux using "winelib", there seems to be a helper program called "winemaker" that assists with most of the required conversions. That might give more performance than the Windows .exe via "wine". Similarly it might work for Mac OS.

But it might be quite some effort to get this working, so I wonder whether it is really worth it.
Title: Re: Any Linux developers out there?
Post by: Sothoth on December 17, 2014, 04:33:37 PM
Hi!

Does anybody can compile TheoraPlayer library for Linux? I've get the source code from here:

https://code.google.com/p/libtheoraplayer/

but I can't see any Makefile or something similar in order to compile it for Linux.

I know there's a WME Lite fork which supports Theora video playing under Linux using the above library:

https://bitbucket.org/JanKavan/wmelite-julia-branch

Any clues?

Thank you very much in advance!
Title: Re: Any Linux developers out there?
Post by: ciberspace on December 22, 2014, 02:33:57 PM
I came across this C++ video playback library on sourceforge 8)
Title: Re: Any Linux developers out there?
Post by: Tanga on February 11, 2015, 02:46:18 PM

Hello Folks.  I'm trying to install WMELite in Ubuntu 64 bits (14.10).  I thought I'd successfully completed the steps at:
http://res.dead-code.org/doku.php/wmelite:building#linux

but it seems I've made a mistake.  Any ideas of what I'm doing wrong?

Here's what happens when I try and make wmelite.
Code: [Select]
$ make wmelite
g++ -o wmelite obj/ConvertUTF.o obj/DirectoryOperations.o obj/FileOperations.o obj/AdActor.o obj/AdActorDir.o obj/AdEntity.o obj/AdGame.o obj/AdInventoryBox.o obj/AdInventory.o obj/AdItem.o obj/AdLayer.o obj/AdNodeState.o obj/AdObject.o obj/AdPath.o obj/AdPathPoint.o obj/AdRegion.o obj/AdResponseBox.o obj/AdResponseContext.o obj/AdResponse.o obj/AdRotLevel.o obj/AdScaleLevel.o obj/AdScene.o obj/AdSceneNode.o obj/AdSceneState.o obj/AdSentence.o obj/AdSpriteSet.o obj/AdTalkDef.o obj/AdTalkHolder.o obj/AdTalkNode.o obj/AdWaypointGroup.o obj/BActiveRect.o obj/BBase.o obj/BDebugger.o obj/BDiskFile.o obj/BDynBuffer.o obj/BEvent.o obj/BFader.o obj/BFile.o obj/BFileEntry.o obj/BFileManager.o obj/BFontBitmap.o obj/BFont.o obj/BFontStorage.o obj/BFontTT.o obj/BFrame.o obj/BGame.o obj/BImage.o obj/BKeyboardState.o obj/BNamedObject.o obj/BObject.o obj/BPackage.o obj/BParser.o obj/BPersistMgr.o obj/BPkgFile.o obj/BPoint.o obj/BQuickMsg.o obj/BRegion.o obj/BRegistry.o obj/BRenderer.o obj/BRenderSDL.o obj/BResourceFile.o obj/BResources.o obj/BSaveThumbFile.o obj/BSaveThumbHelper.o obj/BScriptable.o obj/BScriptHolder.o obj/BSoundBuffer.o obj/BSound.o obj/BSoundMgr.o obj/BSprite.o obj/BStringTable.o obj/BSubFrame.o obj/BSurface.o obj/BSurfaceSDL.o obj/BSurfaceStorage.o obj/BTransitionMgr.o obj/BViewport.o obj/crc.o obj/FontGlyphCache.o obj/main.o obj/MathUtil.o obj/Matrix4.o obj/PartEmitter.o obj/PartForce.o obj/PartParticle.o obj/PathUtil.o obj/PlatformSDL.o obj/ScEngine.o obj/ScScript.o obj/ScStack.o obj/ScValue.o obj/SdlUtil.o obj/StringUtil.o obj/SXArray.o obj/SXDate.o obj/SXFile.o obj/SXMath.o obj/SXMemBuffer.o obj/SxObject.o obj/SXStore.o obj/SXString.o obj/SysClass.o obj/SysClassRegistry.o obj/SysInstance.o obj/tinyxml.o obj/tinyxmlerror.o obj/tinyxmlparser.o obj/UIButton.o obj/UIEdit.o obj/UIEntity.o obj/UIObject.o obj/UIText.o obj/UITiledImage.o obj/UIWindow.o obj/utils.o obj/Vector2.o -I../src -O2 `sdl2-config --cflags` `freetype-config --cflags` `sdl2-config --libs` `freetype-config --libs` -lbass -lfreeimage
/usr/bin/ld: skipping incompatible /usr/local/lib/libbass.so when searching for -lbass
/usr/bin/ld: cannot find -lbass
collect2: error: ld returned 1 exit status
Makefile:23: recipe for target 'wmelite' failed
make: *** [wmelite] Error 1
Title: Re: Any Linux developers out there?
Post by: HCDaniel on February 11, 2015, 09:52:05 PM
Looks like your bass library doesn't match, i.e. it probably isn't 64 bit. At least the linker doesn't like the one you put in /usr/local/lib.

Can you cross-check this?
Title: Re: Any Linux developers out there?
Post by: Tanga on February 12, 2015, 09:38:43 AM
I thought they were just libraries, so you're probably right.  I'm afraid I can't find any 64 bit files on the site.
Title: Re: Any Linux developers out there?
Post by: HCDaniel on February 12, 2015, 10:00:52 AM
There are :) Just download the bass linux .zip and then look into the "x64" subdirectory.
Title: Re: Any Linux developers out there?
Post by: Tanga on February 13, 2015, 05:05:45 AM
Thanks.  I went back through, and it compiled, giving me a wmelite executable.  Nothing seems to happen when I run it though - should I be running it with the name of a file?  Is there a game with the right format - I've mostly only found exe files.

Sorry, I'm obviously not a developer, but once I've gotten this working properly I'll pay you guys back by doing a tutorial for other noobs so this doesn't happen again (or if it does you can point us to it).
Title: Re: Any Linux developers out there?
Post by: HCDaniel on February 13, 2015, 09:01:10 AM
All you need is to place the compiled ".dcp" files from your project into the same directory as the executable you just compiled.