Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Monsieur OUXX

#41
Quote from: Cassiebsg on Tue 06/08/2019 12:34:29
Try talking to Problem, if you can get a hold of him. Last I heard he was building a game with Godot.
Thanks a bunch!
#42
I'm pretty pissed off that the Escoria demo game crashes on me... I wrote this : https://github.com/godotengine/escoria/issues/270
Anyone else has this issue ?

I'm too new to Godot and it scares me to try and making a point-n'-click prototype without building on a dedicated code base like Escoria -- I feel like I'd overlook something obvious and yet hard to implement, like saving games, and then be stuck.

#43
Here is some non-trivial information about this attempt:
- Godot recently got a big boost (both in features and popularity and visibility) which made it move from "promising" to "the main 100% free rival to Unity".
- Escoria is a library/framework written in Godot script that implements in Godot all the tedious things expected in an adventure game (save/restore games + actions verbs + high level scripting language ("Esc" language) to script dialogs and custscenes).

The mild weakness of this is that Escoria had a flamboyant start but then became immediately obsolete when Godot moved up to Godot 3.0 and then 3.1. It broke some things.
The guys behind Escoria made it (mostly) work with Godot 3.0. There's a branch for that in their github, conveniently named "Escoria 3.0". It's good enough for any adventure game, really. Escoria also has a branch for Godot 3.1 and 3.1.1. But they're not actively developing those ones.

I've been trying to run the demo game of Escoria 3.0 in Godot 3.0.x (3.0.6) and I got a crash after a few clicks  :( But maybe it's just me who doesn't know enough yet. I'll keep you updated on that.

If anyone has a suggestion for another set of tools to develop a point n click game in Godot, then they're welcome to reply here.

#44
The Rumpus Room / Re: What grinds my gears!
Wed 03/07/2019 08:48:45
Quote from: notarobotyet on Wed 03/07/2019 06:34:16
If your game needs such restrictive conditions to be enjoyable, it probably isn't too good to begin with.

You do not talk shit about Cyan. YOU. DO. NOT. TALK. SHIT. ABOUT. CYAN.
(The entire Myst series had a monitor calibration screen)  ;)
#45
This is made with AGS?
#47
Quote from: abstauber on Wed 30/01/2019 14:47:54
I wasn't able to replicate this outside of your game project.

Thanks a lot for such a quick answer. I'll send the link to CW and Tzachs.

============

EDIT: so the issue was that "Anti-alias TTF fonts" was set to "true" in the general settings. Now everything works perfectly.

============

EDIT 2 :

Here is a module that generates all the action buttons automatically, with an outline, shadow, inner gradient, and is meant to fit nicely with Tumbleweed. It also manages the horizontal stretching of some buttons in the languages that allow it (mostly, English)
It's meant to save the hassle of having to redraw and reimport a billion action buttons in every language. In our case we didn't like the blue theme but it would have taken an eternity to change it to red.

It's called "AutoButtons" (CODE BELOW)

Spoiler



Module header :
Code: ags

/*

//All values below defined in Tumbleweed module 
enum Action {
  eGA_LookAt = 0, //Starting at zero helps avoiding human mistakes when iterating on the enum
  eGA_TalkTo,
  eGA_GiveTo,
  eGA_PickUp,
  eGA_Use,
  eGA_Open,
  eGA_Close,
  eGA_Push,
  eGA_Pull,
  eGA_UseInv,
  eGA_Default,
  eGA_WalkTo
};

enum eLanguage {
  eLangEN = 0, //Starting at zero helps avoiding human mistakes when iterating on the enum
  eLangDE,
  eLangES, 
  eLangIT, 
  eLangFR, 
  eLangPT, 
  eLangNL
};

*/

enum AutoButtonStates {
    eAutoButton_off = 0, 
    eAutoButton_on = 1, 
    eAutoButton_hover = 2
};


#define THEMESIZE 20 //this must be bigger than the number of values in AutoButtonsThemeSettings

enum AutoButtonsThemeSettings {
  eAutoBSetting_color_off,   
  eAutoBSetting_color_off_gradienttop,   
  eAutoBSetting_color_off_gradientbottom,   
  eAutoBSetting_color_on,   
  eAutoBSetting_color_on_gradienttop,   
  eAutoBSetting_color_on_gradientbottom,   
  eAutoBSetting_color_hover,   
  eAutoBSetting_color_hover_gradienttop,   
  eAutoBSetting_color_hover_gradientbottom,   
  eAutoBSetting_color_outline,   
  eAutoBSetting_color_shadow 
};

