Idle Game Mechanics

I'm not even sure what I want to ask here tbh. :LZSblush:

Has anyone here ever done an Idle Game (Incremental Game) and come up with a mechanic?

I'm thinking on how to do that and which limits may occur. Thinking about this, for example, it would be nice if the Gold limit could be removed, so that players can theoretically earn infinite money.

As 10,000 and 1,000,000 Gold (or more) at some point no longer make nice numbers (imagine a 1 with 500 zeros), it would be smart if there would be a way to display Gold like 10,000 for example as 10K and 1,000,000 as 1M. Is this possible?

Which other RPG Maker-related limits can you think of when it comes to idle games and how could we overcome them?
This sounds like game mechanics, so you could have posted this there.

But a script to adjust specific values can be done.
Just say what you need changed.

As for idle games, I don't quite follow. Idle meaning you sit there and do nothing, that would only make sense to me if the player walked away and came back later. In my mind that situation I would want nothing to happen since the player was not there.
If something is to happen even if you do nothing then that needs to be a fully thought out idea so that mechanics/code can be written for it.
I was thinking about making a clicker game where you get more and more Gold and upgrades gradually. Unlike "normal" idle games, I don't want a mechanic where players get money without doing anything for it, meaning I want my players to actively collect their Gold from time to time.

What I need in any case is a script as described above, because Gold value will stack quite fast and high numbers like 10M or 10B should be possible for this use case.
The game I made has an in depth idle town building mechanic. (construction workers, scientists, police, etc.) All made with common events.

Explaining how it works can be found here: https://steamcommunity.com/sharedfiles/filedetails/?id=1248688047

Hopefully it gives you some ideas on what you can and/or should do.
Why don't you use something like steps to increment either gold or the chances of obtaining any prize or whatever you wanna give away for free?
Why don't you use something like steps to increment either gold or the chances of obtaining any prize or whatever you wanna give away for free?
That would be a good solution, however, I still had the problem that Gold is limited. I can do unlimited steps, technically, but I cannot add unlimited Gold to the player's bank account for each step he does, which is an issue for Incremental Games. Still, it would require me to take on a parallel process to align steps with Gold which could be bad for the overall game Performance.
it would be nice if the Gold limit could be removed, so that players can theoretically earn infinite money.

As 10,000 and 1,000,000 Gold (or more) at some point no longer make nice numbers (imagine a 1 with 500 zeros), it would be smart if there would be a way to display Gold like 10,000 for example as 10K and 1,000,000 as 1M. Is this possible?
Does someone want to help me achieving a on-map Gold Window display with the conditions above? It would enable me to make a whole clicker game where you could earn infinite money without a limit. It would be great.

If you have any questions to clarify, don't hesitate to ask me.

Spoiler: Number Formats
Bild_2023-06-24_145750118.png
This was a fun exercise once in a while
Ruby:
module Theo
  LetterDigit = {
    0 => "",
    1e3 => "k",
    1e6 => "M",
    1e9 => "G",
    1e12 => "T",
    1e15 => "P",
    1e18 => "E",
   
    # Add more letters here
    # using 1e21, 1e24, etc
  }
 
  def self.group_digit(num, digit)
    letter = divisor = nil
    Hash[Theo::LetterDigit.to_a.reverse].each do |k, v|
      if k <= num
        letter = v
        divisor = k
        break
      end
    end
  return (num.to_f / divisor.to_f).round(digit).to_s + letter
  end
 
end

class Window_Gold
  alias theo_letterdigit_value value
  def value
    Theo::group_digit(theo_letterdigit_value, 1)
  end
end

class Game_Party
  def gain_gold(amount)
    @gold = [@gold + amount, 0].max
  end
end
1687613519956.png

1687613485817.png


Anyone is free to edit and expand the functionality to other windows and else.
@TheoAllen Hi, Theo. Thank you. 🙂 For some reason, however, it displays "NaN G" for 0 Gold and then "InfinityG" as soon as I add 500 Gold to it. Which is strange because I cannot see those values be defined anywhere in your script. So maybe I did something wrong here? I tested it with a completely new and blank project.

What happens if I have 1,5k and remove 1 Gold? it still displays 1,5k (like it is supposed to do), but I assume the "backend" still knows it is actually 1499 Gold, right? So if my shop offers an item worth 1500 Gold, players cannot buy it by accident?

Any chance of having a way to display the Gold Window on Map Screen (bound at a SWITCH) without using the menu?
For some reason, however, it displays "NaN G" for 0 Gold and then "InfinityG" as soon as I add 500 Gold to it. Which is strange because I cannot see those values be defined anywhere in your script. So maybe I did something wrong here? I tested it with a completely new and blank project.
You're right.

What happens if I have 1,5k and remove 1 Gold? it still displays 1,5k (like it is supposed to do), but I assume the "backend" still knows it is actually 1499 Gold, right? So if my shop offers an item worth 1500 Gold, players cannot buy it by accident?
The letter digit is just for display purposes. The actual value would still change

