Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 559 560 [561] 562 563 ... 796

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

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8400 on: November 03, 2015, 11:17:13 pm »

Yeah I see what you're getting at, I had to do some research about it since I haven't played undertale and wasn't 100% up with how that puzzle works.

What i'm thinking now, is that you'd start off with a normal run of Prim's Algorithm. That would be your basic connectivity for the maze in a physical sense.

Then, you'd make one "scent level" per scent, and spread scent patches around starting from your entry point - basically using Prim's algorithm again - and every so often you'd place a transition point to a different scent level. Eventually, since a structure would reach the destination and you'd be guaranteed of generating a winnable maze where you need to switch scents enough times.

With the current algorithm it creates mazes that are trivially easy too often. The first one I generated, i walked straight east and won without needing to change scents at all, and didn't even bump into any walls. So i didn't even realize that there were scents or blocking walls whatsoever.

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8401 on: November 06, 2015, 03:07:25 pm »

Via general abuse and misuse of Mecanim and a shaky understanding of angles, I have created a Doom-like sprite animation thingy in Unity. It basically works with Vector3.Angle and using transform.InverseTransformPoint to tell if the camera is to the left or right, for a full 360-degree range.

Currently building a WebGL version of the scene because Chrome doesn't even have the option to re-enable NPAPI anymore, as far as I can tell.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8402 on: November 06, 2015, 03:07:54 pm »

Via general abuse and misuse of Mecanim and a shaky understanding of angles, I have created a Doom-like sprite animation thingy in Unity. It basically works with Vector3.Angle and using transform.InverseTransformPoint to tell if the camera is to the left or right, for a full 360-degree range.

Currently building a WebGL version of the scene because Chrome doesn't even have the option to re-enable NPAPI anymore, as far as I can tell.
It doesn't.
Can you do whatever it is with PPAPI?
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 #8403 on: November 06, 2015, 03:12:35 pm »

The build process is Unity's thing, I have no control over it. There's two ways to publish: the old way that uses NPAPI, which is almost discontinued, and the WebGL build process which is still experimental. I haven't even seen or created a WebGL build yet, so I don't know the specifics.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8404 on: November 06, 2015, 03:13:19 pm »

The build process is Unity's thing, I have no control over it. There's two ways to publish: the old way that uses NPAPI, which is almost discontinued, and the WebGL build process which is still experimental. I haven't even seen or created a WebGL build yet, so I don't know the specifics.
Ah.
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 #8405 on: November 06, 2015, 04:18:31 pm »

Well I can't be asked to make the WebGL setup work with Weebly :P download the scene if you want to see it. It's really nothing special, I just thought it might be interesting for people to see. Made with... whatever the latest version of Unity is.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

nogoodnames

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8406 on: November 06, 2015, 07:53:33 pm »

So, I'm going to be developing an app for the Microsoft Band. This is the first time I've attempted something like this.

Anyway, I got the SDK and examples from here: https://developer.microsoftband.com/bandSDK but there's a problem. Whenever I try to open the examples, I get a bunch of errors like:
Code: [Select]
C:\Users\Daniel\Documents\imagine_cup\MS_Band_SDK\Samples\HeartRate\HeartRate.Shared\HeartRate.Shared.shproj : error  : The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.1\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\Microsoft.Windows.UI.Xaml.CSharp.targets

And also this:
Spoiler (click to show/hide)

Anyone know what is causing this? I checked, and the Microsoft.Windows.UI.Xaml.CSharp.targets was where it should be. For reference I'm using Visual Studio 2015 Community on Windows 7. My only guess is that it's incompatible with VS Community for some reason.


Edit: So it turns out that developing for Windows Phone 8 requires Windows 8.1 or higher. Ugh.
A quick google search indicates that there are workarounds, probably of questionable legality.
« Last Edit: November 07, 2015, 11:53:17 pm by nogoodnames »
Logged
Life is, in a word, volcanoes.
                        - Random human lord

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8407 on: November 12, 2015, 09:13:06 pm »

Hey again guys.

I've run into an odd probelm in C++.

I am writing a program that writes into a file instead of a terminal and i'm using Infile/outfile for this. I can show a name/salary/bonus but when I  try to multiplay the bonus and salary it just dosen't work.

My goal is to update this:

Miller Andrew 6582.87 5%

To:

Miller Andrew 6912.01.

I hope i've made myself clear. My code is this so far.

Spoiler (click to show/hide)
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8408 on: November 12, 2015, 09:29:10 pm »

Instead of the number you expect to get back, what do you get?  You just said it doesn't work.  I see that you're adding 0.5 times the original value, not 0.05 times the original value.  So you're adding 50%, not 5%.  Is that what's wrong?

My only other guess is operator precedence.  I don't know for sure what order the language defines << and + should happen in, but it might be applying the add after performing all of the I/O shifts.  If that's the case then you need to change your bad line to something like this:

Code: [Select]
testTWO << "Miller Andrew " << (65789.87*0.5 + 65789.87); //test does not work.

Again changing 0.5 to 0.05 if that was incorrect in your original example.

By the way, you can also just do this:

Code: [Select]
testTWO << "Miller Andrew " << (65789.87*1.5); //test does not work.

Again, change that to 1.05 if should have been 0.05 instead of 0.5.
Logged
Through pain, I find wisdom.

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8409 on: November 13, 2015, 12:34:03 am »

Whats wrong is that it just dosen't show. Also yeah i saw that awhile ago too...

To be exact the new file that is suppose to be the updated one will be created but will be completely empty.
Logged

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8410 on: November 13, 2015, 02:40:24 am »

Only immediate problem I'm seeing is that you don't need these lines:
Code: [Select]
   Testfile.open("Tuna.txt");

  testTWO.open("UpdatedPay.txt");
Since you are already stating which file you are opening in the constructors. Either do this:
Code: [Select]
   ofstream Testfile;
   Testfile.open("Tuna.txt");
or do this
Code: [Select]
ofstream Testfile ("Tuna.txt");But don't do both.

Don't see why that would be causing your problem though, unless for some reason the open command was calling it without any write permissions or something similar (which should at least have the "out" flag set by default for an ofstream).
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8411 on: November 13, 2015, 03:59:08 am »

Whats wrong is that it just dosen't show. Also yeah i saw that awhile ago too...

To be exact the new file that is suppose to be the updated one will be created but will be completely empty.
You didn't flush the buffer.
Code: [Select]
<< endl;
I would think closing the file would do that for you, but maybe not.
« Last Edit: November 13, 2015, 04:00:49 am by Bumber »
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8412 on: November 13, 2015, 11:50:43 am »

Well good news is that I got it to work. (thanks to i2amroy)

Now my new problem though is weirder.

So check this out:

cout << (65789.87*0.05) + 65789.87; //will equal 6907.36. This is also true when I do it on my calculator.

BUT when I do this:

testTWO << "Miller Andrew " << (65789.87*0.05) + 65789.87; //It gives me 69079.4

Which is close but it rounds of the .36 to 4. I've tried putting setprecision(2) just above that line of code but to no avail.

It's a very  :o problem. Any ideas as to what I'm doing wrong? I just can't seem to make the outfile equal to 65789.87 it just continues to do 69079.4. I really need to make it look like a real salary so using normal $ amounts is crucial.
« Last Edit: November 13, 2015, 12:08:17 pm by 3man75 »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8413 on: November 13, 2015, 12:16:09 pm »

that gives me 69079.3645 on a calculator. make sure you're actually putting into the calculator what you wrote instead of what you think you wrote.

(65789.87*0.05) + 65789.87

breadman

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8414 on: November 13, 2015, 04:37:16 pm »

BUT when I do this:

testTWO << "Miller Andrew " << (65789.87*0.05) + 65789.87; //It gives me 69079.4

Which is close but it rounds of the .36 to 4. I've tried putting setprecision(2) just above that line of code but to no avail.

If you want the output to have a particular format, your best bet is to specify that format explicitly, instead of relying on << to do it for you.  In this case, it seems to be using the equivalent of "%g" (six digits) to format your float, where what you want is "%.2f" (2 digits after the decimal point).  Try formatting the number before writing it:

Code: [Select]
testTWO << "Miller Andrew " << sprintf("%.2f", 65789.87*1.05);
Do be aware that the rounding might still surprise you on occasion, due to the binary representation of floating-point numbers.  For example, 1.055 rounds down to 1.05 on my machine, instead of up to 1.06 as you might expect.
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?
Pages: 1 ... 559 560 [561] 562 563 ... 796