Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 377 378 [379] 380 381 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903621 times)

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5670 on: April 08, 2014, 02:42:44 pm »

Here's my code for that particular problem (it works for me):
Code: [Select]
       if (player.getColor() == '#f00') player.setColor('#ff0');
       else if (player.getColor() == '#ff0') player.setColor('#0f0');
       else player.setColor('#f00');
Logged

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5671 on: April 08, 2014, 02:45:16 pm »

Oh, right. That made me realize my stupidity.
I only used normal ifs, so my color would cycle all the way through back to green >.>

E: Wee, completed the game. Managed to get past endoftheline.js, too.
« Last Edit: April 09, 2014, 11:19:43 am by miauw62 »
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5672 on: April 10, 2014, 08:07:30 am »

Some more testing, it seems to be the amount of screen filled, not how close the camera is. I tested this by putting the camera in a position where everything was running smooth and scaled it all up. Which seems to be evidence for some sort of fragment thing.

The problem is called over-draw.  What happens is that you are drawing the same pixels over and over.  When there is no transparency the renderer renders from near to far and can use the depth buffer to cull fragments early, meaning that each fragment is rendered only once.  This wouldn't work with transparency.

One idea that I have had on this subject is to repurpose the depth buffer to an opacity buffer that culls when a certain opacity level has been reached.  This would only work in a system where a total ordering of polygons is possible, so I don't expect any closed-source general-purpose renderer to be flexible enough to allow this.

P.S. Some ways to ensure the existence of a total ordering of polygons are: a BSP tree, an octree, or a voxel grid.

Unity apparently has an overdraw rendering debug thing, and this does appear to be the problem.

At least now I know I can have lots of decals as long as they are not all on the same spot.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

dragnar

  • Bay Watcher
  • [Glub]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5673 on: April 10, 2014, 11:19:12 am »

Ah, the joys of trying to look up something you don't know the name of...

I'm working on a simple(ish) Javascript page for class, and need to set up a pair of, er. Selection boxes? Two side-by-side boxes full of options and a pair of buttons with arrows on them that move the selected option from one side to the other. I can't imagine this is anything too complex or anything, but I have no idea what that sort of interface is even called to look it up.

Also if anyone knows a clean way to load variables from PHP into javascript that would be nice. I've figured out a way to do it, but it's rather inelegant.
Logged
From this thread, I learned that video cameras have a dangerosity of 60 kiloswords per second.  Thanks again, Mad Max.

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5674 on: April 10, 2014, 11:29:55 am »

Ah, the joys of trying to look up something you don't know the name of...

I'm working on a simple(ish) Javascript page for class, and need to set up a pair of, er. Selection boxes? Two side-by-side boxes full of options and a pair of buttons with arrows on them that move the selected option from one side to the other. I can't imagine this is anything too complex or anything, but I have no idea what that sort of interface is even called to look it up.

I don't think there is a widget for that exactly, but you could code one up out of select tags (<select size='10'><option value='1'>Option 1</option></select> ) and javascript.

Also if anyone knows a clean way to load variables from PHP into javascript that would be nice. I've figured out a way to do it, but it's rather inelegant.

Probably using JSON is best.  I'm not that familiar with PHP though, so I'm not exactly sure how to do that.
« Last Edit: April 10, 2014, 11:31:54 am by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Maklak

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5675 on: April 10, 2014, 12:19:18 pm »

> Two side-by-side boxes full of options and a pair of buttons with arrows on them that
> move the selected option from one side to the other.
Combo Box : http://en.wikipedia.org/wiki/Combo_box
Search for "Combo box html" of "Combo box javascript" and you'll find it.
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5676 on: April 10, 2014, 12:41:46 pm »

If you have trouble with Javascript, it's generally not your fault, but Javascript's. Try using == instead of ===.

I know your post was made two days ago, but I finally (re)found this site again. Enjoy.

http://dorey.github.io/JavaScript-Equality-Table/
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5677 on: April 10, 2014, 01:15:18 pm »

The difference is == does type coercion, === doesn't. So a number will never === a string, whilst with == if it can cast the two to a common type it will. So ("12" == 12) but !("12" === 12).

== is both less efficient as a result, and can introduce unintentional behaviour due to the underlying rules used being unintuitive. The rule of thumb is to err on the side of ===, and only use == if you deliberately want type coercion.

Javascript, grr *shakes fist*
« Last Edit: April 10, 2014, 01:17:25 pm by MorleyDev »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5678 on: April 10, 2014, 01:33:41 pm »

JSON + Python is so sexy. That is all.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5679 on: April 10, 2014, 02:09:18 pm »

I just like making fun of the steaming pile of good intentions that is Javascript.
Logged

dragnar

  • Bay Watcher
  • [Glub]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5680 on: April 10, 2014, 02:31:50 pm »

> Two side-by-side boxes full of options and a pair of buttons with arrows on them that
> move the selected option from one side to the other.
Combo Box : http://en.wikipedia.org/wiki/Combo_box
Search for "Combo box html" of "Combo box javascript" and you'll find it.
Aha! Yeah, that's pretty much what I want, thanks.
Logged
From this thread, I learned that video cameras have a dangerosity of 60 kiloswords per second.  Thanks again, Mad Max.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5681 on: April 13, 2014, 09:27:58 pm »

Woaah.

You can do 99**99 in Python and have it not error D:
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5682 on: April 13, 2014, 09:58:38 pm »

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5683 on: April 14, 2014, 01:22:44 am »

I bet the actual calculation was done quicker than the stringifying.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5684 on: April 14, 2014, 10:47:19 pm »

Am I good enough to 1 on 1 tutor someone to learn  the basics of programming? D: I'm casually doing that, but I'm mildly worried that I'm not doing it well enough or that I'm going to ruin it all.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward
Pages: 1 ... 377 378 [379] 380 381 ... 796