User prompt
create a settings tab. let it be a place where we can turn off music and effects. let it be a language option. let it be Turkish and English. let it be a game reset feature ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Let it be the power value according to the level of the rigs. This power value should be written as a total in the power place above. It should not exceed the upgradeable power value. In cases where it will be more than the upgradeable power, more rigs should not be purchased.
User prompt
Buy more powerful mining rigs
User prompt
save the game every 5 seconds ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
bitcoin values should not be displayed with abbreviations
User prompt
The numbers in the game appear with globally accepted abbreviations.
Code edit (1 edits merged)
Please save this source code
User prompt
Crypto Mining Tycoon
Initial prompt
I'm looking to commission the development of a mobile **Idle Miner / Tycoon game** centered around Bitcoin (or cryptocurrency) mining, heavily inspired by Fumb Games' "Bitcoin Miner." The game should offer a satisfying progression loop of expanding a mining operation, optimizing profits, and accumulating virtual wealth through strategic upgrades and resource management. --- ### Core Game Concept The player's goal is to become a top crypto mining tycoon. Starting with a basic setup in a small room, players will invest their earned virtual Bitcoin into acquiring more powerful mining rigs, upgrading infrastructure, and unlocking new mining locations. The game emphasizes passive income generation, where the player's core interaction shifts from active tapping to making strategic decisions about upgrades and expansions. --- ### Key Features & Mechanics 1. **Mining Process (Idle-Focused):** * **Automated Mining:** Rigs automatically mine Bitcoin/crypto over time. The player does not need to tap constantly for core income. * **Visual Feedback:** Clear visual indication of mining activity (e.g., rigs blinking, numbers increasing). * **Offline Earnings:** The game must continue to generate Bitcoin while the player is offline, with a clear collection mechanism upon return. 2. **Mining Rigs (Equipment Management):** * **Variety of Rigs:** A diverse catalog of mining rigs, each with distinct stats: * **Hash Rate (Mining Power):** How much Bitcoin it generates per second/minute. * **Electricity Consumption:** How much power it uses. * **Heat Generation:** How much heat it produces (potentially affecting cooling costs or efficiency). * **Cost:** Purchase price. * **Tiered Progression:** As players progress, new, more powerful (and expensive) rigs unlock. * **Upgrade System:** Individual rigs can be upgraded to improve their hash rate or efficiency. 3. **Infrastructure & Facility Management:** * **Power Supply:** Manage electricity consumption. Upgrade power generators or power lines to support more rigs. High consumption could lead to higher electricity bills or power outages. * **Cooling Systems:** Rigs generate heat. Upgrade cooling systems (fans, AC units) to maintain optimal operating temperatures and efficiency. * **Mining Rooms/Locations:** Unlock and expand into larger or more efficient mining rooms/facilities, each potentially offering bonuses or more space for rigs. * **Network Upgrades:** Improve network efficiency or reduce data transfer costs. 4. **Research & Development (R&D) / Tech Tree:** * A tech tree or research lab where players can invest Bitcoin/cash to unlock global efficiency bonuses, new rig types, or advanced infrastructure upgrades. * Examples: "Improved Cooling Efficiency," "Next-Gen Chip Design," "Automated Maintenance." 5. **Bitcoin (Crypto) Market Simulation:** * A simplified, dynamic in-game market where the value of Bitcoin (or the in-game crypto) fluctuates over time. * Players can **sell** their mined Bitcoin for cash (the currency used for buying new rigs, power, upgrades) at strategic times to maximize cash earnings. * Visual representation of the market trend (e.g., a simple graph). 6. **Prestige System:** * A core long-term retention mechanic. Players can "reset" their progress (sell all rigs, clear rooms) at certain milestones to earn **permanent prestige currency** (e.g., "MegaHash Tokens" or "Super Bitcoins"). * This prestige currency is used to buy powerful **global permanent bonuses** that make subsequent playthroughs much faster and more profitable. 7. **Monetization & Economy:** * **In-App Purchases (IAP):** Focus on premium currency (e.g., "Gems," "Gold Bars") for: * Instant cash/Bitcoin boosts. * Premium time warps (speed up idle earnings). * Exclusive cosmetic items for the mining facility. * "No Ads" purchase option. * **Rewarded Video Ads:** Optional ads for: * Temporary income multipliers (e.g., "2x profit for 30 min"). * Instant electricity refills. * Short-term speed boosts for mining. * **Balanced Economy:** Carefully designed resource costs and earnings to ensure satisfying progression without feeling too slow or too fast. --- ### Art Style & User Interface (UI/UX) * **Art Style:** Clean, clear, and appealing **isometric or top-down perspective** on the mining room/facility. Visuals should clearly distinguish different rigs and upgrades. A slightly realistic but stylized aesthetic would be suitable. * **UI/UX:** Intuitive, uncluttered, and highly responsive mobile-first interface. Easy access to all stats (Bitcoin balance, cash, hash rate, power consumption), upgrade menus, market, and research tree. Clear visual indicators for full offline earnings, low power, etc. --- ### Technical Requirements * **Platform:** iOS and Android compatibility. * **Game Engine:** Unity (highly recommended for this genre). * **Data Storage:** Robust system for saving player progress locally and potentially to the cloud. --- ### Deliverables * Comprehensive Game Design Document (GDD) detailing all features, upgrade trees, and economic balance. * All necessary 2D/3D art assets (rig models, room environments, UI elements, animations). * Fully functional, stable, and optimized game build for both iOS and Android.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var BitcoinParticle = Container.expand(function () { var self = Container.call(this); var particle = self.attachAsset('bitcoinIcon', { anchorX: 0.5, anchorY: 0.5 }); self.startY = 0; self.targetY = 0; self.animate = function (startY, targetY) { self.y = startY; self.startY = startY; self.targetY = targetY; tween(self, { y: targetY, alpha: 0 }, { duration: 2000, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var MiningRig = Container.expand(function (rigType) { var self = Container.call(this); // Rig properties based on type var rigStats = { basic: { hashRate: 0.1, powerCost: 0.05, price: 100 }, advanced: { hashRate: 0.5, powerCost: 0.2, price: 500 }, professional: { hashRate: 2.0, powerCost: 0.8, price: 2500 } }; self.rigType = rigType || 'basic'; self.stats = rigStats[self.rigType]; self.lastMineTime = Date.now(); var rigGraphics = self.attachAsset('miningRig', { anchorX: 0.5, anchorY: 0.5 }); // Add visual indicator for rig type if (self.rigType === 'advanced') { rigGraphics.tint = 0x8e44ad; } else if (self.rigType === 'professional') { rigGraphics.tint = 0xe67e22; } // Mining animation self.animate = function () { tween(rigGraphics, { scaleX: 1.1, scaleY: 1.1 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(rigGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 500, easing: tween.easeInOut }); } }); }; self.update = function () { var currentTime = Date.now(); if (currentTime - self.lastMineTime >= 1000) { // Mine every second self.lastMineTime = currentTime; self.animate(); // Generate bitcoin based on hash rate bitcoin += self.stats.hashRate; // Power usage is calculated globally, not per rig // Play mining sound occasionally if (Math.random() < 0.1) { LK.getSound('mining').play(); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ // Game state variables var bitcoin = storage.bitcoin || 0; var cash = storage.cash || 1000; var miningRigs = []; var powerCapacity = storage.powerCapacity || 10; var coolingCapacity = storage.coolingCapacity || 10; var powerUsage = 0; var bitcoinPrice = 45000 + Math.random() * 10000; // Starting price between 45k-55k var lastPriceUpdate = Date.now(); // UI Elements var bitcoinDisplay = new Text2('₿ 0.00', { size: 50, fill: 0xF39C12 }); bitcoinDisplay.anchor.set(0, 0); bitcoinDisplay.x = 150; bitcoinDisplay.y = 50; LK.gui.topLeft.addChild(bitcoinDisplay); var cashDisplay = new Text2('$ 1,000', { size: 50, fill: 0x27AE60 }); cashDisplay.anchor.set(0, 0); cashDisplay.x = 150; cashDisplay.y = 120; LK.gui.topLeft.addChild(cashDisplay); var priceDisplay = new Text2('BTC: $45,000', { size: 40, fill: 0xFFFFFF }); priceDisplay.anchor.set(1, 0); LK.gui.topRight.addChild(priceDisplay); var powerDisplay = new Text2('Power: 0/10', { size: 35, fill: 0xE74C3C }); powerDisplay.anchor.set(0.5, 0); powerDisplay.y = 50; LK.gui.top.addChild(powerDisplay); // Power meter visual var powerMeterBg = LK.getAsset('powerMeter', { anchorX: 0.5, anchorY: 0.5 }); powerMeterBg.tint = 0x34495e; powerMeterBg.x = 1024; powerMeterBg.y = 120; game.addChild(powerMeterBg); var powerMeterFill = LK.getAsset('powerMeter', { anchorX: 0, anchorY: 0.5, scaleX: 0 }); powerMeterFill.x = powerMeterBg.x - powerMeterBg.width / 2; powerMeterFill.y = powerMeterBg.y; game.addChild(powerMeterFill); // Upgrade buttons var rigUpgradeButton = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); rigUpgradeButton.x = 300; rigUpgradeButton.y = 2500; game.addChild(rigUpgradeButton); var rigUpgradeText = new Text2('Buy Mining Rig - $100', { size: 35, fill: 0xFFFFFF }); rigUpgradeText.anchor.set(0.5, 0.5); rigUpgradeText.x = rigUpgradeButton.x; rigUpgradeText.y = rigUpgradeButton.y; game.addChild(rigUpgradeText); var powerUpgradeButton = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); powerUpgradeButton.x = 700; powerUpgradeButton.y = 2500; game.addChild(powerUpgradeButton); var powerUpgradeText = new Text2('Upgrade Power - $200', { size: 35, fill: 0xFFFFFF }); powerUpgradeText.anchor.set(0.5, 0.5); powerUpgradeText.x = powerUpgradeButton.x; powerUpgradeText.y = powerUpgradeButton.y; game.addChild(powerUpgradeText); var sellButton = LK.getAsset('sellButton', { anchorX: 0.5, anchorY: 0.5 }); sellButton.x = 1100; sellButton.y = 2500; game.addChild(sellButton); var sellButtonText = new Text2('Sell Bitcoin', { size: 35, fill: 0xFFFFFF }); sellButtonText.anchor.set(0.5, 0.5); sellButtonText.x = sellButton.x; sellButtonText.y = sellButton.y; game.addChild(sellButtonText); // Mining rig types and costs var rigTypes = ['basic', 'advanced', 'professional']; var currentRigType = 0; // Starting mining rigs if (storage.rigCount === undefined) { var startingRig = new MiningRig('basic'); startingRig.x = 400; startingRig.y = 400; game.addChild(startingRig); miningRigs.push(startingRig); storage.rigCount = 1; storage.rigTypes = ['basic']; } else { // Restore saved rigs var savedRigTypes = storage.rigTypes || []; for (var i = 0; i < storage.rigCount; i++) { var rigType = savedRigTypes[i] || 'basic'; var rig = new MiningRig(rigType); rig.x = 400 + i % 10 * 140; rig.y = 400 + Math.floor(i / 10) * 120; game.addChild(rig); miningRigs.push(rig); } } // Number formatting utility function formatNumber(num) { if (num < 1000) { return num.toFixed(0); } else if (num < 1000000) { return (num / 1000).toFixed(1) + 'K'; } else if (num < 1000000000) { return (num / 1000000).toFixed(1) + 'M'; } else if (num < 1000000000000) { return (num / 1000000000).toFixed(1) + 'B'; } else if (num < 1000000000000000) { return (num / 1000000000000).toFixed(1) + 'T'; } else if (num < 1000000000000000000) { return (num / 1000000000000000).toFixed(1) + 'Qa'; } else { return (num / 1000000000000000000).toFixed(1) + 'Qi'; } } // Utility functions function updateUI() { bitcoinDisplay.setText('₿ ' + bitcoin.toFixed(2)); cashDisplay.setText('$ ' + formatNumber(cash)); priceDisplay.setText('BTC: $' + formatNumber(bitcoinPrice)); powerDisplay.setText('Power: ' + powerUsage.toFixed(1) + '/' + powerCapacity); // Update power meter var powerRatio = Math.min(powerUsage / powerCapacity, 1); powerMeterFill.scaleX = powerRatio; if (powerRatio > 0.9) { powerMeterFill.tint = 0xe74c3c; // Red when near capacity } else if (powerRatio > 0.7) { powerMeterFill.tint = 0xf39c12; // Orange when high } else { powerMeterFill.tint = 0x27ae60; // Green when safe } // Update upgrade button costs var rigType = rigTypes[currentRigType]; var baseCost = rigType === 'basic' ? 100 : rigType === 'advanced' ? 500 : 2500; var rigCost = baseCost * Math.pow(1.2, Math.floor(miningRigs.length / 3)); var rigName = rigType.charAt(0).toUpperCase() + rigType.slice(1); rigUpgradeText.setText('Buy ' + rigName + ' Rig - $' + formatNumber(rigCost)); var powerCost = 200 * Math.pow(1.3, (powerCapacity - 10) / 5); powerUpgradeText.setText('Upgrade Power - $' + formatNumber(powerCost)); } function spawnBitcoinParticle() { if (Math.random() < 0.05) { // 5% chance per frame when mining var particle = new BitcoinParticle(); particle.x = 400 + Math.random() * 800; particle.animate(300, 150); game.addChild(particle); } } // Function to calculate total power requirement function calculateTotalPowerUsage() { var totalPower = 0; for (var i = 0; i < miningRigs.length; i++) { totalPower += miningRigs[i].stats.powerCost; } return totalPower; } // Event handlers rigUpgradeButton.down = function (x, y, obj) { var rigType = rigTypes[currentRigType]; var baseCost = rigType === 'basic' ? 100 : rigType === 'advanced' ? 500 : 2500; var rigCost = baseCost * Math.pow(1.2, Math.floor(miningRigs.length / 3)); var powerRequired = rigType === 'basic' ? 0.05 : rigType === 'advanced' ? 0.2 : 0.8; var currentTotalPower = calculateTotalPowerUsage(); if (cash >= rigCost && currentTotalPower + powerRequired <= powerCapacity) { cash -= rigCost; var newRig = new MiningRig(rigType); newRig.x = 400 + miningRigs.length % 10 * 140; newRig.y = 400 + Math.floor(miningRigs.length / 10) * 120; game.addChild(newRig); miningRigs.push(newRig); // Save rig types if (!storage.rigTypes) storage.rigTypes = []; storage.rigTypes.push(rigType); storage.rigCount = miningRigs.length; // Cycle to next rig type currentRigType = (currentRigType + 1) % rigTypes.length; LK.getSound('purchase').play(); // Flash effect LK.effects.flashObject(rigUpgradeButton, 0x27ae60, 300); } }; powerUpgradeButton.down = function (x, y, obj) { var powerCost = 200 * Math.pow(1.3, (powerCapacity - 10) / 5); if (cash >= powerCost) { cash -= powerCost; powerCapacity += 5; storage.powerCapacity = powerCapacity; LK.getSound('purchase').play(); // Flash effect LK.effects.flashObject(powerUpgradeButton, 0x27ae60, 300); } }; sellButton.down = function (x, y, obj) { if (bitcoin >= 0.01) { var sellAmount = bitcoin; var earnings = sellAmount * bitcoinPrice; cash += earnings; bitcoin = 0; LK.getSound('coin').play(); // Flash effect LK.effects.flashObject(sellButton, 0xf39c12, 500); // Show earnings popup var earningsText = new Text2('+$' + formatNumber(earnings), { size: 60, fill: 0xF39C12 }); earningsText.anchor.set(0.5, 0.5); earningsText.x = sellButton.x; earningsText.y = sellButton.y - 100; game.addChild(earningsText); tween(earningsText, { y: earningsText.y - 100, alpha: 0 }, { duration: 2000, easing: tween.easeOut, onFinish: function onFinish() { earningsText.destroy(); } }); } }; game.update = function () { powerUsage = calculateTotalPowerUsage(); // Calculate total power usage from all rigs // Update bitcoin price periodically if (Date.now() - lastPriceUpdate > 5000) { // Every 5 seconds lastPriceUpdate = Date.now(); var priceChange = (Math.random() - 0.5) * 0.1; // ±5% change bitcoinPrice = Math.max(10000, bitcoinPrice * (1 + priceChange)); } // Spawn bitcoin particles when mining if (miningRigs.length > 0) { spawnBitcoinParticle(); } updateUI(); // Save progress periodically if (LK.ticks % 300 === 0) { // Every 5 seconds storage.bitcoin = bitcoin; storage.cash = cash; storage.powerCapacity = powerCapacity; storage.rigCount = miningRigs.length; // Save rig types var rigTypesToSave = []; for (var i = 0; i < miningRigs.length; i++) { rigTypesToSave.push(miningRigs[i].rigType); } storage.rigTypes = rigTypesToSave; } };
===================================================================
--- original.js
+++ change.js
@@ -91,9 +91,9 @@
self.lastMineTime = currentTime;
self.animate();
// Generate bitcoin based on hash rate
bitcoin += self.stats.hashRate;
- powerUsage += self.stats.powerCost;
+ // Power usage is calculated globally, not per rig
// Play mining sound occasionally
if (Math.random() < 0.1) {
LK.getSound('mining').play();
}
@@ -289,15 +289,24 @@
particle.animate(300, 150);
game.addChild(particle);
}
}
+// Function to calculate total power requirement
+function calculateTotalPowerUsage() {
+ var totalPower = 0;
+ for (var i = 0; i < miningRigs.length; i++) {
+ totalPower += miningRigs[i].stats.powerCost;
+ }
+ return totalPower;
+}
// Event handlers
rigUpgradeButton.down = function (x, y, obj) {
var rigType = rigTypes[currentRigType];
var baseCost = rigType === 'basic' ? 100 : rigType === 'advanced' ? 500 : 2500;
var rigCost = baseCost * Math.pow(1.2, Math.floor(miningRigs.length / 3));
var powerRequired = rigType === 'basic' ? 0.05 : rigType === 'advanced' ? 0.2 : 0.8;
- if (cash >= rigCost && powerUsage + powerRequired <= powerCapacity) {
+ var currentTotalPower = calculateTotalPowerUsage();
+ if (cash >= rigCost && currentTotalPower + powerRequired <= powerCapacity) {
cash -= rigCost;
var newRig = new MiningRig(rigType);
newRig.x = 400 + miningRigs.length % 10 * 140;
newRig.y = 400 + Math.floor(miningRigs.length / 10) * 120;
@@ -355,9 +364,9 @@
});
}
};
game.update = function () {
- powerUsage = 0; // Reset power usage each frame
+ powerUsage = calculateTotalPowerUsage(); // Calculate total power usage from all rigs
// Update bitcoin price periodically
if (Date.now() - lastPriceUpdate > 5000) {
// Every 5 seconds
lastPriceUpdate = Date.now();