Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Picture/Sprite when loading  (Read 8698 times)

0 Members and 1 Guest are viewing this topic.

Mez

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Picture/Sprite when loading
« on: May 27, 2010, 03:09:19 PM »

Hey.
I'm trying to find a way to replace the "loading..." and black screen that you get when STARTING a game.

We're making a game that's going to be played by people that usually don't play that much (younger kids/old people/non-internetz skilled people).

As our startup is quite long we want to have a picture or a logo, so that there's no confusion as to if the game is starting.
A black screen can cause the user to close the game before it has loaded, believing it has crashed/it's "broken".

I've found threads on the issue but never found any solution or tips.

Any help would be appreciated.
Logged

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: Picture/Sprite when loading
« Reply #1 on: May 27, 2010, 03:26:28 PM »

How can anyone believe the game has crashed when there is the text "loading..." in the center of it? If your game needs a very long time to load maybe you need to optimize something. Do you preload sprites/sounds? This msg is hardcoded and there is no option to change it unless you use the LGPL version of wme and make the necessary changes yourself. Read bellow.
« Last Edit: May 27, 2010, 07:11:49 PM by odnorf »
Logged
fl*p

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Picture/Sprite when loading
« Reply #2 on: May 27, 2010, 05:53:53 PM »

It's very simple, actually. Create a scene with your loading screen. In game.script don't load all the stuff you're loading now, instead just switch to the loading scene. And in the loading scene's script load the stuff.
Also, the "Loading..." text can be changed using string table.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Picture/Sprite when loading
« Reply #3 on: April 09, 2014, 05:27:00 AM »


Hi, I know this is old. But maybe someone used it.

I tried to follow Mnemonic's guide, to make some splash screens for the wintermute logo and our company logo and then  the loading screen. And it works, but when I get to the game, the right buton 3 option menu doesn't work anymore, in fact the keyboard isn't loading also.
I guess it has something to do with the #include "scripts\keys.inc" but I did include those so I don't know.

Here's what I did.
Thanks!

Game.script::
Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"
Game.FadeOut(600);
Game.ChangeScene("scenes\LoadingScene2\LoadingScene2.scene");


and in LoadingScene2  Scene_init.scr I put::

Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

Game.FadeIn(600);
Game.Interactive=true;

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;
InventoryActive = true;

//testing kijal vsync method//

if (Game.WindowedMode==false)
{
Scene.ScrollPixelsX = 6;
Game.SetVSyncMode=false;
Game.EnableHardwareCursors=false;
}

// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");


global MenuObject = null;


// load our main actor
actor = Game.LoadActor("actors\Ray2D\Ray2D.actor");
Game.MainObject = actor;


// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");

// run the "noise" script
Game.AttachScript("scenes\common\noiseFX.script");



// which scene to load?
Game.ChangeScene(Game.StartupScene);



////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    // clicking an inventory item
    if(ActObj.Type=="item" && Game.SelectedItem==null)
    {
      Game.SelectedItem = ActObj;
    }
    // using an inventory item on another object
    else if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
      var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
      else if(Item.CanHandleEvent("default-use")) Item.ApplyEvent("default-use");
      else if(ActObj.CanHandleEvent("default-use")) ActObj.ApplyEvent("default-use");
      else
  {
  Game.SelectedItem=null;
  actor.Talk("/TXT0821/I can't use these things together.");
  }
 
    }
    // just a simple click
    else ActObj.ApplyEvent("LeftClick");
  }
  // else propagate the LeftClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



