Recent posts by Draco18s on Kongregate

Flag Post

Topic: Game Programming / Procedural Generation

Something like that. I did it a little differently, but yeah.

Basically instead of this:

I get

(Both of those are on the same seed values.

Here’s my code:

OptimizedPerlin.octaves = 2;
j = i+onY*(chunkWidth*chunkHeight);  //generation occurs in 150x150 pixel chunks
x = (j % chunkWidth) / (chunkWidth/4) + int(onX*4);
y = int(j / chunkWidth) / (chunkHeight/4);
ox = OptimizedPerlin.noise(x/ratio,y/ratio, ozdepth);
//ratio is just a variable that was used so that larger
//images had the same per-pixel noise size
ox = (ox - .5) * 2;  //modify to get values from -1 to 1
oy = OptimizedPerlin.noise(x/ratio,y/ratio, ozdepth * 2);
oy = (oy - .5) * 2;

x += c*ox; //multiply by a constant
y += c*oy;
var nb = nc + ox + oy;
OptimizedPerlin.octaves = 4;
fin = OptimizedPerlin.noise(x/ratio, y/ratio, z);  //get final grayscale value

Anyway, you can tweak your perlin/simplex noise usage in a way that fits what you’re trying to do. I was just pointing out that nothing stops you from using perlin noise as inputs to perlin noise.

 
Flag Post

Topic: Game Programming / Procedural Generation

Originally posted by PanisRahl:

Im not sure what you mean by plug it into a new value. Like into a new bitmap?

Basically I took the XY value of the point I was at, generated two perlin noise values (my perlin noise is 3D, so I could easily pick two semi-fixed z values so that the two results are different) and modify my XY pair, then plug that into the perlin noise again (at a third z-value) to get the resulting final value.

 
Flag Post

Topic: Game Programming / Procedural Generation

Just as a hint on something that can make really neat looking things:

Take the output of your noise function and plug it back in for a new final value.

I do it for the nebula clouds here


(Full size )

 
Flag Post

Topic: Game Programming / What is wrong?

At what point have you been testing things? Is it something in the most recent step you did that failed (because everything else was working) or is this the first time you’ve tested?

 
Flag Post

Topic: Game Programming / Get user profile through API

You can totally scrape a webpage for things. I did it to win a trivia contest (I was scraping the moderator’s profile page for their last active-on-forum timestamp and which page they were on).

You just have to have a good grasp of regex.

http://regexpal.com/ will help, although Flash doesn’t support a number of handy features (for instance, you can’t regex a single result past a newline, ever, and beginning-of-line and end-of-line don’t seem to work) but it’ll get you pretty close.

 
Flag Post

Topic: Game Programming / I do it for the comments

AFAIK, you can’t. :\

 
Flag Post

Topic: Game Programming / Can I charge for my game?

Also, make it $4.99 worth of Kreds as Kong takes a small percentage. It probably wouldn’t be fair to the user to find your game slightly more expensive than on Facebook just because of the Kred markup.

I’m just not sure where that percentage ends up getting put.

 
Flag Post

Topic: Game Programming / Trouble uploading an HTML5 game - Black Screen

You might have to contact kongregate directly.

 
Flag Post

Topic: Game Programming / Trouble uploading an HTML5 game - Black Screen

Are you trying to load files from a server that is NOT kongregate? If so, do you have a cross-domain policy file on the other server which allows kongregate.com to access files?

 
Flag Post

Topic: Game Programming / Trouble uploading an HTML5 game - Black Screen

Have you tried:

Console logging
Alert trace debugging
Sacrificing a goat to the RNG

 
Flag Post

Topic: Game Programming / Can I charge for my game?

In theory.

In practice: I don’t think anyone will actually pay it, regardless of what system you use to do the transaction (though if you’d like to use the Kreds system, you can submit a ticket and discuss that with the admins).

They might, I don’t know. Two hours you say? It’s questionable how many players on Kongregate will even get that far. It would also depend on the quality and engagement factors.

 
Flag Post

Topic: Game Programming / Deeper Topic (part 2): Composition over inheritance

That’s two different kinds of position. Not an entity that lacks position entirely.

 
Flag Post

Topic: Game Programming / Deeper Topic (part 2): Composition over inheritance

Ash stores components in a Dictionary – the component class is the key, and the component is the value.

Good thing I’ve already looked up how to extract dictionary items without knowing their key (e.g. to iterate through all of them). It was a right pain, I tell you.

Anyway, thanks. I’ll keep those answers in mind!

 
Flag Post

Topic: Game Programming / Deeper Topic (part 2): Composition over inheritance

Thread, arise! I have a question that should really be answered here, rather than as another post elsewhere! For I am sure I am not the only person who will find this thread and want to know.

This comes from me knowing that I have been improperly implementing the Entity half of the Entity/Component pattern. For the most part it’s been not terribly important, but at least one project I’ve doodled a few notes one will absolutely have to approach this correctly, I will not be able to half-ass it by saying “oh, there will only be one component of this type, I can just hold a single value for it, and it’ll either be null or not-null.”

You have this:

var entity = new Entity();
entity.attachComponent( new PositionComponent(200,200) );

But you never address how this is handled. What does the Entity class look like, how does it store its components and so on?

(As a side note, what kind of entity would not have a position component?)

Ace_Blue has one posted, but has several comments indicating he is unsure of a particular detail, such as the “data” half of an event or the “priority” part of the event listener.

Similarly I am not sure about Ace_Blue’s attachComponent and getComponent. His attachComponent doesn’t make any detection about “we already have that component” but the getComponent function doesn’t give a damn if there’s more than one. Suddenly it’s possible to attach, for example, two display components, but only ever able to get a direct reference to one of them, the other is unreachable except through events!

Semi-related, how would this be approached from a Unity standpoint where there’s already an Entity/Component pattern in existence, do we eschew the Entity half of our equation and use Unity’s GameObject as our entity, relegating all of our components to extending Unity’s components (so they attach directly to the GameObject) or do we create a base MonoBehaviour script as our entity and our own component system?

 
Flag Post

Topic: Game Programming / Unity C# API Tutorials?

KongregateAPI.Submit() ?

 
Flag Post

Topic: Game Programming / [Unity C# - Sight Cones] - Uzzbuzz's Questions

I had it draw a ray to the player’s location during the times when the player was inside the field of view.

You could also try adding a light (turning it off) and setting that spotlight’s cone to the radius you use in the code, that would probably be a good approximation.

 
Flag Post

Topic: Game Programming / [Unity C# - Sight Cones] - Uzzbuzz's Questions

Ew. You don’t need trig for this.

//distance check, avoiding the square root
if((transform.position - player.transform.position).sqrMagnitude < 81) {
	//cone of vision check, 40 degrees wide (from center, total 80 degree cone)
	if(Mathf.Abs(CalcAngle(player.transform.position - transform.position)) < 40) {
		//...
	}
}

Now the meat of this involves the CalcAngle function:

private float CalcAngle(Vector3 newDirection) {
	// the vector that we want to measure an angle from
	Vector3 referenceForward = transform.forward;/* some vector that is not Vector3.up */
	 
	// the vector perpendicular to referenceForward (90 degrees clockwise)
	// (used to determine if angle is positive or negative)
	Vector3 referenceRight = transform.right;
	 
	// Get the angle in degrees between 0 and 180
	float angle = Vector3.Angle(newDirection, referenceForward);
	 
	// Determine if the degree value should be negative. Here, a positive value
	// from the dot product means that our vector is on the right of the reference vector
	// whereas a negative value means we're on the left.
	float sign = Mathf.Sign(Vector3.Dot(newDirection, referenceRight));
	 
	return sign * angle;
}

This technically doesn’t account for the angle up and down, but you can calculate that in the same way, setting referenceRight to transform.up and calculating again.

 
Flag Post

Topic: Game Programming / My First Game in Unity-looking for feedback :)

Originally posted by fallen56:

Well I don’t want to spend any money for creating my games as thn I would feellike I’m buying my way through the course I’ studying.. I will try fixing the torches, Thanks for playing ^ I could correct the torches at the university I’m studying…they have Unity Pro ^

Feel free to bang your head against GUIs without 3rd party plugins. It’s a right pain in the ass.

As much as I think people should be doing things themselves so they understand the underlying process, Unity’s GUI system is just so awful that it’s really not advisable.

The GUI system I ended up buying no longer compiles for the iPad though (their forums indicate that you just have to move a file from A to B, except that I tried that and still no dice) so I’ve been forced back to using pngs on planes with an orthographic camera (still better than OnGUI). If I do buy another one, it’ll be EZ GUI or nGUI

(Per torches and bloom: you’d have to compile at Uni as well, changing the settings and taking it home won’t work, the settings will be ignored)

 
Flag Post

Topic: Game Design / feedback for my old arcade twist

Is a lack of randomization also the twist? Seems like every time I start a new game the first powerup is blue and shrinks the paddle and the second one is a spare ball.

 
Flag Post

Topic: Game Programming / Is our game too hard?

Gaps that open up in the middle (that is, if the layout looks like…

-----
#####

#####
-----

Where the – is the “floor/ceiling” and # are the walls, I have no idea how you’re supposed to get through. Spin just…spins in place and jumping to the other wall (that is, flipping the level upside down relative to the camera) happens so fast that it’s not viable to use it to catch the gap while you’re in the air.

For 1-wide gaps…

-----
#####
#####
### #
-----

They’re almost impossible to hit dead on. Every time I aimed through one I would clip the wall on one side or the other, and with the propensity of those barriers being multi-blocks thick you take damage for EACH and EVERY one.

 
Flag Post

Topic: Game Programming / Is our game too hard?

Your instructions make no god damn sense. “Space to break blues” I tried doing a spin at a block that had a blue edge, I took damage.

Instructions went away on their own before I had a chance to read them and could only get them back by refreshing the page. This is terrible design.

I could not move from one side of the path to the other fast enough. Add to that the fact that I saw a wall that HAD NO OPENING in it (I’d died on the previous wall, so I am not entirely sure).

Basically:

I have no idea what the fuck is going on, so yes. Your game is too hard.

 
Flag Post

Topic: Game Programming / Is self-promotion of games acceptable in this forum?

Originally posted by EndlessSporadic:
Originally posted by Draco18s:

Hell. I’ve posted a handful of things to this forum that have naught to do with programming (for example: Facebook buying the Oculus Rift or Game Maker Pro on sale) because the people who would care are in this forum.

While I would normally argue that this kind of thing would go into the design forum, it does actually have an impact on programmers who are planning to support the device.

Bingo

 
Flag Post

Topic: Game Programming / As3: Adding all movieclips on stage to an array

for(i = 0; i < parent.numChildren; i++) {
parent.getChildAt(i);
}

 
Flag Post

Topic: Game Programming / Is self-promotion of games acceptable in this forum?

Hell. I’ve posted a handful of things to this forum that have naught to do with programming (for example: Facebook buying the Oculus Rift or Game Maker Pro on sale) because the people who would care are in this forum.

 
Flag Post

Topic: Game Programming / My First Game in Unity-looking for feedback :)

Originally posted by EndlessSporadic:

Do not do this. Wait until Unity 4.6. They are overhauling the GUI system.

It still may be worth doing. 4.6 isn’t happening until later this year and there are probably still going to be things it doesn’t do well.

I know that EZGUI has tools to build GUI objects into the world for things like keypads and computer consoles. It is on the high end, though.