enum AutoButtonThemes {
    eAutoButtonTheme_Red = 0, 
    eAutoButtonTheme_Blue = 1
    
};

struct AutoButtons
{
    import static int[] GetTheme(AutoButtonThemes theme); //Get the settings values from any of the built-in themes
    import static void SetTheme(AutoButtonThemes theme,  int themeSettings[]); //Overwrite an existing theme from your game, without requiring to temper with the module's script (if needed)
    import static int GenerateAll(int themeSettings[]);
    import static DynamicSprite* GetSprite(eLanguage lan,  Action action,  AutoButtonStates state);
    import static int GetSpriteID(eLanguage lan,  Action action,  AutoButtonStates state);
    
    
};





Module body :
Code: ags

#define NBACTIONS 12
#define NBLANGUAGES 7
#define MAXAUTOBUTTONS 84 //12*7

#define BUTT_WIDTH 56
#define BUTT_HEIGHT 12

#define MAXTEXTWIDTH 200 //Some bullshit width to be passed to GetTextHeight. Should be bigger than the biggest possible width

int defaultTheme;
GUI* guiMain; //The gui that has the action buttons

struct AutoButtonData {
    DynamicSprite* s[3]; //one for each state
    eLanguage lan;
    Action action;
    String text;
    int widenFactor; //how much the text should be stretched horizontally (not all the same depending on the language and the action)
    int width; //what should be the width of the buttons (they don't have the same width depending on the language and the action)
};
AutoButtonData buttons[MAXAUTOBUTTONS];

#define MAXTHEMES 3

struct Constants {
    int width;
    int height;    
};
Constants constants;

struct Theme {
    //all values below initialized in game_start or if you call SetTheme
    int settings[THEMESIZE];
    
    //You can add any field you want. For example String themeName;
    
};
Theme themes[MAXTHEMES];
//int nbThemes;


//Unfortunately the Verbs module does not provide the bare actions, only with their prepositions and complement, like "Look at %s"
String TranslateAction(Action a, eLanguage lan) {
    switch(lan) {
        case eLangEN: 
            switch(a) {
                case eGA_WalkTo: return "Go to";
                case eGA_LookAt: return "Look At";
                case eGA_TalkTo: return "Talk To";
                case eGA_GiveTo: return "Give";
                case eGA_PickUp: return "Pick Up";
                case eGA_Use: return "Use";
                case eGA_Open: return "Open";
                case eGA_Close: return "Close";
                case eGA_Push: return "Push";
                case eGA_Pull: return "Pull";
                default : 
                    return "ERROR";
                    break;
            }
            break;
        case eLangDE : 
            switch(a) {
                case eGA_WalkTo: return "Gehe zu";
                case eGA_LookAt: return "Schau";
                case eGA_TalkTo: return "Rede";
                case eGA_GiveTo: return "Gebe";
                case eGA_PickUp: return "Nehme";
                case eGA_Use: return "Nutze";
                case eGA_Open: return "Öffne";
                case eGA_Close: return "SchlieàŸe";
                case eGA_Push: return "Drücke";
                case eGA_Pull: return "Ziehe";
                default : 
                    return "ERROR";
                    break;
            }
            break;
        case eLangES : 
            switch(a) {
                case eGA_WalkTo: return "Ir a";
                case eGA_LookAt: return "Mirar";
                case eGA_TalkTo: return "Hablar";
                case eGA_GiveTo: return "Dar";
                case eGA_PickUp: return "Coger";
                case eGA_Use: return "Usar";
                case eGA_Open: return "Abrir";
                case eGA_Close: return "Cerrar";
                case eGA_Push: return "Empujar";
                case eGA_Pull: return "Tirar";
                default : 
                    return "ERROR";
                    break;
            }
            break;
        case eLangFR : 
            switch(a) {
                case eGA_WalkTo: return "Aller";
                case eGA_LookAt: return "Regarder";
                case eGA_TalkTo: return "Parler";
                case eGA_GiveTo: return "Donner";
                case eGA_PickUp: return "Prendre";
                case eGA_Use: return "Utiliser";
                case eGA_Open: return "Ouvrir";
                case eGA_Close: return "Fermer";
                case eGA_Push: return "Pousser";
                case eGA_Pull: return "Tirer";
                default : 
                    return "ERROR";
                    break;
            }
            break;
        case eLangIT : 
            switch(a) {
                
                case eGA_WalkTo: return "Vai a";
                case eGA_LookAt: return "Esamina";
                case eGA_TalkTo: return "Parla";
                case eGA_GiveTo: return "Dai";
                case eGA_PickUp: return "Raccogli";
                case eGA_Use: return "Usa";
                case eGA_Open: return "Apri";
                case eGA_Close: return "Ferma";
                case eGA_Push: return "Premi";
                case eGA_Pull: return "Tira";
                default : 
                    return "ERROR";
                    break;
            }
            break;
        case eLangPT : 
            switch(a) {   
                
                case eGA_WalkTo: return "Ir para";
                case eGA_LookAt: return "Olhar";
                case eGA_TalkTo: return "Falar";
                case eGA_GiveTo: return "Dar";
                case eGA_PickUp: return "Apanhar";
                case eGA_Use: return "Usar";
                case eGA_Open: return "Abrir";
                case eGA_Close: return "Fechar";
                case eGA_Push: return "Empurrar";
                case eGA_Pull: return "Puxar";
                default : 
                    return "ERROR";
                    break;
            }
            break;
        case eLangNL : 
            switch(a) {
    
                case eGA_WalkTo: return "Ga naar";
                case eGA_LookAt: return "Bekijk";
                case eGA_TalkTo: return "Praat";
                case eGA_GiveTo: return "Geef";
                case eGA_PickUp: return "Pak";
                case eGA_Use: return "Gebruik";
                case eGA_Open: return "Open";
                case eGA_Close: return "Sluit";
                case eGA_Push: return "Duw";
                case eGA_Pull: return "Trek";
                default : 
                    return "ERROR";
                    break;
            }
            break;    
        default : 
                return "ERROR2";
                break;
    }
}