////////////////////////////////////////////////////////////////////////////////
on "RightClick"
{
  // if inventory item selected? deselect it
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
    return;
  }

  var ActObj = Game.ActiveObject;

  // is the righ-click menu visible? hide it
  if(WinMenu.Visible == true) WinMenu.Visible = false;
  else if(ActObj!=null)
  {
    // if the clicked object can handle any of the "verbs", display the right-click menu
    if(ActObj.CanHandleEvent("Take") || ActObj.CanHandleEvent("Talk") || ActObj.CanHandleEvent("LookAt"))
    {
      // store the clicked object in a global variable MenuObject
      MenuObject = Game.ActiveObject;
      var Caption = WinMenu.GetControl("caption");
      Caption.Text = MenuObject.Caption;

      // adjust menu's position
      WinMenu.X = Game.MouseX - WinMenu.Width / 2;
      if(WinMenu.X < 0) WinMenu.X = 0;
      if(WinMenu.X+WinMenu.Width>Game.ScreenWidth) WinMenu.X = Game.ScreenWidth-WinMenu.Width;

      WinMenu.Y = Game.MouseY - WinMenu.Height / 2;
      if(WinMenu.Y<0) WinMenu.Y = 0;
      if(WinMenu.Y+WinMenu.Height>Game.ScreenHeight) WinMenu.Y = Game.ScreenHeight-WinMenu.Height;

      // and show the right-click menu
      WinMenu.Visible = true;

      // stop the actor from whatever he was going to do
      actor.Reset();
    }
    // no verbs supported, no menu is needed; just send the RightClick event to the object
    else ActObj.ApplyEvent("RightClick");
  }
}


////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  WinCaption.Visible = false;
  var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  // and if the user selected Yes
  if(WinQuit.xResult)
  {
    // quit the game
    Game.QuitGame();
  }
  // otherwise just unload the quit window from memory
  else Game.UnloadObject(WinQuit);
}

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Picture/Sprite when loading
« Reply #4 on: April 09, 2014, 05:19:30 PM »

You can't do it like this, the game loop and the event handlers must be in a script that's attached to the Game itself. Now you moved it to some scene that will cease to exist almost immediately.
Keep most of the stuff in game.script. Only move the LoadActor to the loading scene, because that will be the most time-consuming part.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Picture/Sprite when loading
« Reply #5 on: April 10, 2014, 09:54:02 PM »

Thanks, I get what you mean. I'll give it a try.

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Picture/Sprite when loading
« Reply #6 on: April 11, 2014, 04:39:37 AM »

OK, I took from game.script only the loading of the character. And I made my start-up scene a splashscreen scene with WME logo. The sequence loads but when the game starts the cursor is gone and the keyboard is not responding. Maybe something with the #include keys.inc?

Game.script
Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;
InventoryActive = true;


//testing kijal vsync method//

Scene.ScrollPixelsX = 25;
Game.SetVSyncMode=false;
Game.EnableHardwareCursors=false;


// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");


global MenuObject = null;

/*
// load our main actor
actor = Game.LoadActor("actors\Ray2D\Ray2D.actor");
Game.MainObject = actor;
*/

// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");

// run the "noise" script
Game.AttachScript("scenes\common\noiseFX.script");



// which scene to load?
Game.ChangeScene(Game.StartupScene);



////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    // clicking an inventory item
    if(ActObj.Type=="item" && Game.SelectedItem==null)
    {
      Game.SelectedItem = ActObj;
    }
    // using an inventory item on another object
    else if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
      var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
      else if(Item.CanHandleEvent("default-use")) Item.ApplyEvent("default-use");
      else if(ActObj.CanHandleEvent("default-use")) ActObj.ApplyEvent("default-use");
      else
  {
  Game.SelectedItem=null;
  actor.Talk("/TXT0821/I can't use these things together.");
  }
 
    }
    // just a simple click
    else ActObj.ApplyEvent("LeftClick");
  }
  // else propagate the LeftClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



////////////////////////////////////////////////////////////////////////////////
on "RightClick"
{
  // if inventory item selected? deselect it
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
    return;
  }

  var ActObj = Game.ActiveObject;

  // is the righ-click menu visible? hide it
  if(WinMenu.Visible == true) WinMenu.Visible = false;
  else if(ActObj!=null)
  {
    // if the clicked object can handle any of the "verbs", display the right-click menu
    if(ActObj.CanHandleEvent("Take") || ActObj.CanHandleEvent("Talk") || ActObj.CanHandleEvent("LookAt"))
    {
      // store the clicked object in a global variable MenuObject
      MenuObject = Game.ActiveObject;
      var Caption = WinMenu.GetControl("caption");
      Caption.Text = MenuObject.Caption;

      // adjust menu's position
      WinMenu.X = Game.MouseX - WinMenu.Width / 2;
      if(WinMenu.X < 0) WinMenu.X = 0;
      if(WinMenu.X+WinMenu.Width>Game.ScreenWidth) WinMenu.X = Game.ScreenWidth-WinMenu.Width;

      WinMenu.Y = Game.MouseY - WinMenu.Height / 2;
      if(WinMenu.Y<0) WinMenu.Y = 0;
      if(WinMenu.Y+WinMenu.Height>Game.ScreenHeight) WinMenu.Y = Game.ScreenHeight-WinMenu.Height;

      // and show the right-click menu
      WinMenu.Visible = true;

      // stop the actor from whatever he was going to do
      actor.Reset();
    }
    // no verbs supported, no menu is needed; just send the RightClick event to the object
    else ActObj.ApplyEvent("RightClick");
  }
}


