FreeTrainSDL on Linux

jendave

Sticking around

Posts: 32

Joined: Fri Mar 14, 2008 7:53 pm

Post Fri Mar 28, 2008 8:45 am

Re: FreeTrainSDL on Linux

Hmm. I get a different error, but I suspect that the reason is essentially the same - Winform on Mono. Well, we have a few options -

* I could rollback the last major checkin and create a branch so i can work on the Winforms stuff without breaking the main branch.
* I could keep it in there if you guys don't mind it not working on Linux. Hopefully, after I clean things up I can fix the problems with the Linux port.
* I could abandon the Winforms changes.

opinions? Other options?

stevenh

User avatar

Sticking around

Posts: 28

Joined: Sat Mar 15, 2008 4:48 am

Location: Canberra, Australia

Post Fri Mar 28, 2008 9:48 am

Re: FreeTrainSDL on Linux

*thinking out loud*
If i remember correctly, one of the SDL.Nets had an SDLSurface control as opposed to using the whole SDL window... does TAO support this as well? That might make life easier instead of having to use the 'dedicated' windows?

Apart from that I am nearly compiling monoDevelop on my debian install to dig into it all.

jendave

Sticking around

Posts: 32

Joined: Fri Mar 14, 2008 7:53 pm

Post Fri Mar 28, 2008 2:40 pm

Re: FreeTrainSDL on Linux

My SDL.NET does indeed have a SurfaceControl, but it is not really that useful. Al it does is copy the Surface to a bitmap then displays the bitmap on a Windows control. It is quite slow. We would still have the problem of Winform support on Mono as well. I'll research MDI issues on Mono. Maybe i'll have to drop the approach.

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Fri Mar 28, 2008 2:54 pm

Re: FreeTrainSDL on Linux

Before we discount the WinForm solution, it's worth pushing in the right channels for a solution to the problem.

It could be one of a few things:
  • A mono bug -- so let's see if we can get an idea of how quickly it'll get fixed
  • Incorrect process -- one of those "you have to set X before Y" or "can't set X before Y" silly things tripping up Mono, in which case somebody somewhere must know this and be able to point us in the right direction
  • Installation bug -- perhaps we're missing some Mono component or extension (although I highly doubt this)
I'm already pushing in #mono for some guidance and have registered this bug report on the issue. It shouldn't be long before we have more information and can therefore be more sure about what to do next.
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

jendave

Sticking around

Posts: 32

Joined: Fri Mar 14, 2008 7:53 pm

Post Fri Mar 28, 2008 3:09 pm

Re: FreeTrainSDL on Linux

Good points. I have done quite a bit of cross-platform C# programming and there have been a lot of situations where some simple tweaks got things running under Mono. I'll keep working on the Winforms stuff and try to simplify it.

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Fri Mar 28, 2008 3:16 pm

Re: FreeTrainSDL on Linux

in irc chat we wrote:jpobst: mdi support should be pretty good, i'll take a look at the bug but it will take a while since i have to go download an entire application and figure it out
jpobst: if there was a smaller testcase, it would be easier
freegamer: i'll ask if we can get a simple(r) test case for it
jpobst: freegamer: thanks, that would make it much easier to fix
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Fri Mar 28, 2008 10:39 pm

Re: FreeTrainSDL on Linux

Ok, got a fix for it (I think).

My original suspicion was that if a Form had certain behaviours activated on it before it had been notified it had an MdiParent, it would not like switching from being a normal frame to an MDI frame. (Please excuse incorrect terminology.) So I started by minimizing the actions called before setting MdiParent, and with everything taken out that was not necessary, it seemed to work fine.

However it the actual cause of the crash was not any specific one of the calls that were taken out, but instead seems to be that too many demands are being placed on the Forms in consecutive calls.

Here's an overview of what's happening:
  Code:
            PlatformController.create();
            PlatformController.theInstance.Hide();
            PlatformController.theInstance.MdiParent = mainWindowMDI;
            PlatformController.theInstance.WindowState = FormWindowState.Maximized;
            PlatformController.theInstance.Show();