DynamicSprite* DrawString_Widened(int font, String text, int color,  int widenFactor )
{
    int kerning = 0;
    int wordSpacing = 2; //arbitrary number of pixels for the 'space' character, to make the text more compact
    int maxWidth = GetTextWidth(text, font)*3;
    int height = GetTextHeight(text,  font,  MAXTEXTWIDTH);
    
    //The width is a bit hard to calculate so we'll start by drawing onto a temporary surface
    DynamicSprite* temp_s = DynamicSprite.Create(maxWidth,  height, true);
    DrawingSurface* temp_ds = temp_s.GetDrawingSurface();
    temp_ds.Clear();
    int offset = 0;
    temp_ds.DrawingColor = color;
    //we draw each letter one by one
    for (int i=0; i<text.Length; i++) {
        if (text.Chars[i] == ' ') {
            offset+=wordSpacing;
            
        } else {
            String c = String.Format("%c", text.Chars[i]);
            int letterWidth = GetTextWidth(c, font);
            //the easiest way to widen a letter is to draw it several times
            for (int j=0; j < widenFactor; j++) {
                temp_ds.DrawString(offset+j, 0, font, c);
            }
            offset+=(letterWidth+widenFactor);
            
            //if it's not the last letter we add a white space after the letter
            if (i<text.Length-1)
                offset+=kerning;
        }
    }
    
    //now that we know the width we copy the temp sprite to a final sprite    
    DynamicSprite* s = DynamicSprite.Create(offset,  height, true);
    DrawingSurface* ds = s.GetDrawingSurface();
    ds.DrawSurface(temp_ds);
    
    temp_ds.Release();
    
    return s;
    
}

//Draws 'graphic' 9 times onto ds, in an "outlined" manner (i.e. with offsets of -1 to +1)
void DrawOutline(DrawingSurface*ds,  int x,  int y,  int graphic)
{
   ds.DrawImage(x-1, y-1, graphic);
   ds.DrawImage(x-0, y-1, graphic);
   ds.DrawImage(x+1, y-1, graphic);
   ds.DrawImage(x-1, y-0, graphic);
   ds.DrawImage(x-0, y-0, graphic);
   ds.DrawImage(x+1, y-0, graphic);
   ds.DrawImage(x-1, y+1, graphic);
   ds.DrawImage(x-0, y+1, graphic);
   ds.DrawImage(x+1, y+1, graphic);
}

//See more at https://www.adventuregamestudio.co.uk/forums/index.php?topic=42449.0
int[] GetRGBFromColor(int color)
{
    int rgb[] = new int[3];
    bool highBit = true; //or false, you decide

    if (color > 65535) color -= 65536;
    rgb[0] = ((color >> 11) & 31) << 3;
    rgb[1] = ((color >> 6) & 31) << 3;
    rgb[2] = (color & 31) << 3;
    if (highBit)
    {
        rgb[0] = rgb[0] | 7;
        rgb[1] = rgb[1] | 3;
        rgb[2] = rgb[2] | 7;
    }
  
    return rgb;
}

