Recent posts by Draco18s on Kongregate

Flag Post

Topic: Game Programming / Looking for some Feedback on a Unity Project

Placing in that area is possible, but still narrow. The camera position is not final. I could do grid squares, I’ve got a prefab that can do that, turning is renderer on and off is easy. I do not have an easy way to figure out if a given tile would cause passing to fail though. The navigation system I’m using is not very well documented, best I have is to place the block and check if a path exists, which takes several frames (especially if the block is close to the exit).

Built tower stats isn’t in yet. It’s next on the list of things to do, actually. I wanted to get the resource system in place before I added buttons to view, upgrade, and sell towers.

Creep paths indicators I can add more for, it’s kind of a placeholder at the moment. Would make blocked placement faster, though, as the check could be taken from multiple places.

The reason I mentioned seeds is because the towers are randomly generated: your ice tower is pretty unique ;) DR is damage reduction, "armor"was going to be too long to fit. Every 1 unit reduces damage by 1% (multiplicative), which should be twirled a little as damage values are pretty low. I think it might reduce by a minimum of one though…

Creeps falling off the edge is a common problem. I haven’t done anything to try and prevent it yet, but knockback effects should through things of ledges. They also fall off the end, due to physics :p their scripts turn off and momentum kicks in XD

I’ll look at the fire and ice towers for that seed and see why the prices feel backwards.

 
Flag Post

Topic: Game Programming / Looking for some Feedback on a Unity Project

I’ve slowly been working on a procedurally generated tower defense game: generated towers, generated creeps, generated waves (map construction is too complex, and generally less interesting anyway, due to the limitations). While I’ve made reference to this project and shared a screenshot or two, I have not linked an actual build.

I’d like to get some feedback on the prices of the towers, if any result seems too pricy or too cheap. There’s no actual resource mechanic yet (the code right now checks “if tower.price < 9999”) so you’re free to build whatever you want, I’m just interested in if the costs seem appropriate (not that other feedback isn’t helpful).

http://www.pages.drexel.edu/~mmj29/temp/pgtd/pgtd.html

Be sure to post the seed (upper left corner) if something seems really “off.” There are still a handful of attributes that aren’t visible in the UI, so without the seed I can’t recreate what you saw exactly.

Know bugs:
#Long tower names don’t fit (“single-target beam” towers, primarily). I need to use a different string.
#Creeps face-smash walls on occasion. Still not sure what’s causing it, they are suppose to rotate towards the next navigation waypoint (which is correct) but they just kind of vibrate back and forth ~90 degrees offset.
#Can’t place towers on slopes (I would like to, but a recent change in detecting intersections with walls made that not work, need to find a fix)

 
Flag Post

Topic: Game Programming / Multiple Users Ad Profits

SSN wasn’t ever meant to be a secret number anyway.

It’s about as secret and as secure as your REI Membership Number.

 
Flag Post

Topic: Game Programming / PHP and AS2

Originally posted by NineFiveThree:

If servers burst into flames when somebody saves password in plaintext on them, the world would be a better place.

And probably a lot warmer.

Server hosting would be more expensive, too.
(Sadly, my company still stores passwords in plaintext)

 
Flag Post

Topic: Game Programming / Multiple Users Ad Profits

You could do that, but keep in mind that setting up an LLC is neither cheap, nor easy. I’m actually in the process of doing that for unrelated-to-kongregate reasons.

 
Flag Post

Topic: Game Programming / Multiple Users Ad Profits

Not really, no.

 
Flag Post

Topic: Game Programming / {AS2} Help Please !!!!

Buttons can’t be manipulated like that. Their frame number is entirely dictated by whether or not your mouse is over them. If you want to control it like that, you need to use a movieclip with a button inside it.

 
Flag Post

Topic: Game Programming / [Solved I think] How to _copy_ semi-transparent pixels?

Maybe I was mistaken. It’s been a while since I worked with bitmaps in AS3 and I remembered that Copy Pixels was faster, but had some limitations, compared to Draw.

 
Flag Post

Topic: Game Programming / [Solved I think] How to _copy_ semi-transparent pixels?

Originally posted by Aesica:
Originally posted by Draco18s:

Copy Pixels can’t do transparency. You have to use Draw()