Any chance of having a way to display the Gold Window on Map Screen (bound at a SWITCH) without using the menu?
As you wish
Ruby:
module Theo
  LetterDigit = {
    0 => "",
    1e3 => "k",
    1e6 => "M",
    1e9 => "G",
    1e12 => "T",
    1e15 => "P",
    1e18 => "E",
    
    # Add more letters here
    # using 1e21, 1e24, etc
  }
  
  GoldSwitch = 99
  
  def self.group_digit(num, digit)
    letter = divisor = nil
    Hash[Theo::LetterDigit.to_a.reverse].each do |k, v|
      if k <= num
        letter = v
        divisor = k
        break
      end
    end
  return (num.to_f / [divisor, 1].max.to_f).round(digit).to_s + letter
  end
  
end

class Window_Gold
  alias theo_letterdigit_value value
  def value
    Theo::group_digit(theo_letterdigit_value, 1)
  end
end

class Game_Party
  def gain_gold(amount)
    @gold = [@gold + amount, 0].max
  end
end

class Scene_Map
  alias theo_letterdigit_start start
  def start
    theo_letterdigit_start
    @gold_window = Window_Gold.new
    @gold_window.x = Graphics.width - @gold_window.width
    @gold_window.y = 0
    @gold_window.visible = $game_switches[Theo::GoldSwitch]
    @last_gold = $game_party.gold
  end
  
  alias theo_letterdigit_update update
  def update
    theo_letterdigit_update
    @gold_window.visible = $game_switches[Theo::GoldSwitch]
    if @last_gold != $game_party.gold && @gold_window.visible
      @last_gold = $game_party.gold
      @gold_window.refresh
    end
  end
  
end
@TheoAllen Thanks a bunch, Theo, now it works perfectly. 🙂 If now I only could use an Icon instead of the "G" for the Gold Value, it would be perfect. And I think there's no need to have a divisor for all values from 0 to 999.
And I think there's no need to have a divisor for all values from 0 to 999.
In that case, change line 34 to
Code:
Theo::group_digit(theo_letterdigit_value, theo_letterdigit_value >= 1000 ? 1 : 0)
You can also change the number 1 to 2 if you want two digits decimal
@TheoAllen It's even better with 2 digits. Now it's exactly what I wanted, thank you, bro. :LZSexcite:

Now, the only think left I need, which would be really nice, is the ability to show an Icon for Gold. I tried to combine this script with Seiryuki's left-side Currency Symbol, but it doesn't fit what I need. I need to replace the 'G' from 'Gold' with an Gold Icon. So the icon should be on the right.
The updated version with gold icon
Ruby:
module Theo
  LetterDigit = {
    0 => "",
    1e3 => "k",
    1e6 => "M",
    1e9 => "G",
    1e12 => "T",
    1e15 => "P",
    1e18 => "E",
    
    # Add more letters here
    # using 1e21, 1e24, etc
  }
  
  GoldSwitch = 99
  IconGold = 245
  
  def self.group_digit(num, digit)
    letter = divisor = nil
    Hash[Theo::LetterDigit.to_a.reverse].each do |k, v|
      if k <= num
        letter = v
        divisor = k
        break
      end
    end
    return (num.to_f / [divisor, 1].max.to_f).round(digit).to_s + letter
  end
  
end

class Window_Gold
  alias theo_letterdigit_value value
  def value
    Theo::group_digit(theo_letterdigit_value, theo_letterdigit_value >= 1000 ? 2 : 0)
  end
  
  def draw_currency_value(value, unit, x, y, width)
    cx = text_size(unit).width
    change_color(normal_color)
    draw_text(x, y, contents.width - 26, line_height, value, 2)
    draw_icon(Theo::IconGold, contents.width - 24, y)
  end
end

class Game_Party
  def gain_gold(amount)
    @gold = [@gold + amount, 0].max
  end
end

class Scene_Map
  alias theo_letterdigit_start start
  def start
    theo_letterdigit_start
    @gold_window = Window_Gold.new
    @gold_window.x = Graphics.width - @gold_window.width
    @gold_window.y = 0
    @gold_window.visible = $game_switches[Theo::GoldSwitch]
    @last_gold = $game_party.gold
  end
  
  alias theo_letterdigit_update update
  def update
    theo_letterdigit_update
    @gold_window.visible = $game_switches[Theo::GoldSwitch]
    if @last_gold != $game_party.gold && @gold_window.visible
      @last_gold = $game_party.gold
      @gold_window.refresh
    end
  end
  
end
@TheoAllen Now you opened the whole world of incremental games to me. You deserve a trophy, mate. Thanks a bunch again!
@TheoAllen do you think it's possible to add items to a shop with those prices as well? With the normal eventing I cannot add Items like for 1,5k, 3M and so on.
@Tw0Face There might be scripts out there already that accomplish what you asked for in your previous post. I am not a VXAce user, though. I found this:


Not sure if it's of much use to you. I searched for 'price' in the RGSS3 Scripts (RMVX Ace) forum.
@Tw0Face it would benefit more people if you create a new thread titled "Set Item Price Above 999.999" or something. For more visibility, archive, and keywords if people searched a similar topic.
Now the Gold Limit is totally gone. I dunno if Theo's script will also work in any default or custom Scene_Shop script.

Ruby:
class Game_Party
  def gain_gold(amount)
    @gold = [@gold + amount, 0].max
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/idle-game-mechanics.156512/