//from top to bottom, every color of 'ds' that has color 'color' will be replaced by a gradient
void noloopcheck ApplyGradient(DrawingSurface* ds, int color, int color_gradient_top, int color_gradient_bottom)
{
    int rgb_top[] = GetRGBFromColor(color_gradient_top);
    int rgb_bottom[] = GetRGBFromColor(color_gradient_bottom);
    float height_f = IntToFloat(ds.Height);
    
    float r_top = IntToFloat(rgb_top[0]); float r_bottom = IntToFloat(rgb_bottom[0]); float step_r = (r_bottom-r_top)/height_f;
    float g_top = IntToFloat(rgb_top[1]); float g_bottom = IntToFloat(rgb_bottom[1]); float step_g = (g_bottom-g_top)/height_f;
    float b_top = IntToFloat(rgb_top[2]); float b_bottom = IntToFloat(rgb_bottom[2]); float step_b = (b_bottom-b_top)/height_f;
    
    float r = r_top; float g = g_top; float b = b_top; //start values
    for (int j=0; j< ds.Height; j++) {
        ds.DrawingColor = Game.GetColorFromRGB(FloatToInt(r), FloatToInt(g),  FloatToInt(b));
        
        for (int i=0; i<ds.Width; i++) {
            if (ds.GetPixel(i, j)==color)
                ds.DrawPixel(i, j);
        }
        
        r+=step_r; g+=step_g; b+=step_b;
    }
}

DynamicSprite* GenerateButton(String text,  int width,  AutoButtonStates state,  int widenFactor,  int themeSettings[])
{
   
   int font = eFontTumbleText;
   
   //int COLOR_BLACK = Game.GetColorFromRGB(5, 5, 5);
   int COLOR_RED = Game.GetColorFromRGB(255, 0, 0);
   int color = COLOR_RED; //we give it a default value for satefy
   int color_gradient_top = COLOR_RED; //we give it a default value for satefy 
   int color_gradient_bottom = COLOR_RED; //we give it a default value for satefy 
   switch(state) {
       case eAutoButton_off : 
        color = themeSettings[eAutoBSetting_color_off];
        color_gradient_top = themeSettings[eAutoBSetting_color_off_gradienttop];
        color_gradient_bottom = themeSettings[eAutoBSetting_color_off_gradientbottom];
        break;
       case eAutoButton_on :
        color = themeSettings[eAutoBSetting_color_on];
        color_gradient_top = themeSettings[eAutoBSetting_color_on_gradienttop];
        color_gradient_bottom = themeSettings[eAutoBSetting_color_on_gradientbottom];
        break;
       case eAutoButton_hover :
        color = themeSettings[eAutoBSetting_color_hover];
        color_gradient_top = themeSettings[eAutoBSetting_color_hover_gradienttop];
        color_gradient_bottom = themeSettings[eAutoBSetting_color_hover_gradientbottom];
        break;
        
       default:
        AbortGame("Unknown state");
   }
   //int width = constants.width;
   int height = constants.height;
   DynamicSprite* text_s = null;
   
   DynamicSprite* s = DynamicSprite.Create(width, height, true);  
   DrawingSurface* ds = s.GetDrawingSurface();
   //ds.DrawingColor = COLOR_TRANSPARENT;
   ds.Clear();
   
   //int textWidth = GetTextWidth(text, font); //we actually need the widened width
   int textHeight = GetTextHeight(text, font, MAXTEXTWIDTH);
   
   //(optional) colored rectangular background
   //ds.DrawingColor = Game.GetColorFromRGB(100, 100, 100);
   //ds.DrawRectangle(0, 0, width, height);
   
   //shadow
   text_s = DrawString_Widened(font, text, themeSettings[eAutoBSetting_color_shadow], widenFactor );
   int textWidth = text_s.Width;
   int offset_x = (width - textWidth)/2; if (offset_x < 0) offset_x = 0;
   int offset_y = (height - textHeight)/2;  if (offset_y < 0) offset_y = 0;
   DrawOutline(ds, offset_x+widenFactor, offset_y, text_s.Graphic);
   
   //outline (the cheapest way to do an outline is to draw the text 9 times with and offset of -1 or +1 all around
   text_s = DrawString_Widened(font, text, themeSettings[eAutoBSetting_color_outline], widenFactor );
    DrawOutline(ds, offset_x, offset_y, text_s.Graphic);
   //widened text. It returns a temporary sprite that we immediately copy onto our drawing surface
   text_s = DrawString_Widened(font, text, color, widenFactor );
   ds.DrawImage(offset_x,  offset_y, text_s.Graphic);
   
   //gradient
   ApplyGradient(ds, color,  color_gradient_top,  color_gradient_bottom);
   
   //finish up
   text_s.Delete();
   ds.Release();
   
   return s;
}

