Recent posts by Levgre on Kongregate

Flag Post

Topic: Game Programming / Possible to use iframe with my flash game to use youtube player? (ideally w/o hosting game on other site)

I have a flash game on kongegrate that uses the youtube player API. It was using flash objects but that method is deprecated and being disabled on the 27th of this month.

So now I need to use an iframe embed for the youtube player, although it seems it is still controllable in the flash code.

https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player

I just started learning php/html this week, so I have a very basic understanding of it. I’m not sure what direction I should go for this. Do I upload an html file as the main game file, the swf as an additional file, and embed it with the html? Is it mandatory that I host the game at another site?

Just looking for at least some guidance so I don’t waste too much time going down dead ends… which I’ve already done for several days this week while failing to implement cloud saves using html/php through a web server :P

 
Flag Post

Topic: Game Programming / Can't get export/import to work for my as3 game

So I’ve been trying to work off the tutorial below but while I can get some variables to save, and a copy/pastable text string to show, I’ve been unable to get a clean load. I made all the variables I’m saving public wondering if that was the issue, but it didn’t help.

These are the two tutorials I’ve been using

http://jacksondunstan.com/articles/1642
http://code.tutsplus.com/tutorials/introduction-to-bytearray—active-8925

Any ideas what’s wrong here? I’ve been working on and off on this for a couple weeks and am pretty lost.


 stage.addChild(loadText);
stage.addChild(loadButton);
stage.addChild(saveButton);
 saveButton.addEventListener(MouseEvent.CLICK, clickSave);