Here's the create() function:
  Code:
        public static void create()
        {
            if (theInstance == null)
                theInstance = new PlatformController();
            theInstance.Show();
            theInstance.Activate();
        }


If I comment out the (in execution order) calls to Show(), Activate(), Hide(), and Show(), then it runs OK. If I try and isolate them one at a time, they all work in isolation, and (I didn't try all combinations) work ok when 3 are active and any 1 is commented out.

So the question is, are these calls necessary? From what I could see, the answer is no. Can't we just create, set MdiParent, and Hide() and then invoke Show() and Activate() when required?

Here's the info on each one, for reference for people like me who just looked at them for the first time:
  • Activate()
    "Activates the form and gives it focus."
  • Hide()
    "Conceals the control from the user... equivalent to setting the Visible property to false."
  • Show()
    "Displays the control to the user... equivalent to setting the Visible property to true."
  • Visible property
    "true if the control and all its parent controls are displayed; otherwise, false. The default is true."
Anyway, so, is this the right thing to do? Trim down our WinForm setup routines to just what we require - it seems to work here. If you want, let me know, and I'll clean it up and commit a fix.

More info on using MDI and WinForms:
http://msdn2.microsoft.com/en-us/library/xyhh2e7e.aspx
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Sat Mar 29, 2008 1:12 am

Re: FreeTrainSDL on Linux

Looking at it, create() should only be used to create and another function active() or activate() or activateForm() should be used to show and activate a form.

Surely this makes more sense:
  Code:
        public static void create()
        {
            if (theInstance == null)
                theInstance = new PlatformController();
        }

        public static void activate()
        {
            theInstance.Show();
            theInstance.Activate();
        }

And if you really wanted you could call 'create()' from inside 'activate()'...

I also tried to create a function that took an AbstractControllerImpl and added it as an MdiChild, but this wasn't a great catch-all solution as some of the forms don't inherit it:
  Code:
        private void createMdiChild(AbstractControllerImpl child) { createMdiChild(child, true); }
        private void createMdiChild(AbstractControllerImpl child, bool startMaximized)
        {
            child.MdiParent = mainWindowMDI;
            child.WindowState = startMaximized ? FormWindowState.Maximized : FormWindowState.Minimized;
            child.Hide();
        }


Anyway, that's enough of my amateur meddling for now, I'll leave it with the pros - you guys! :D
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Wed Apr 09, 2008 5:35 pm

Re: FreeTrainSDL on Linux

Revision 355 doesn't build at the moment:
  Code:
Build failed. Could not find a part of the path "/home/charles/Games/svn/FreeTrainSDL/core/Controllers/Framework/AboutDialog.cs".


As suspected, here is the description of what causes the crash by Mono developer Jonathan Pobst:
JonathanPobst wrote:This is most likely due to Show/Hide not being synchronous on Linux.

On Windows, Form.Show () will not return until the Form is actually visible.
On Linux, we send the command to show the form, but it does not wait until the
form is actually shown. So if you show and hide things really quickly, the
state can get out of sync. This is a long standing issue that we don't know if
it is fixable.
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Wed Apr 09, 2008 7:22 pm

Re: FreeTrainSDL on Linux

The build is now fixed but it's crashing on loading on line 349 of Program.cs:
  Code:
mainWindowMDI.Show();
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

jendave

Sticking around

Posts: 32

Joined: Fri Mar 14, 2008 7:53 pm

Post Wed Apr 09, 2008 9:13 pm

Re: FreeTrainSDL on Linux

Apprently Mono does not like having the icons in the upper left of the windows. I remvoed them and now it runs on Linux again. That said, the Winforms runs rather slowly and still do not have good interaction with the render window. I will be looking into this. The Windows version runs pretty well though. The OSX version needs a lot of work still.

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Wed Apr 09, 2008 9:34 pm

Re: FreeTrainSDL on Linux

I recommend that instead of simply removing lines that are causing problems, instead comment them out with a note:
  Code:
// FIXME: Linux does not like this :( not sure why
//this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

This will give people new to the code a better idea of the problems they may encounter or a place to start fixing things.

At the moment the main controller opens up all the dialogs. Surely it should only create the dialogs on demand? Maybe I'm being naive about the process with that suggestions.

Also I suggest that you bring up your experiences thus far with Mono on the mono-list which can be a good source of answers:
http://lists.ximian.com/mailman/listinfo/mono-list
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

jendave

Sticking around

Posts: 32

Joined: Fri Mar 14, 2008 7:53 pm

Post Wed Apr 09, 2008 9:50 pm

Re: FreeTrainSDL on Linux

Yeah, I'll have it open up windows on demand. It was just easier duing the inital testing process. It is a bit slow on Linux.

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Thu Apr 24, 2008 7:37 pm

Re: FreeTrainSDL on Linux

Dave is there anything we can do to help the progress? I notice commits have slowed recently - obviously I don't want you to get demotivated or stuck etc.
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

jendave

Sticking around

Posts: 32

Joined: Fri Mar 14, 2008 7:53 pm

Post Thu Apr 24, 2008 9:35 pm

Re: FreeTrainSDL on Linux

I have been busy at work and also with working on the next release of Sdl.NET and Taoframework. The next thing I would like to do is make sure all the plugins have have menu items automatically generated when they are loaded. If anyone wants to take this one, feel free. I hope to look at it soon.

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Fri May 02, 2008 10:27 pm

Re: FreeTrainSDL on Linux

I really wish I was more help but if it's not Java or Vexi then I'm of little use at the moment, as I don't have enough time to forge through problems in an environment I don't really know.

Will you post back when the other stuff is released? I'll have a further look then and see if I can do something a tiny bit useful.
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Fri Jun 20, 2008 1:29 am

Re: FreeTrainSDL on Linux

How'd those releases go? (I should check but I'm snowed under with work... hoping to get some free time for FreeTrain in the next few weeks though.)
Free Gamer - open source games blog
FreeGameDev forums - open source games development community

