Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 186 187 [188] 189 190 ... 796

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

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2805 on: August 20, 2012, 09:03:20 pm »

Thanks, Mego, to_string worked perfectly :3 Much better than having to write my own function that carefully dissected ints into vector output.

Welcome!

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2806 on: August 21, 2012, 12:43:19 am »

Ha! Maybe a weekend of writing unit tests wasn't so bad after all.

After an intense 4 hour refactor/ feature add session, I broke 2 of my 32 unit tests, but was able to identify the single source of the error within minutes.

Now I just have to get my code coverage up another 15% to cover the new code.

Then I can refactor the tokenizer. And write more unit tests.

Then I can refactor the parser. And write more unit tests.

Then I can get bored and forget that I was originally trying to write a building generator.

And I can forget that that generator might have been the first step in providing procedural content for an as of yet undetermined video game.

Then I can get depressed and do nothing but work and watch netflix.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2807 on: August 21, 2012, 04:17:23 am »

I was going to try and learn to use tinyXML, but then I was like "nah, I don't need this right now anyways, so I'll learn it when I need it."

A bit of searching around, and I have a question. What's the difference between Boost's Random header, and good ol' rand()?

Also, what might be a good way to do weighted drawing thingies? Such as having a higher chance of drawing a certain number than other numbers?
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

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2808 on: August 21, 2012, 07:00:20 am »

Random allows for more sophisticated or appropriate algorithms to be used, rand isn't random enough for a lot of uses. It's typically just a simple LCG implementation whilst random allows for say Mersenne's twister to be used. :-)

Also it allows for multiple sets of random number generators to be used, which helps with keeping code modular and testable, the next random number from a specific seed can be predicted for your physics system without having to worry about the audio system mucking up the order by getting a random number.
« Last Edit: August 21, 2012, 07:04:44 am by MorleyDev »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2809 on: August 21, 2012, 07:20:40 am »

Hmmmm, is it hard to install? I've heard Boost's libraries tend to have tons of complicated dependencies. Also, last time I tried to use a library I ended up messing it up and doing nothing with it at all.

As an aside, is XML good for storing data? Also, is TinyXML 2 a good header file for it? O_o
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

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2810 on: August 21, 2012, 07:51:16 am »

XML is "good" in that it is standard and has a lot of existing tools built for/around it. It is also clunky and bloated.

XML is good if you need structured trees of data and expect to share them with other developers/programs, particularly public API's accessible over the internet. It is either bad, or not very good at everything else.

My annoyances with XML is about half the reason I decided to play around developing a lightweight alternative MNML. Note: not advocating mnml over xml at the moment, mnml is still a ways away from being useful to anyone other than myself.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2811 on: August 21, 2012, 10:46:03 am »

Hmmmm, is it hard to install? I've heard Boost's libraries tend to have tons of complicated dependencies. Also, last time I tried to use a library I ended up messing it up and doing nothing with it at all.

As an aside, is XML good for storing data? Also, is TinyXML 2 a good header file for it? O_o

Boost isn't terribly difficult to install under Linux or Cygwin. Also, if you want to use the extra-special random stuff, install gcc 4.3.4. Boost::Random is in the standard library in C++11.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2812 on: August 21, 2012, 12:58:30 pm »

Boost isn't terribly difficult to install under Linux or Cygwin. Also, if you want to use the extra-special random stuff, install gcc 4.3.4. Boost::Random is in the standard library in C++11.

..probably want to use a newer one than that xD Get the fun stuff like variadic templates and nullptr to play with then >:-D What's it at now, GCC 4.7? I personally use http://nuwen.net/ for GCC for Windows since it's typically quite up-to-date. Plus it also comes with the latest (or near-latest) versions of Boost and what-not pre-installed :)

I did make some further modifications, copied libboost_thread.a and renamed it to libpthread.a and rewrote the standard thread-related headers to pull in boost threads and mutexes into the std namespace (adding some extra functionality boost threads was(is?) missing like interoperability with std::chrono) xD That way I can pretend I'm using the new C++11 threading library in Windows :D And more importantly don't need to change any settings in Eclipse's project to recompile on Linux :P
« Last Edit: August 21, 2012, 01:06:49 pm by MorleyDev »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2813 on: August 21, 2012, 01:17:32 pm »

4.3.4 has variadic templates and nullptr. I can't get anything newer than that to work in Cygwin properly.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2814 on: August 21, 2012, 09:19:05 pm »

Erm, as far as I know nullptr wasn't supported until 4.6 of GCC (to the point that I specifically remember writing my own implementation for cross-compiling between VS2010 and GCC 4.5) :S Visual Studio 2010 supported it surprisingly long before GCC did. And 4.3.4 only supports the wip version of the specification for variadic templates, full support is in 4.4.
« Last Edit: August 21, 2012, 09:31:11 pm by MorleyDev »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2815 on: August 21, 2012, 11:11:58 pm »

Erm, as far as I know nullptr wasn't supported until 4.6 of GCC (to the point that I specifically remember writing my own implementation for cross-compiling between VS2010 and GCC 4.5) :S Visual Studio 2010 supported it surprisingly long before GCC did. And 4.3.4 only supports the wip version of the specification for variadic templates, full support is in 4.4.

My bad. I'm gonna bitch at some people for not making a GCC 4.7 package for Cygwin yet.

EDIT: Turns out I actually have 4.5.3. Still not 4.7.
« Last Edit: August 21, 2012, 11:20:00 pm by Mego »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2816 on: August 22, 2012, 03:00:00 am »

So... are you saying boost.random is easy to use in Visual C++ 2010? >.>
Also, what in the world is a nullptr >.>
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

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2817 on: August 22, 2012, 08:01:09 am »

It's a null pointer...or do you what the whole explanation?

Edit:
Spoiler: Full Explanation (click to show/hide)
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2818 on: August 22, 2012, 12:45:43 pm »

So... are you saying boost.random is easy to use in Visual C++ 2010? >.>
Also, what in the world is a nullptr >.>

Nothing is easy to use in VC++. That's a flaw with the IDE, not the library.

A nullptr is like the NULL macro of standards past, only it can't be treated as an integral type. Along with some other fancy stuff that I don't care to look up right now.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2819 on: August 23, 2012, 08:37:09 am »

Turns out that in SQL that ROW_NUMBER() degrades majorly in performance after you get past 250000 rows. This makes implementing a paging system for just one user's data something of a bitch with large data sets...

Update: Got it to run a query on a massive data-set getting the tail end of over 700000 (so say getting the items at the row positions between 700100 and 700200) and items in about 20 seconds. Some more optimisations could be made (we have to get the total count for the user anyway, so could possibly inverse the ordering so it only needs to search about half the data (Well "half + c / 2" where c is the number of items being retrieved, in the worst case) but even then, damn huge SQL databases can be bitches to work with.
« Last Edit: August 23, 2012, 01:13:12 pm by MorleyDev »
Logged
Pages: 1 ... 186 187 [188] 189 190 ... 796