loadButton.addEventListener(MouseEvent.CLICK, clickLoad);

 public function clickSave(e:MouseEvent)
	  {
      byteArray.writeObject(SharedObject.getLocal("otherWo"));
	  encodedSave = Base64.encodeByteArray(byteArray);
	  loadText.text = encodedSave;
	  }
	  
	 
	 private function clickLoad(Events:MouseEvent = null):void{
      try{
        decodedSave = Base64.decodeToByteArray(loadText.text);
        tempSave = SharedObject.getLocal("otherWo")
		removeEventListener(Event.ENTER_FRAME,onEnterFrame);
        //tempSave = decodedSave.readObject();
		tempSave = decodedSave.readObject() as SharedObject;
		saveGame();
		stage.addChild(confirmDialog)
		confirmDialog.x = 300;
		confirmDialog.y = 200;
         
      }catch(err:Error){
        loadText.text = "Please input a save codebefore clicking the 'Load' Button." + err.message;
    }

 
Flag Post

Topic: Reactor idle / offline progress is way too weak imo

Originally posted by kidopl:

You said 60%? i had game off for 2 days.. and got less than normally generate in 40 mins…

I meant 60% less i.e. 40% of normal progress, although I wouldn’t doubt much lower. Perhaps you capped before the 2 days ended.

 
Flag Post

Topic: Reactor idle / offline progress is way too weak imo

I’m not sure how much slower, it is but it seems 60% to possibly much higher.

Much of the time there’s absolutely no reason to have the game open anyways, there can be hour long or more gaps between purchases.

So I’m not sure if having slow offline progress benefits anyone, while it makes the game less enjoyable for people who don’t leave the game open.

Is there any reason not to have 100% offline progress (equivalent ticks to time passed), like a number of other idle games have?

 
Flag Post

Topic: Game Programming / white box graphical glitch during animations

bump, still trying to figure this out. May try a different website to see if that’s the cause (using wix.com for my prototype)

 
Flag Post

Topic: Trimps: General Discussion / Job idea: exploder/bomb maker

I’ll just post the chat excerpt below, people were talking about a self-destructive trimp, and someone mentioned blowing up equipment… which you essentially already do when you upgrade equipment. So there could be a trimp that makes use of it by doing damage to the current enemy whenever you upgrade your equipment. Basically like a spell nuke.

Could be used to blast through pesky enemies like snimps by timing your upgrades.

“blkl5184: I wish there was a job of exploder.
blkl5184: Don’t really care what it did.
naroom: Destroy 1 random Structure per second
supernova234: trimps explode for x number of dmg when killed
naroom: Exploder: Does nothing. When Fired, blows up, taking all of your Equipment with it.
Levgre: that’s actually an idea, when you upgrade your weapons it does damage for all the levels you got rid off”

 
Flag Post

Topic: Trimps: General Discussion / I'd like to like this game...

I agree, it’s not really an ‘idle’ game, but an ‘incremental’ game with an offline component (i.e. Farmville, can’t remember if Swords and Potions has offline growth)

 
Flag Post

Topic: Trimps: General Discussion / Where do I go from here?

a possible change is give it a chance to fully block damage (or say just give x20 block for one hit)

Thus it could be a good formation for when you can’t keep keep pace with first strikers damage, so you’d always have a chance get some damage through.

 
Flag Post

Topic: Trimps: General Discussion / Does any block hit if it's below the 20% pierce?

people who say they’ve looked at the code say it’s the latter, 20% must get through.

so with 1 million block, you will fully block 1 million unless the enemy has less than 1 million damage.

 
Flag Post

Topic: Trimps: General Discussion / Idea: Pet System

I was referring to them as a ‘big part of the game’ in regard to the UI space they take up and their mechanics. They have a unique function for the leader, a unique mechanic made just for them (trapstorm), and are the best use for foremen (since foremen are so slow at building other structures).

I agree they become pointless, as I wrote “Once you get enough perks they are essentially useless after z1-3.”

Also late game already is pretty much impossible without significant online time since combat takes so long. Early game also requires being online. so I don’t see this changing the “offline players punished” dimension at all. However by recapturing a pet less often, a player could compensate for not being online as much and having less traps.

 
Flag Post

Topic: Trimps: General Discussion / Idea: Pet System

So this is the 2nd of two major ideas I’ve had about the game (other being Trimp Professsionals).

How the pet system would work is you spend many traps (1000 through hundreds of thousands) to trap one of the -imp enemies, which then gives you bonus unique for each enemy type.

For example:

Pet dragimp increases damage and gem looting.

Pet Snimp does a high damage first strike hit, at the start of each battle

Pet Gorillimp would do a lesser damage first strike hit, as well as increase base damage

so on. The trap cost to capture say a level 70 gorillimp would be higher than a level 60 gorillimp, and the higher level one would provide more stats.

Perhaps there could be a pet storage system sorta like Pokemon, or once you get a new pet the old one is released.

Traps are a pretty big part of the game, but overall they don’t do much. Once you get enough perks they are essentially useless after z1-3. This could conveniently provide a use for the traps the player amasses (as well as a use for the leader, who doesn’t really need to do anything except research less than 1% of the time)

as far as interface, to prevent trapping pets in error, there could be a pet tab and you can simply click “buy last enemy defeated”. This should be pretty safe and could be classified as a “scary purchase” for pop ups.

 
Flag Post

Topic: Trimps: General Discussion / Idea: expansion to worker system,teachers + professionals

or trimpfessionals?

Anyways here’s how it works. One new worker type is called ‘teacher’, and for each teacher you can hire one trimp for a variety of ‘professional’ jobs.

For example:
have 50 teacher trimps

can hire:

20 blacksmith trimps (benefit for equipment)
10 mortician trimps (benefit based on trimp deaths)
10 hunter trimps (bonus versus certain enemies, perhaps first strikers)
10 doctor/medic trimps

or any combination thereof, up to 50 professionals. If you hire more teachers, you can then have a higher number of professionals.

The benefit of this system is there is minimal cost for rehiring and adjusting your professional workforce. They are made cheap/free, instead you just pay the steep cost for the teachers.

So it is sort of like the formation system, but for workers. You can adjust your professionals as fits the situation, or your play style.

And by my estimation there is enough space in the worker tab for about 14 more jobs, plenty of space for a teacher and 6+ professional trimp types :p.

 
Flag Post

Topic: Trimps: General Discussion / High PC resource usage?

Originally posted by Excele:

Wow, and I thought I was in need of an upgrade. My computer isn’t bad, it could run Windows 8.1 and Skyrim, but I am running off my onboard video card, which is a piece of trash. I have no issues running this game at all, even with a browser based MMO on another tab and another instance of it going in a private window, in addition to running GOM Media Player with a 720p movie going. As for Chrome chewing up tons of resources, that’s completely normal. It never was any good to begin with and, from what I’ve read and witnessed on a few friends’ very high end computers, it is just getting worse.

I posted my computer’s stats, I’m not in need of an upgrade for web games. Like I wrote, my processor is a 1.9 ghz quad core.

Again, like I said, I said I multi-task with Trimps (photoshop and adobe flash professional). and while I’m doing so, I don’t want a browser game spiking to 20-50% CPU. I could run a retail game like Skyrim, or maybe a bit older, and it would consume less CPU.

Facts are, Chrome is a widely used browser and other options are not really better as far as resources (I’ve tried Firefox and CPU usage was almost the same). It’s not a bad thing to increase compatibility with the most popular browsers.

 
Flag Post

Topic: Trimps: General Discussion / High PC resource usage?

bump, gave up on Trimps because of this. Too much PC usage to multi-task with this game. Perhaps there could be an option to disable the bar graphics, as that seems to be a huge chunk of the consumption.

 
Flag Post

Topic: Trimps: General Discussion / New Trimp challenge discussion thread.

I put Artisanistry up to 17 (normally i have it around 10) because you have to bring your equipment up to obscene levels. My hp equip was level 25 for tier 1 + 2, weapons slightly less. About level 18 for the three tier 3s I got before i finished the challenge.

Power, toughness, and relentlessness also gain importance. It’s a grind so the crits help it take less time.

Breeding is of no importance as far as combat.

 
Flag Post

Topic: Trimps: General Discussion / High PC resource usage?

Originally posted by Nightz0r:

You wont escape this downside of idle games in general due to the way most of them are designed. They are resource intensive simply because it is required a LOT of calculations per second (big numbers and stuff), nothing to do with graphics. It is all about your processor in fact.

It’s interesting though how it consumes much less power when you simply change tabs without (apparently) affecting the game run. Maybe it’s something the game maker should aim when he decides to tweak the code.

Nightz0r this actually isn’t true, idles vary a lot in resource usage.

Originally posted by xdragonfirex:

Removing all the progress bars lower my cpu usage to around 7~11%. (Pentium 4)
http://postimg.org/image/5aiw1rx05/

Thanks for the tip, how did you go about doing this?

 
Flag Post

Topic: Trimps: General Discussion / High PC resource usage?

It seems that Trimps is pretty processor intensive, particularly for a game w/o much graphics. I have a AMD A8-4500M (1.9 ghz quad core), can run lots of games, so I’m not on that old/weak a machine.

You can minimize the window and that does away with most of the usage while the game still runs, but that can be kind of annoying compared to just switching tabs.

Thinking about giving up on Trimps because I’d prefer an idle more facilitating of multi-tasking.

 
Flag Post

Topic: Game Programming / white box graphical glitch during animations

Game is in AS3.

I’ve searched extensively on google but haven’t found any info, it’s the small white box in the top right next to the alien (the lower right white is not a glitch just an asset is temporarily not there). They flicker, go away, come back.

It only ever happens in browsers (firefox or chrome) and seems to come and go (almost like the flash file is ‘working out rust). Also the trees are not a separate asset it’s just part of the whole background.

Also, I use greenshot for my tweens. Anyone have an idea what could cause this, how to fix it?

 
Flag Post

Topic: Game Programming / Show us a screenshot of what you're working on!

Been working on this idle game since last November, it’s coming out in about two weeks. Have an artist working on the UI atm, and I’ll be spending most of my time working on the graphics for the map (as well as a few coding things left). There’s 3 factions and 6 time eras per faction, so there’s 18 ‘map scenes’ to work on.

 
Flag Post

Topic: Game Programming / Best way to manage a number of background animations?

I am making an idle game, and in the background there will be a number of ‘citizens’ and other objects moving around, that the player can also periodically click on for bonuses.

Right now I have

a function to start off the animations (era1aaWalk)

an onenterframe listener manage the animations in a loop (makeWalk1aa)

an mouseclick listener when the player clicks on the citizen(clickWalk1aa), so there would be a similar listener for other objects (although I’ll probably make them all use the same event). The object for the citizen is alien3Walk1.

(removeRewardText1), which removes the reward popup from clicking on the target, after 5 seconds

while functional this is all pretty rough I guess. I did experiment with drawing fresh bitmaps for the reward popups, but ran into issues with them sometimes not disappearing. So I might stick with the current method for now. I won’t be having a ton of interactive clicking, maybe 5 targets max on the map at once.

Originally I had a single tweenMax function, using yoyo and repeat infinitely with a delay. But that wouldn’t allow me to adjust x coordinates as needed, after I did scaleX = -1 to the citizen to make it face the other direction.

public function era1aaWalk()
{
o = 0;
activeBackground.addChild(alien3Walk1);
alien3Walk1.addEventListener(MouseEvent.CLICK, clickWalk1aa);
alien3Walk1.x = 60;
alien3Walk1.y = 250;
TweenMax.to(alien3Walk1, 6, {x:90, y:350});
this.addEventListener(Event.ENTER_FRAME, makeWalk1aa);	
alien3Walk1.addEventListener(MouseEvent.CLICK, clickWalk1aa);
}
		
public function makeWalk1aa(e:Event)
{
o += 1;
		
         if(o == 510)
	{
	alien3Walk1.x += alien3Walk1.width;
	alien3Walk1.scaleX = -1;
	TweenMax.to(alien3Walk1, 6, {x:87, y:250});
	}
						
	if(o == 648)
	{
	alien3Walk1.removeEventListener(MouseEvent.CLICK, clickWalk1aa);
	}
			
	if(o == 1010)
	{
	alien3Walk1.addEventListener(MouseEvent.CLICK, clickWalk1aa);		
	TweenMax.to(alien3Walk1, 6, {x:90, y:350});	
	alien3Walk1.x -= alien3Walk1.width;
	alien3Walk1.scaleX = 1;
	o = 0;
	}
}
		
public function clickWalk1aa(e:MouseEvent)
{
alien3Walk1.addChild(rewardText1);	
alien3Walk1.removeEventListener(MouseEvent.CLICK, clickWalk1aa);		
resourcePoints += resourceRate;
rewardText1.text = "+" + resourceRateString + "resource";
stage.addEventListener(Event.ENTER_FRAME, removeRewardText1)
n = 0;
}
		
public function removeRewardText1(e:Event)
{
n += 1;
	if(n == 120)
	{
	alien3Walk1.removeChild(rewardText1);	
	stage.removeEventListener(Event.ENTER_FRAME, removeRewardText1)
	}
}

 
Flag Post

Topic: Game Programming / Best Way to format numbers? (show in thousands, millions, etc.)

“I think he’s looking for something like, when you have 10,000 it outputs as 10 thousand instead. Or 100,000,000 is 100 million. I could be wrong.”

Yes, that’s what I mean. Commas are optional.

 
Flag Post

Topic: Game Programming / Best Way to format numbers? (show in thousands, millions, etc.)

So far my idea is just to have if statements, which determine the format to use based on the quantity.

Is there an easier/more efficient way to do this?

 
Flag Post

Topic: Game Programming / Flash vs. Stencyl vs. Unity ( 2D games )

Flash actually does have a free version… http://www.flashdevelop.org/

 
Flag Post

Topic: Game Programming / MovieClip with dozens of children with pop-up info, best approach?

A roll over and roll out event listener could be used on each child. My intuition is that this is less effective/efficient than a single enter frame listener, which reacts according to X-Y coordinates?

Although the enter frame approach will have 7 + if/else ifs to go through.

This is for an achievement window, for an idle game. Here’s a screenshot (there’s only one column atm, there will be 4+)
http://i.imgur.com/Wrodn5Y.png

Here’s my code so far…. I’ll first determine the column, then how far down the achievement is. It’s my first time doing something like this, would appreciate any input!

                public function openAchievements(e:MouseEvent)
		{
		stage.addChild(achievementWindow);
		achievementWindow.addChild(backBox);
		achievementWindow.addEventListener(Event.ENTER_FRAME, achievementHover)
		backBox.addEventListener(MouseEvent.CLICK, closeAchievements);
		}
		
		public function achievementHover(e:Event)
		{
		trace(mouseY)
			if(mouseX <= 110)
			{
				if(mouseY >= 60 && mouseY < 110)
				{
				achievementWindow.addChild(achievementInfo);
				achievementInfo.x = mouseX;
				achievementInfo.y = mouseY - 40;	
				achievementText.text = "achv1"
				}
				else if(mouseY >=110 && mouseY < 160)
				{
				achievementWindow.addChild(achievementInfo);
				achievementInfo.x = mouseX;
				achievementInfo.y = mouseY - 40;		
				achievementText.text = "achv2"
				}
				else if(mouseY >=160 && mouseY < 210)
				{
				achievementWindow.addChild(achievementInfo);
				achievementInfo.x = mouseX;
				achievementInfo.y = mouseY - 40;		
				achievementText.text = "achv3"
				}
				else if(mouseY >=210 && mouseY < 260)
				{
				achievementWindow.addChild(achievementInfo);
				achievementInfo.x = mouseX;
				achievementInfo.y = mouseY - 40;		
				achievementText.text = "achv4"
				}
				else if(mouseY >=260 && mouseY < 310)
				{
				achievementWindow.addChild(achievementInfo);
				achievementInfo.x = mouseX;
				achievementInfo.y = mouseY - 40;		
				achievementText.text = "achv5"
				}
				else if(mouseY >=310 && mouseY < 350)
				{
				achievementWindow.addChild(achievementInfo);
				achievementInfo.x = mouseX;
				achievementInfo.y = mouseY - 40;		
				achievementText.text = "achv6"
				}
				else if(achievementInfo.parent!= null)
				{
				achievementWindow.removeChild(achievementInfo);
				}
			}
			else if(achievementInfo.parent!= null)
			{
			achievementWindow.removeChild(achievementInfo);
			}
		}
 
Flag Post

Topic: Game Programming / Time spent on games

My current game I’ve worked about 1200 hours, although it’s my first big game so there’s been lots of learning. In then end I’ll probably spend 1600-1700 hours, before it is released.