I hope I’m just misinterpreting something here, because copyPixels most certainly will copy partially-transparent BMDs. I suspect what’s going on is what Amibtious said, and the only workaround I can think of involves either drawing the circle with more opacity or using lines thicker than 1 pixel.

It will copy, but it won’t blend. It’ll overwrite the destination color value rather than multiplying.

 
Flag Post

Topic: Game Programming / GiTD #42 - *Pirates*

God, you have no idea how much I want someone to remix those lyrics with the theme from Pirates of the Caribbean.

 
Flag Post

Topic: Game Programming / [Solved I think] How to _copy_ semi-transparent pixels?

Copy Pixels can’t do transparency. You have to use Draw()

 
Flag Post

Topic: Game Programming / Can i upload javascript or java games in kongragate

http://developers.kongregate.com/docs/resources/faq#format

There is support for iframe games, but I am not sure if you need to contact staff about those or not, and either way, you’d have to host it on your own server.

 
Flag Post

Topic: Game Programming / {AS2} New Game !

1) Use AS3, there’s really no reason not to.
2) If you’re having trouble showing a movieclip on button-press you’re going to only encounter more problems.
3) Here:

on(release) {
   theThing.visible = true;
}
 
Flag Post

Topic: Game Programming / GiTD #42 - *Pirates*

Transmogrification would be interesting. And not easy.

 
Flag Post

Topic: Game Programming / [Urgent]Problems with additional files.

http://lmgtfy.com/?q=unity+how+to+use+cross+domain+policy&l=1

 
Flag Post

Topic: Game Programming / [Urgent]Problems with additional files.

https://www.google.com/search?q=cross%20domain%20security

Also, private messages do not get your problem solved faster.

 
Flag Post

Topic: Game Programming / [Urgent]Problems with additional files.

That’s not additional files. Additional files aren’t executable code, they’re data.

PHP requires a server to be hosted on (that’s not Kongregate) and to “access” them you need to make an external call.

 
Flag Post

Topic: Game Programming / Need Help

var money = 0;
addEventListener(Event.ENTER_FRAME, doTheThing);
function doTheThing(e:Event) {
   money++;
}

I’ll take my cut in cash, thanks.

 
Flag Post

Topic: Game Programming / [Advice] Unity Optimization

Originally posted by Zerakil:

Thanks for the info, I know static batching is best practice, but must admit that I have not had any real need for optimization when it comes to Occlusion, But guess it get more importan if working on large 3d levels for FPS or true 3d Games.

Basically anything with a ton of small and complex models will benefit.

 
Flag Post

Topic: Game Programming / [Advice] Unity Optimization

Originally posted by Zerakil:

As for Occlusion I’m not sure if I read it wrong, I missed something, to Occlusion work rather well in Unity Pro. And if I remember correct its not even possible in the free version.

It is. Sorry, I’ve got access to Pro so I’ve got Fancy Features.1 Occlusion is really only about a 30% gain, whereas static batching will get you closer to 90% (if both are set up properly and you follow the “as few shaders” rule).

1 Like intersection shaders using the depth buffer (that’s actually a custom shader that is both an intersection shader and a rim shader, on Free only the rim works). I may actually buy Unity 5 for personal use, depending on a couple of factors.

 
Flag Post

Topic: Game Programming / as3 what is the most efficient way to use enterframes

Nope, because you have 1 event listener rather than thousands. Sending an event has a small amount of overhead that a basic loop doesn’t have.

 
Flag Post

Topic: Game Programming / [Advice] Unity Optimization

GameObject.Destroy() isn’t that intensive. It’s the garbage collection that comes along a few frames later that will om nom CPU cycles. In the first TD I did in Unity I batched the creep destruction by turning off their scripts and throwing them under the map until the end of the level, then calling Destroy() on all of them. The lag spike for the one frame was largely unnoticed.

I don’t recall what I did with bullets.

 
Flag Post

Topic: Game Programming / [Advice] Unity Optimization

Optimization is one of those things that I’ve learned little bits and pieces of over time as it’s been needed. As there isn’t a good list of the different kinds of topics that help to make a Unity game run well on mobile devices I thought I’d start a thread with various factors. These will not be in-depth instructions on how to utilize each technique, but rather an overview of what the technique is, what it’s called, etc.

