Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 655 656 [657] 658 659 ... 796

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

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #9840 on: July 28, 2016, 11:20:06 pm »

This is a long shot, but... anyone know of a small standalone program for displaying microphone levels onscreen? I'm using win7.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9841 on: July 29, 2016, 02:38:38 am »

This is a long shot, but... anyone know of a small standalone program for displaying microphone levels onscreen? I'm using win7.

If you happen to have Skype I believe the microphone test shows decibel levels. There's also probably a mic test buried somewhere in the sound manager.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9842 on: July 29, 2016, 03:49:33 am »

With winamp, you can open the microphone, and show all of its audio visualizations for it.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #9843 on: July 29, 2016, 04:12:42 am »

Unit tests are pretty cool. They give me confidence that I'm not regressing on anything, and also make testing results easier -- just run a program instead of manually checking to see if it's correct!
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

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9844 on: July 29, 2016, 03:37:27 pm »

I don't think Unity likes me anymore

Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #9845 on: August 03, 2016, 07:21:46 am »

Does anyone here know how exactly you prevent clients from caching old versions of a webpage? :(

I've tried a couple things on the internet, such as setting the content expire header, but I don't think it worked...
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

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9846 on: August 03, 2016, 07:27:33 am »

Does anyone here know how exactly you prevent clients from caching old versions of a webpage? :(

I've tried a couple things on the internet, such as setting the content expire header, but I don't think it worked...

you can't retroactively expire pages that are already cached, for the future requests, add these headers

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0


if you really want to trigger a browser reload, append a random ?ts=3123414 at the link starting from the homepage (I use the build timestamp because that way cache works and clears at every release for example)

Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #9847 on: August 03, 2016, 07:29:59 am »

Yeah, I did figure that you can't retroactively expire a page.

I'll try that next time I deploy my small web-app...
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

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9848 on: August 03, 2016, 07:35:16 am »

Yeah, I did figure that you can't retroactively expire a page.

I'll try that next time I deploy my small web-app...


yeah but you can still change links that point to that page with a fake parameter, browser will reload that.
Logged

Spehss _

  • Bay Watcher
  • full of stars
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9849 on: August 03, 2016, 08:36:38 pm »

Playing around with time based integration in C++ after reading those articles (1,2) Reelya linked me to a while back in this thread.

Wrote a basic program using pdcurses for graphics that counts seconds up to a hardcoded goal number. Using ctime.h for the time functions. Noticed that the program would finish in a shorter amount of time than what it would get if it counted seconds perfectly. Example, goal is 10, program finishes in 9.814s using clock_t and clock() based integration, and finishes in 9.133s using time_t and time() based integration.

Am I doing this right? It works.

Tips on improving accuracy? I'd have thought that using time_t would be the more accurate option for integration based on seconds, since time_t is tracking the number of seconds, while clock_t is clock ticks. clock_t program finishes in a closer time to the goal number than time_t though.

Spoiler: code (click to show/hide)



Just realized after posting this that I didn't actually finish reading those articles and they could very well address my questions already. I kinda stopped reading halfway through the first and went and tried programming once I thought I understood enough. Gonna finish reading the articles, if anyone wants to respond feel free to.



...Of course the clock ticks are more accurate because they're a smaller unit of time, so the smaller step of time increases accuracy.



Figured it out. Got the time accuracy down to .048 seconds difference, which I'm willing to attribute to the program finishing and returning 0 at the end.
« Last Edit: August 03, 2016, 09:18:01 pm by Spehss _ »
Logged
Steam ID: Spehss Cat
Turns out you can seriously not notice how deep into this shit you went until you get out.

monkey

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9850 on: August 03, 2016, 09:41:26 pm »

time() counts seconds since 1970, if you start then program in the middle of a second, it will take .5 seconds to increase number, and it will finish .5s earlier too.
You are only counting how many times the seconds hand of a clock moves.

The clock() version seems to work changing goal to:
Code: [Select]
int goal=10* CLOCKS_PER_SEC;
Logged

Spehss _

  • Bay Watcher
  • full of stars
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9851 on: August 03, 2016, 11:01:44 pm »

Yeah, I've figured out that between the two, clock_t and clock() seem the better option.

And instead of setting goal equal to n*CLOCKS_PER_SECOND, I found that setting d_t=d_t/CLOCKS_PER_SECOND and adding that to total_num worked.
Code: [Select]
if(d_t>0) //if time has passed
         {
             //updates data
             total_num+=d_num*d_t/CLOCKS_PER_SECOND;
             //etc
         }
delta time d_t is first in clock tick units, which are smaller than a second, so finding how many seconds have passed when counting in clock ticks requires dividing the quantity of clock ticks by CLOCKS_PER_SECOND to find the quantity of seconds that have passed since the last loop iteration.

Can't believe my experience in college calculus and engineering classes are proving useful for programming. Math is so useful.
Logged
Steam ID: Spehss Cat
Turns out you can seriously not notice how deep into this shit you went until you get out.

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9852 on: August 04, 2016, 01:08:59 am »

Programming IS math, in the end.
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9853 on: August 04, 2016, 01:12:11 am »

I had that moment when I realized that enemies in a lot of NES shooters move in patterns that can be described as an equation over time, like a sine wave or something.

Also I'm sure that statistical analysis is involved in major competitive games that require fine balance.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9854 on: August 04, 2016, 01:46:38 am »

Yeah, online games gather a lot of data. Unless the devs are retards, they can count exactly how much each weapon is being used for example and their kill rates. Plus heat maps - basically log deaths then plot them on a map as heat values. If too many people are dying at a specific spot, then there's probably a flaw in the map's design.
Pages: 1 ... 655 656 [657] 658 659 ... 796