Recent posts by pl0xz0rz on Kongregate

Flag Post

Topic: Kongregate APIs / Kongregate API in HTML5 game

What do you mean, do they come up? I see their names and types, and they have exactly the same names as the ones I’m submitting.

It worked just fine when I uploaded the game, but it broke when I pressed the publish button.

Flag Post

Topic: Kongregate APIs / Kongregate API in HTML5 game

I’ve implemented Kongregate statistics API in my game. However, it doesn’t seem to work. I’ve uploaded the game, tested it and it worked just fine. However, after I hit publish, it suddenly broke.

When I beat a level, this is what I get from the console.

[Game] StatServices.submit ( maxlevel, 1 ) game.html
[Konduit] [Game->Service]: stat.submit: {"stats":[{"value":1,"name":"maxlevel"}],"":1}
Flag Post

Topic: Game Programming / Hittest error - not the usual stuff, it's a tricky one!

You’re doing a dicrete collision check. Try using a raycast from last known good coordinates to current ones, and then it should work.

It takes some math, but nothing difficult.

EDIT; Or just icrease the height of the hitboxes

Flag Post

Topic: Game Programming / LOS for patfinding in a TD?

I’m making a TD game in HTML5. For some reason, however, it bogs down when placing towers on the creeps path. From what I see on the profiler, the A* isn’t the problem. The problem is creating the navmesh. So far it’s a simple grid, with gcost computed by looking up the collision detection quadtree. The path also feels blocky. (I am also about to remove the quadtree and use prune and sweep with kd-trees).

What I want to do is:
1. Create a vertex array of the graph by pushing vertices of the staticCollisionObject array (without redundant vertices).
2. Do rays between them. Bruteforcing, it’s O(n^3), extremely slow. However, I think there is some way of doig it in O(n^2) without cheating using some kind of tree structures Better, but still probably slow. (also pruning for head-on edges)
3. Perform A* for the resulting graph consisting of the vertex array and the edges.

However, I feel that the step 2 will be too slow, so I will probably do some cheating. The question is, what kind of chating?

Flag Post

Topic: Game Programming / AS2 Turret