Feel free to add to this list.

  • Draw Counts
  • This is the primary cause of lag in a unity game. There are a number of contributors (below) but this number (which can be found by looking at the game view and clicking the “stats” button in the upper right) is the easiest go-to number to look at to see if a change positively or negatively impacted performance.
  • Shaders
  • Complex shaders are slow. That color doodad that lets you tweak how a texture looks requires an extra multiplication step during rendering. Additional textures require a second lookup and second multiplication. Bumpmaps take even more (texture point lookup, lighting inputs, multiplication…). While these won’t inherently cause more draw calls, they are slower than simpler shaders. If you can get away with it, use the shaders under Mobile. If you absolutely need X feature, use the default shaders. Avoid reflections!
  • Lighting
  • Bake your lightmaps! For the love of god, bake your lightmaps. You do not need every single light to be real-time rendered with high quality shadows. Every light you have causes an additional draw pass. A draw pass is essentially “take your draw counts, add that many again.” A scene with 50 draw counts, just for meshes, with 5 real-time lights will require 1600 draw counts! (This is approximate, if a point light doesn’t overlap with a given mesh, then that mesh is not included in the increased count, but even a couple of small point lights can double your draw counts).
  • Vertex Lighting. If you can get away with it, vertex lighting requires fewer lighting calculations and will result in lower draw counts. At the per-shader level, the savings will be small, if you can get away with it, set the camera to use Vertex Lighting instead of forward or deferred. You’ll lose some detail, like bump mapping, but it will cut your draw counts by 60% easily.
  • For dynamic objects, you will want to set up light probes so that as objects move through the scene they can approximate their lighting more accurately from the baked lightmaps.
  • Textures
  • Use a texture atlas / sprite sheet. If you have two shaders that are identical except for the texture used, find a way to combine those textures and use a single shader. Every mesh with a unique shader causes an additional draw count.
  • MaterialPropertyBlock. This is a better way to make run-time alterations to a shader than editing the renderer’s material. A MaterialPropertyBlock doesn’t create a new material, rather it alters the parameters just before the material goes to the renderer. Thus it can be used with Combine Children or other batching (although there are some limitations).
  • Meshes
  • Combine your meshes whenever possible. Unity can render one 100,000 vertex mesh faster than it can render four 25,000 vertex meshes, even if they have the same texture. The best way to do this is to set the mesh as static (upper right corner of the Inspector panel). There’s a dropdown that will let you specify what kind of static it is, including occlusion, navigation, and lightmapping.
  • The Combine Children utility will also work, but static batching is pretty fast already and does basically the same thing (static objects can’t be combined with CombineChildren either).
  • Occlusion
  • While Unity will automatically cull objects outside the view fructum, it will still render everything in front of it, even if its completely hidden by another object.
  • Not-rendering things that can’t be seen is good. Make all of your small meshes as “occludees” and your large ones as “occulders” (mid-size ones should be both, if they occlude a large portion of things). Don’t forget to set up occlusion volumes for places the camera can go. This is similar to Valve and the Source Engine’s Visleaf system, although done by hand.
  • Animators
  • Remove any unused animator components from your imported mesh objects. They prevent the object from being statically batched as they are rendered as if they were a dynamic moving object, even if they’re not doing anything.
  • Other
  • If you can get away with not-drawing something at certain points of the game—such as a GUI indicator that can’t readily be acted upon for a length of time—turn it off. For instance, I had a bunch of meter-bars in a Tower Defense game that pointed out certain bonuses when a tower was built there. As the player was less likely to be building towers when a wave was in progress (and with the increased draw counts that enemies caused) it was a big performance increase to turn those bars off and save on their draw counts.
  • For mobile games the ideal draw count is as close to 0 as you can manage. I’m currently getting away with ~150 for a project on an iPad 2, but under 300 should “work” although “under 30” should be your target. At 800 the lag is noticeable. At 8000 its downright unacceptable (this project started at 8800!). For desktop applications you get get away with more, my machine was capable of handling the 8800 draw counts and still maintaining 30 FPS (at 150 it gets 200-250 FPS).
 
Flag Post

Topic: Game Programming / Feedback to my new game (critics are very welcome)

Everything a3lex33 said.

There also appear to be some spikes just below where you start on the first level that serve no purpose. They’re in a corner where they can be utterly non-threatening.

 
Flag Post

Topic: Game Programming / GiTD #41 - *Congratulations Aesica*

No, its not. I haven’t had the time to do a lot of things. I meant to get around to looking at the entries and then…got busy and never got to it.