//this is purely built-in
//how much the text should be stretched horizontally (not all the same depending on the language and the action)
int GetWidenFactor(eLanguage lan,  Action a)
{
    switch(lan) {
        case eLangDE :
                    if (a==eGA_Close) //In German, "SchlieBe"'s font is narrower then the other buttons fonts
                        return 1;
                    else
                        return 2; 
                    break;
        case eLangEN : return 2; break;
        case eLangES : return 1; break;
        case eLangFR : return 1; break;
        case eLangIT : return 1; break;
        case eLangNL : return 1; break;
        case eLangPT : return 1; break;

        default : AbortGame("Unknown language");
    }
}


//Utility : Returns the button bound to a given action. Unfortunately this function is not provided by Verbs
Button*  GetActionButton(Action a)
{
    //we scan every control
    for (int i=0; i<guiMain.ControlCount; i++) {
      GUIControl* c = guiMain.Controls[i];
      Button* b = c.AsButton;
      if (b!=null) {
          if (Verbs.GetButtonAction(b) == a)
            return b;
      }
    }
    
    //AbortGame("Couldn't find the button bound to action '%d'", a);
    return null; //Not all actions have a button. E.g. "walk to"
    
    //If it was implemented in Verbs we would just use this : 
    //return Verbs.GetActionButton(a);
}


int GetButtonWidth(Action a) {
    /*
    //Somehow the automated code below doesn't work. buttons return goofy values, like b.Width == 200. I have no idea why.
    Button* b = GetActionButton(a);
    if (b!= null) {
        //Display("Action %d return button.ID=%d, which has width %d x height %d. It belongs to GUI %d. Name is '%s'", a,  b.ID,  b.Width, b.Height,  b.OwningGUI.ID,  b.Text);
        return b.Width;
    } else { 
        return constants.width; //this action doesn't seem to have a button. We roll back to the default buttons width
    }
    */
    
    //Manual version. TODO : find why code above does not work.
    switch(a) {
        case eGA_LookAt :  return 56; //larger buttons in the central column
        case eGA_TalkTo :  return 56; //larger buttons in the central column
        case eGA_PickUp :  return 56;  //larger buttons in the central column
        default: return 50; //narrower buttons in th eleft and right column
    }
}

static int AutoButtons::GenerateAll(int themeSettings[])
{
    int NBSPRITES = NBACTIONS*NBLANGUAGES;
    
    //safety
    if (NBSPRITES > MAXAUTOBUTTONS) 
        AbortGame("Did something change?");
    
    //Some languages have shorter words so we can make the text wider up to a factor of 3
    int widenFactor = 1;
    
    for (int i=0; i < NBLANGUAGES; i++) {
        
        
        for (int a = 0; a<NBACTIONS; a++) {
             widenFactor = GetWidenFactor(i,  a);
            int width = GetButtonWidth(a);
            
            buttons[i*NBACTIONS+a].widenFactor = widenFactor;
            buttons[i*NBACTIONS+a].width = width;
            
            String text = TranslateAction(a, i);
            
            buttons[i*NBACTIONS+a].lan = i;
            buttons[i*NBACTIONS+a].action = a;
            buttons[i*NBACTIONS+a].s[eAutoButton_off] = GenerateButton(text, width, eAutoButton_off, widenFactor, themeSettings);
            buttons[i*NBACTIONS+a].s[eAutoButton_on] = GenerateButton(text, width,  eAutoButton_on, widenFactor, themeSettings);
            buttons[i*NBACTIONS+a].s[eAutoButton_hover] = GenerateButton(text, width, eAutoButton_hover, widenFactor, themeSettings);
            buttons[i*NBACTIONS+a].text = text;
            
        }
    }
    
}


static DynamicSprite* AutoButtons::GetSprite(eLanguage lan,  Action action,  AutoButtonStates state)
{
    return buttons[lan*NBACTIONS+action].s[state];
}

static int AutoButtons::GetSpriteID(eLanguage lan,  Action action,  AutoButtonStates state)
{
    return buttons[lan*NBACTIONS+action].s[state].Graphic;
}

float min(float a,  float b) { if (a < b) return a; return b; }
float max(float a,  float b) { if (a > b) return a; return b; }
float bound(float a,  float roof,  float floor) { return min(roof, max(a, floor)); }