This is the code for rotating the cannon and firing a bullet

 //This attempts to shoot at the point by normalizing the vector and firing a bullet
	function shoot(x,y){
		if (this.reload > .99){
		this.reload -= 1;
		x -= this.x;
		y -= this.y;
		var temp = 1 / Math.sqrt((x*x+y*y)/(this.cannon.x*this.cannon.x + this.cannon.y * this.cannon.y));
		this.cannon.x = temp*x;
		this.cannon.y = temp*y;
		var l = new blackOrb(this.cannon.x + this.x,this.cannon.y + this.y,this.ammo.r,this.cannon.x*this.power,this.cannon.y*this.power,this.ammo.m);

But you also need this.

//This happens to each tower on each frame, this is a naive method, there are better methods with better performance
//but for a TD game where there aren't many creeps, this is close enough.
function aim(id){
	var bestTarget = null;
	var bestTargetValue = 0;
	switch (towerPatterns[towers[id].pattern].lineOfSightType){ //Selects the enemy to attack
		case 0:
			for (var i=0;i<enemies.length;i++){
				if ((towers[id].y - enemies[i].y) * (towers[id].y - enemies[i].y) + (towers[id].x - enemies[i].x) * (towers[id].x - enemies[i].x) < towerPatterns[towers[id].pattern].range * towerPatterns[towers[id].pattern].range) {
					if (bestTargetValue < cameraMaxY-enemies[i].y) {
						bestTarget = i;
						bestTargetValue = cameraMaxY-enemies[i].y;
	if (bestTarget === null) {return null} else {
		switch (towerPatterns[towers[id].pattern].velocityPerception){
			case 0:
				var dir = new vektor2d(0,0);
				dir.x = enemies[bestTarget].x   + (enemies[bestTarget].img.width  / 2);
				dir.y = enemies[bestTarget].y   + (enemies[bestTarget].img.height / 2);
				return dir;
	return null;

NINJA EDIT: Forgot to call the shoot() function

function aiTower(id){
	var l = aim(id);
	if (l !==  null) towers[id].shoot(l.x,l.y);

Another ninja edit: Typo

Flag Post

Topic: Game Programming / Funny bugs in your games

Or this physics bug.

Bug with physics + ran out of background = this fractal/guy

Flag Post

Topic: Game Programming / Funny bugs in your games

On this thread, write about some bugs in your games.

I was making a TD for a game jam in ten days, that was exactly the same time as last GiTD. It went really bad. There were three problems. Ugly graphics, bad leveldesign and bugs.

Some of the bugs:
When shooting at point-blank range, sometimes, the tower eould divide by zero because of a bugged Vec2.normalize(). The bug was fixed immediantly.

Infinite loop:
When there were more creeps than towers, there was a race condition that caused an infinite loop when assigning targets to towers.

When an enemy escaped from the maze, the game would crash. It was because the index was overflowing the pathnode stack. The bug was fixed one hour before deadline, however, the fix introduced another bug.

The AI bug:
When the path nodes move, everyone throws himself againist the ground and attempts to dig down. It is caused by assigning everyone to the start node, that is deep undergorund. I don’t know why does it assing everyone to it.

Collision detection bug: Sometimes, the collision detetion algorithm bugged with rigid bodies, getting them stuck inside walls, with soft bodies, it worked correctly, fixed right after deadline.

Ugly texture bug: Because the textures are generated procedurally just in time, even this is bugged. The bug was caused by calling the generateTexture(avg,o,eps) with a string avg argument. Fixed after deadline.

Collision resolution bug: Creeps crashing into walls were getting healed instead of damaged. Fixed one hour before deadline.

Bubblesort: For some reason, somehow it got to the gcost() function called by the AI. Unfixed as of yet, but given a high priority. Sometimes, it makes the game hang for a second.

Flag Post

Topic: Game Programming / A* with NO diagonals

Simple. Don’t use Euclidean distance on a grid. Instead, use weighted Manhattan distancce (abs(x) + abs(y) + epsilon * abs(y)).
Epsilon should be so low, it doesn’t overestimate costs by more than one unit, so the path is still optimal.

Flag Post

Topic: Game Programming / GiTD [#27] Entries and Discussion

What? It’s exactly the same time as our local compo game jam.

Flag Post

Topic: Game Programming / Any catch in uploading a game?(noob question)

Thanks for answering, I asked because in the news, I heard about a scam music portal that sued people whouploaded anything there. And because flash games only support MP3 music and that it costs %2500 to publish anything that uses it, and so thought there were some costs like this, but either it’s only for big name ones, or Kong pays this, or something.

Flag Post

Topic: Game Programming / Any catch in uploading a game?(noob question)

Could anyone please list everything needed to upload a game to Kong? So that I don’t have to risk legal trouble or my game being deleted and not knowing why.
I just want to know if uploading it is worth it. I’ve already made one for a game jam, but didn’t publish it anywhere else.
Kong doesn’t need payments from me, as far as I know, but what about third parties? And what about other paperwork? All graphics are either public domain or mine, music is made using a GPL soundfont, and it’s coded in Haxe, using my own physics engine.

Flag Post

Topic: Swords & Potions / Want to join a fun guild lv1+?

Invite me

Flag Post

Topic: Serious Discussion / Is logic incomplete?

1. This sentence is false.
And so?
2. Pinocchio saids: My nose will grow.
His nose will grow, as he will lie, although he will tell the truth.
3. A crocodile saids that he will return a guy’s son if the guy guesses correctly what the crocodile will do. The father saids, you will not give me my child.
Assuming the crocodile can not travel in time, the guy will take his son by force, as the crocodile gets stuck in an infinite loop.
If the crocodile can travel in time, he will cause a time paradox, returning the child, but not returning the kid at the same time, but in another timeline.

Flag Post

Topic: Off-topic / Does the Pope like nanners?

Spam much?

Seriously, stop. And english, please.

Flag Post

Topic: Serious Discussion / End of the world: 2012 or not?

1.Y2k. they said that computers would fail and the nuclear warheads would launch themselves.
2.2003. there were several prophecies that the world would end in rains of blood in cities, tidal waves and earthquakes.
3.6/6/06. in June 6/6/2006 were the devil would have escaped from hell and killed everyone.
4.2012. well, i really don’t know what will happen, if anything happens at all.

Y2k – the critical computers were either Y2k-ready or it did’t change the way they were working.
2003 – I can’t think of anything.
6/6/6 – Well, at least the online game Runescape got pwnt.
2012 – I don’t know either.

Flag Post

Topic: Serious Discussion / Homosexual Marriage

Sorry for bad grammar, my keyboard sometimes does’t detect keystroke.

Marriage… But what ind of one?

Just because it’s not directly allowed by law, it doesn’t ean it’s forbidden.
Gays become gays by their behavior, although they get the risk factors sooner in life. They can work, mae money, buy stuff, tae drugs, have gay sex, and more stuff.

It’s not all gays that suffer from this law. Maybe only a minority. Of the gay people. But it’s not the law. It’s about the message it sends to other people. That gay marriages are equal to straight marriages.

Flag Post

Topic: Off-topic / The Zombies have Invaded.

Weapon: Inside information; a pistol; a toolkit; a computer; scout robot drones, etc.
Location: I’ll start in my house, searching for more information; what has caused the outbreak; attempt to destroy The Machine; the Source; or whatever it is.\
Song: Nothing
Other: I’ll first check if I am not infected, and if I am, then I attempt to either cure myself, or if it’s impossible, then at least stop the outbreak. But whai if it had a security self-destruct echanism that would kill every zombie, including me?

Flag Post

Topic: Serious Discussion / Alot of people want to go back in time to kill Hitler.

It wouldn’t change anything in this world. This is how time travel works – the only thing that changes this world is everything that goes through the wormhole – as soon as it opens, it stops being past and starts being a copy of it that didn’t exist before. And time travel maybe even doesn’t exist. But we can’t know.

EDIT: And it won’t cause ANY paradox; but you would either be stuck in the past or no change of the past has EVER happened.

P.S. I won’t kill Hitler. There’s no reason to do so. Why would I die trying to kill Hitler, if it didn’t change anythig at all?

Flag Post

Topic: Serious Discussion / Shocking survey... (Teen sex)

Another necro… Stp neroing this thread and let it die.

Flag Post

Topic: Platform Racing 2 / A Note to All PR2 Hackers!

Umm… You fail.

Flag Post

Topic: Serious Discussion / Cheat Engine

It depends on the type of the game, slow-paced puzzles are harder to cheat with CE, but walkthroughs break them.
Action games with small amounts of puzzle elements are BROKEN by CE, and walkthroughs just make them easier.

Flag Post

Topic: Serious Discussion / Patent office - a total joke. ( Stupidity inside )

Edit: Sorry for immature language

Flag Post

Topic: General Gaming / Most boring mmorpg you have ever played?


Flag Post

Topic: Kongregate Labs / Shootorials #3, #4, #5 and #6 with Free Tools - mtasc and swfmill

Sorry, when editing the code I made a typo

Instead of:
if (a==280) b=0

it was like
if (a=280) b=0

Flag Post

Topic: Kongregate Labs / Shootorials #3, #4, #5 and #6 with Free Tools - mtasc and swfmill

No shoot.swf fie at all

It doesn’t send me any error code AT ALL, but I don’t see shoot.swf