elch

New in town

Posts: 1

Joined: Thu Jun 26, 2008 12:19 pm

Post Thu Jun 26, 2008 12:23 pm

Re: FreeTrainSDL on Linux

Hello there, i'm trying to run freetrain sdl under debian, libsdl-all and other are installed, mono version is 1.9.1+dfsg-2, monodevelop - 1.0+dfsg-2.
When building project i'm getting this error line
[Task:File=/home/zz/temp/freetrain/branches/FreeTrainSDL/lib/Controls/ColorPickButton.resx, Line=0, Column=0, Type=Error, Priority=Normal, Description=ApplicationName='resgen2', CommandLine='/compile "/home/zz/temp/freetrain/branches/FreeTrainSDL/lib/Controls/ColorPickButton.resx"', CurrentDirectory='/home/zz/temp/freetrain/branches/FreeTrainSDL/lib/Controls']
is there any way to fix it ? thanks

Indi

New in town

Posts: 1

Joined: Wed Dec 03, 2008 5:44 pm

Post Wed Dec 03, 2008 5:48 pm

FreeTrainSDL on Linux

Hi there
I also get an error when trying to build project in MonoDevelop:

Building Project: FreeTrainSDL (Debug|Any CPU)
Performing main compilation...

Referenced project 'FreeTrain' not found in the solution.
System.Deployment could not be found or is invalid.
Build failed. Executable not found: /usr/bin/gmcs

Can anyone help me?
Thanks! Indi

freegamer

User avatar

Site Admin

Posts: 119

Joined: Fri Mar 14, 2008 3:11 pm

Post Sat Dec 06, 2008 12:58 pm

Re: FreeTrainSDL on Linux

I'll give it a go. However, Indi, the SDL branch is likely to be discontinued. There are some [without major code restructuring] insurmountable problems in the way SDL surfaces and Winforms can't interact.

I've done some research and found that using Agate (and OpenTK based 2d game library) should be a more viable option. The FreeTrainAgate branch builds but currently will not do anything. Hopefully that'll change soon!
Free Gamer - open source games blog
FreeGameDev forums - open source games development community
Previous

Return to Core Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.