//this function returns a darker or brighter version of color 'color'.
// 'factor' between 0.0 and 2.0.
// - If factor is 0.0, the function returns black (because the color has been darkened to the max). 
// - If it's 1.0, the color doesn't change
// - If factor is 2.0, the function probably returns white, or at least 'color" is now twice brighter
int ChangeBrightness(int color,  float factor) 
{
    int rgb[] = GetRGBFromColor(color);
    float r = IntToFloat(rgb[0]); float g = IntToFloat(rgb[1]); float b = IntToFloat(rgb[2]); 
    rgb = null;
    r = bound(r*factor, 255.0,  0.0); g = bound(g*factor, 255.0,  0.0); b = bound(b*factor, 255.0,  0.0);
    return Game.GetColorFromRGB(FloatToInt(r), FloatToInt(g),FloatToInt(b));
}

int[] GetTheme_BuiltIn(AutoButtonThemes theme)
{

    //useful values
    int COLOR_RED = Game.GetColorFromRGB(255, 99, 99);
    int COLOR_BROWN = Game.GetColorFromRGB(50, 0, 0);
    int COLOR_YELLOW = Game.GetColorFromRGB(255, 249, 72);
    int COLOR_GRAYISHRED = Game.GetColorFromRGB(116, 63, 63);
    int COLOR_DARKGRAYISHRED = Game.GetColorFromRGB(52, 32, 32);
    int COLOR_BLACK = Game.GetColorFromRGB(5, 5, 5);
    
    int themeSettings[] = new int[THEMESIZE];
    
    switch (theme) {
        case eAutoButtonTheme_Red : 

    
            themeSettings[eAutoBSetting_color_off] = COLOR_RED;
            themeSettings[eAutoBSetting_color_on] = COLOR_YELLOW;
            themeSettings[eAutoBSetting_color_hover] = COLOR_BROWN;
            themeSettings[eAutoBSetting_color_outline] = COLOR_GRAYISHRED;
            themeSettings[eAutoBSetting_color_shadow] = COLOR_BLACK;
            
            /*
            //MANUAL
            themeSettings[eAutoBSetting_color_off_gradienttop] =            Game.GetColorFromRGB(255, 175, 175);
            themeSettings[eAutoBSetting_color_off_gradientbottom] =         Game.GetColorFromRGB(200, 0, 0);
            themeSettings[eAutoBSetting_color_on_gradienttop] =             Game.GetColorFromRGB(255, 249, 125);
            themeSettings[eAutoBSetting_color_on_gradientbottom] =          Game.GetColorFromRGB(200, 200, 25);
            themeSettings[eAutoBSetting_color_hover_gradienttop] =          Game.GetColorFromRGB(100, 50, 50);
            themeSettings[eAutoBSetting_color_hover_gradientbottom] =       Game.GetColorFromRGB(25, 0, 0);
            */
            //AUTOMATED
            themeSettings[eAutoBSetting_color_off_gradienttop] =            ChangeBrightness(themeSettings[eAutoBSetting_color_off],  1.5);
            themeSettings[eAutoBSetting_color_off_gradientbottom] =         ChangeBrightness(themeSettings[eAutoBSetting_color_off],  0.5);
            themeSettings[eAutoBSetting_color_on_gradienttop] =             ChangeBrightness(themeSettings[eAutoBSetting_color_on],  1.5);
            themeSettings[eAutoBSetting_color_on_gradientbottom] =          ChangeBrightness(themeSettings[eAutoBSetting_color_on],  0.5);
            themeSettings[eAutoBSetting_color_hover_gradienttop] =          ChangeBrightness(themeSettings[eAutoBSetting_color_hover],  1.5);
            themeSettings[eAutoBSetting_color_hover_gradientbottom] =       ChangeBrightness(themeSettings[eAutoBSetting_color_hover],  0.5);
            

            break;
            
        case eAutoButtonTheme_Blue :
            AbortGame("NOT IMPLEMENTED (suit yourself)");
            
            break;
    }
    
    return themeSettings;
}

static int[] AutoButtons::GetTheme(AutoButtonThemes theme) 
{
    int themeSettings[] = new int[THEMESIZE];
    
    if (theme < 0 || theme >= MAXTHEMES)
        AbortGame("Not a valid theme number : %d", theme);
    
    for (int i=0; i< THEMESIZE; i++) {
        themeSettings[i] = themes[theme].settings[i];
    }
    
    return themeSettings;
}

 //Overwrite an existing theme from your game, without requiring to temper with the module's script (if needed)