////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  WinCaption.Visible = false;
  var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  // and if the user selected Yes
  if(WinQuit.xResult)
  {
    // quit the game
    Game.QuitGame();
  }
  // otherwise just unload the quit window from memory
  else Game.UnloadObject(WinQuit);
}


Start-up scene:

Code: [Select]
#include "scripts\base.inc"


Game.Interactive=false;
Game.FadeIn(600);
Sleep(2000);

Game.FadeOut(600);
Game.ChangeScene("scenes\LoadingScene2\LoadingScene2.scene", false, false, false);


on "LeftClick"
{
Game.FadeOut(600);
Game.ChangeScene("scenes\LoadingScene2\LoadingScene2.scene", false, false, false);
}

Second Splash:
Code: [Select]
#include "scripts\base.inc"


Game.Interactive=false;
Game.FadeIn(600);
Sleep(2000);

Game.FadeOut(600);
Game.ChangeScene("scenes\LoadingScene\LoadingScene.scene", false, false, false);


on "LeftClick"
{
Game.FadeOut(600);
Game.ChangeScene("scenes\LoadingScene\LoadingScene.scene", false, false, false);
}

The actual Loading screen where I'm loading the main actor:

Code: [Select]
#include "scripts\base.inc"




Game.Interactive=false;
Game.FadeIn(600);
Sleep(2000);

actor = Game.LoadActor("actors\Ray2D\Ray2D.actor");
Game.MainObject = actor;
actor.Active = false;

Game.FadeOut(600);
Game.ChangeScene("scenes\SelectLanguage\SelectLanguage.scene", false, false, false);


The Select Language screen. The first interactive screen. It appears ok but I have no cursor and the keyboard is unresponsive.

Code: [Select]
#include "scripts\base.inc"

// here comes the stuff which initializes the scene
Game.FadeIn(600);
InventoryActive=false;
actor.Active = false;
Game.RemoveWaitCursor("sprites\system\cur_wait.sprite");
Game.SetActiveCursor("sprites\system\cur_arrow_h.sprite");
Game.LoadWindow("interface\system\SelectLanguage.window");
Game.PlayMusic("music\Nosebound_theme.ogg", true);

Any ideas of what could be happening here?. Thanks!

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: Picture/Sprite when loading
« Reply #7 on: April 11, 2014, 09:59:49 PM »

In your code I see many times:

Code: WME Script

while I can't find anywhere

Code: WME Script

Make sure you set it to true before showing your language selection screen. Not sure whether this is you problem. As far as I know, even if you set it to false, you still get the wait cursor (hourglass cursor by default).
Logged

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio
Re: Picture/Sprite when loading
« Reply #8 on: April 12, 2014, 06:16:13 AM »

Yeah. That was it. I forgot to turn it back true at the end of the scripts.  Now it's working much great Thanks!!.
The loading screen is a complete freeze,  but at least people now can see that the game is loading, it's better than 30 seconds of pure blackness.

Thank you guys!.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Picture/Sprite when loading
« Reply #9 on: May 14, 2014, 12:57:45 PM »

I am also using lazy load pattern a lot. This helps make the game running much faster. Even with game-scoped things, load them when you need them for the first time. This way loading times spread. This also is important for animation-heavy scenes. Our switch to Full HD really forced me to optimize much more.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.048 seconds with 21 queries.