Page 1 of 1

AWT EventQueue

PostPosted: July 26th, 2020, 1:13 am
by Flint1b
Is there a reason why the whole Player.launch() runs in the AWT EventQueue thread, including opening the zip file, loading and building the module, etc? I'm no front end developer but shouldn't the EventQueue be only used to GUI-related tasks?

Re: AWT EventQueue

PostPosted: July 26th, 2020, 1:28 am
by Flint1b
And it keeps getting better, you let the main application thread DIE right after it starts and before the first pixel is drawn on the screen?! Does the whole application and not just Player.launch() run in the AWT Thread then??

Oh you....

And then complain about how bad Java is, how slow the game loads, and worry about how performant tiny parts of unprofiled code work..

So what is the plan to make things right and stop misusing the GUI thread for non-GUI work?

Re: AWT EventQueue

PostPosted: July 26th, 2020, 2:28 pm
by uckelman
Thus spake Flint1b:
> Is there a reason why the whole Player.launch() runs in the AWT
> EventQueue thread, including opening the zip file, loading and building
> the module, etc? I'm no front end developer but shouldn't the EventQueue
> be only used to GUI-related tasks?

Second line of Player.launch():

GameModule.init(createModule(createDataArchive()));

That can't run off the EDT, due to the fact that basically everything
in GameModule has to run on the EDT. I didn't decide to make it this way;
GameModule was already that way when I got here. Model-view separation is
extremly hard to retrofit into a design which didn't have it fromt the
start. We've discussed doing it several times before; my view is that it
will be less work to do it correctly from the beginning in V4 than to
refactor everything to do it here.

--
J.

Re: AWT EventQueue

PostPosted: July 26th, 2020, 2:40 pm
by uckelman
Thus spake Flint1b:
> And it keeps getting better, you let the main application thread DIE
> right after it starts and before the first pixel is drawn on the
> screen?! Does the whole application and not just Player.launch() run in
> the AWT Thread then??

Yep. There's no other way, short of refactoring very nearly everything.

> Oh you....
>
> And then complain about how bad Java is, how slow the game loads, and
> worry about how performant tiny parts of unprofiled code work..

I stand behind all of my complaints. If you have specific ones you'd
like to discuss, please be specific.

> So what is the plan to make things right and stop misusing the GUI
> thread for non-GUI work?

V4 is the plan for that.

--
J.