static void AutoButtons::SetTheme(AutoButtonThemes theme,  int themeSettings[])
{
    if (theme < 0 || theme >= MAXTHEMES)
        AbortGame("Not a valid theme number : %d", theme);
    
    for (int i=0; i< THEMESIZE; i++) {
        themes[theme].settings[i] = themeSettings[i];
    }
}



void game_start()
{
    //depends on your game
    guiMain = gMain; //this is a dirty hack. we should rely only on "Verbs" methods but it doesn't offer GetActionButton.
    
    //nbThemes = 0;
    defaultTheme = eAutoButtonTheme_Red;
    
    //Init buttons constant width. This is normally ignored and replaced with buttons[].width because not all buttons have the same width
    constants.height = BUTT_HEIGHT;
    constants.width = BUTT_WIDTH;

    //Init built-in themes
    int themeSettings[] = GetTheme_BuiltIn(eAutoButtonTheme_Red);
    AutoButtons.SetTheme(eAutoButtonTheme_Red,  themeSettings);
    //themeSettings[] = GetTheme_BuiltIn(eAutoButtonTheme_Blue);
    //AutoButtons.SetTheme(eAutoButtonTheme_Blue,  themeSettings);
    
    //final init
    themeSettings = AutoButtons.GetTheme(defaultTheme);
    AutoButtons.GenerateAll(themeSettings);
}




Here is how to make it work with Tumbleweed :
(locate the code below in your Tumbleweed initialization code)
Code: ags

      // English - eLangEN  
      /*
        //WITHOUT AUTOBUTTONS : Set button graphics manually
        odd_id=1407; even_id = odd_id+1;
        Verbs.LocalizeActionButton(eLangEN,eGA_Open,    GetOddId(), GetEvenId(), 'q');
        Verbs.LocalizeActionButton(eLangEN,eGA_Close,   GetOddId(), GetEvenId(), 'a');
        Verbs.LocalizeActionButton(eLangEN,eGA_GiveTo,  GetOddId(), GetEvenId(), 'z');
        Verbs.LocalizeActionButton(eLangEN,eGA_Push,    GetOddId(), GetEvenId(), 'e');
        Verbs.LocalizeActionButton(eLangEN,eGA_Pull,    GetOddId(), GetEvenId(), 'd');
        Verbs.LocalizeActionButton(eLangEN,eGA_Use,     GetOddId(), GetEvenId(), 'c');
        Verbs.LocalizeActionButton(eLangEN,eGA_PickUp,  GetOddId(), GetEvenId(), 'w');
        Verbs.LocalizeActionButton(eLangEN,eGA_LookAt,  GetOddId(), GetEvenId(), 's');
        Verbs.LocalizeActionButton(eLangEN,eGA_TalkTo,  GetOddId(), GetEvenId(), 'x');
      */
        //WITH AUTOBUTTONS : Get the sprites IDs from the module; it generated thems for you.
        eLanguage lan = eLangEN; int graphic_off; int graphic_on; Action a;
        a = eGA_Open;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'q');
        
        a = eGA_Close;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'a');
        
        a = eGA_GiveTo;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'z');
        
        a = eGA_Push;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'e');
        
        a = eGA_Pull;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'd');
        
        a = eGA_Use;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'c');
        
        a = eGA_PickUp;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'w');
        
        a = eGA_LookAt;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 's');
        
        a = eGA_TalkTo;
        graphic_off = AutoButtons.GetSpriteID(lan, a, eAutoButton_off);
        graphic_on = AutoButtons.GetSpriteID(lan, a, eAutoButton_on);
        Verbs.LocalizeActionButton(lan, a,    graphic_off, graphic_on, 'x');
        

[close]
#48
I have a new problem, which is the font issue that I've mentionned previously. It's not caused by the module itself however I don't understand what differs between my own game files and the demo game.

Abstauber, unfortunately the best way to show you my issue is to share the game files but I don't want to do it publicly, so I'm sending them to you in a Private Message.

For everyone, here is my issue's description:

CONTEXT
- I have a game based on the Tumbleweed module.
- It contains the "gAction" GUI, which itself contains "lblAction" -- same as Tumbleweed demo game
- lblAction uses the "eFontTumbleTextOut" font.  -- same as Tumbleweed demo game
- "TumbleTextOut" was imported from assets/xpaider2.ttf  -- same as Tumbleweed demo game
- TumbleTextOut was imported as 9pts and has outline "automatic" -- same as Tumbleweed demo game
- the game is set to "proper alpha blending" for both GUI and fonts -- same as Tumbleweed demo game

ISSUE
- In the demo game, when i open gAction, the label appears with the font without its outline (the outline is rendered only in-game)
- In my own game, when I open gAction, the label appears with a crappy 1-pixel outline the same color as the font. It's like the font is white with a white outline.

Screenshot:


I've tried tried overwriting xpaider2.ttf over itself, by re-importing it into the Tumbleweed demo game (without changing anything else), to see if it would do the same as in my game. That is, to see if the import action was broken in my current AGS version (3.4.1.13) but the label is still rendered properly in the Editor in the demo game.
I've tried re-importing /xpaider2.ttf over itself into my own game, but the issue is still there : it has this unwanted white outline.

Note that the font appears as expected in the Editor's "font" panel. It's only messed up in the label in gAction.

I'm 100% sure it's caused by transparency and some font pixels not being 100% transparent, hence being rendered as 100% opaque. But I just can't understand why it doesn't do the same in my game and in the demo game.

==========

unrelated : how do you manage to have all the GUIs appear with the proper Z order in your demo game, without defining any custom z-order? I had to do it in my own game.
#49
PROBLEM SOLVED.

From the start I was focusing on "GUI alpha rendering style", but it was actually "Sprite alpha rendering style" that caused the issue.
I'm not sure if it was because of the background sprite I was using OR if it was because of the font I'm using, that contains semi-transparent pixels, causing the outline to go crazy when the blending failed (unfortunately it went so crazy that I failed to visually identify it as only the outline)

Anyways now that everything is set to "proper alpha blending", everything seems to work as expected.

Thanks!!!
This is the thing that took me the most time on the short game I'm making :D *sigh of relief*
#50
Quote from: abstauber on Thu 03/01/2019 10:24:25

  CustomDialogGui.DialogGuiOptions[eDialogGui_bg_img_transparency]   = -1;

OK. I don't know what I'm doing wrong. When importing the PNG, should I say "yes" to "use alpha?" and should I select "leave transparency as-is"?
#51
So I'm not forgetting that I need to review the pull request, but in the meantime I'm having a weird issue. thanks to Khris it's been narrowed down to AGS apparently not being very good at having a sprite with alpha AND a transparency > 0 used as a GUI background.

I'm trying to set the custom dialogs GUI background to a black background with a slight transparency. Everything below failed :

- I tried with a fully black image (no alpha) and eDialogGui_bg_img_transparency set to 20, the background does not appear at all.
- I tried with a sprite imported from a PNG containing an all-black image with alpha (the black is 20% transparent) and  and eDialogGui_bg_img_transparency set to 0, now it's the font outline that goes cuckoo.
- I tried with the same semi-transparent PNG sprite and eDialogGui_bg_img_transparency set to -1. Now it's the transparency rendering that's all over the place (some pixels become fully transparent while some others are fully opaque).

What is the proper way?
#52
Sorry guys I had a crazy month (I think the other people in my game project have probably hired bounty hunters to get me by now). I'll check out my code and the state of the pull, as well as CW's comment asap.
#53
Recruitment / Re: Offer Your Services!
Wed 19/09/2018 12:42:26
EDIT: my mistake
#54
Quote from: abstauber on Wed 05/09/2018 11:00:36
your pull request does not compile (yet)

Weird. I made sure I never committed without compiling and testing first.
How do pull requests work? Do you see the state of the code at the time I did the pull request, or do you see the current state of the cloned respository and the branch it contains?
#55
fyi : I've done a pull request.
#56
Quote from: abstauber on Sun 05/08/2018 20:12:18
You can find the wfn font in the assets folder in Github, or here on the forums: it is Tom Thumb.
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48798

Cool. That's also the one I've been using in other places.
#57
Tiny issue : the "tiny" font points to the same file as other fonts : xpaider2.ttf. And that file does not seem to be the right one. I tried importing it at small sizes (5 or 6pt) but it's not right. Can you help me?
#59
When you double-click on the hologram character, the player does not "fast walk". Is that intended? I haven't tested but I guess the same thing would happen when you double-click on objects or hotspots?
#60
I'm so confused right now. Wasn't there a new parameter added recently to DynamicSprite.Draw or .Resize or whatever where you could choose the scaling algorithm? Or am I mixing it up with the new parameter for transparency copy (legacy, additive...)? My bad then.

But anyways, even if imsomnia212 has to write the antialised method himself (which shouldn't be too hard because it doesn't have to be real-time, it can be super slow, just copy some bilinear code from wikipedia), it's only an extra step to the method I described to achieve his goal of antialised saved games screenshots.
SMF spam blocked by CleanTalk