Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 126 127 [128] 129 130 ... 796

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

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1905 on: March 07, 2012, 11:56:54 pm »

I'm actually just recently getting into C++ with help of a friend of mine (still working on pointers), and I have to say some of this stuff scares me terribly, because I have a hard time with pretty much anything worse then division, and math in general just doesn't mesh with my brain.

Pointers are the number one cause of headaches for C programmer. Don't sweat it if you are having a hard time with them. It took me 2 years for the concept of a pointer to click.

Fwiw, the number one cause of headaches for C++ programmers are C APIs that make liberal use of pointers. <3 references.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1906 on: March 08, 2012, 07:56:17 am »

You sure? I just started on multithreading my enormously slow engine and I can tell you pointers are easy compared to that.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1907 on: March 08, 2012, 07:59:23 am »

Yea, once threads are involved... OH MY GOD WHY CAN'T YOU GUYS JUST GET ALONG?!?!?!?

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1908 on: March 08, 2012, 08:24:36 am »

(Un)Fortunately, I have not had the joy of dealing with synchronizing threads yet. All the threading stuff I've done has been asynchronous, like reading and writing messages to an IRC server from a bot while running a game.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #1909 on: March 08, 2012, 09:43:28 am »

You sure? I just started on multithreading my enormously slow engine and I can tell you pointers are easy compared to that.

Multithreading after the fact is a nightmare with no guarantee that it will produce performance gains. It really is something that people should build into a system from the very beginning.
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.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1910 on: March 08, 2012, 11:31:13 am »

Well, it was written with threading in the back of my head, so it was merely wrapping a function call in a thread, but now it appears Ogre3D isn't always thread-safe (although I'm just threading the resource loading, which should be safe but I'd have to rebuild Ogre3D, which only comes in nonthreadsafe prebuilt SDKs), so I'd either have to keep all resource loading in the main thread and can thread the heavy resource calculations, or rebuild Ogre3D myself even though doing that for minGW in the newer versions is... a proverbial bitch.

Or just skip the entire thing for now and outsource the calculations to the GPU. That's what I want eventually, anyway. Hmmm.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #1911 on: March 08, 2012, 12:16:52 pm »

Splitting whole aspects of a process into threads is old-hash  :) Nowadays it's all about thread pools.
« Last Edit: March 08, 2012, 12:33:21 pm by MorleyDev »
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1912 on: March 08, 2012, 01:56:39 pm »

Grrr.  Python, why must you fight me?

Turns out you can't do an assignment in a condition in python.

Code: [Select]
while(tmp = func()):
  do_stuff(tmp)

So code like that isn't valid.  The more I program in python the more I'm starting to think whoever designed it hated shortcuts.  Or maybe ruby just spoils me too much.

Edit: Arg, this makes it so annoying.  Now my code will be ugly AND harder to debug.

Edit2:  Ha, I got a workaround that isn't terrible. (Although it is silly)

Also, work is fun today.  I'm writing a parser for a BNF grammar.   :P
« Last Edit: March 08, 2012, 02:17:47 pm by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1913 on: March 08, 2012, 02:05:15 pm »

The more I program in python the more I'm starting to think whoever designed it hated shortcuts. 
I believe that is actually the case.
Logged

malloc

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1914 on: March 08, 2012, 03:43:27 pm »

Splitting whole aspects of a process into threads is old-hash  :) Nowadays it's all about thread pools.

QFT.

But I often still just create and run the threads manually. My programs are often modular enough to have most of the running more or less independently of each other.
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1915 on: March 08, 2012, 03:44:18 pm »

The more I program in python the more I'm starting to think whoever designed it hated shortcuts. 
I believe that is actually the case.
Python evolved like this because the Python developer(s) didn't like the Perl approach ("There Is More Than One Way To Do It").
Incidentally, this is why I don't like Python.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1916 on: March 08, 2012, 04:24:02 pm »

"There Is More Than One Way To Do It"

Try asking on a forum how to implement a loop in Common Lisp. You're guaranteed to get 5 completely different answers.
Logged

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1917 on: March 08, 2012, 05:10:32 pm »

And then there's networking. It's like threading, except that information about what the other thread did shows up in a more or less random order and may simply vanish entirely for the lulz.

Pointers are nice unless you forgot what you were doing with them.
Logged

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1918 on: March 08, 2012, 05:46:45 pm »

Pointers aren't scary. Except function pointers. That's where you get all the fun bugs.

Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1919 on: March 08, 2012, 05:50:44 pm »

Pointers aren't scary. Except function pointers. That's where you get all the fun bugs.

Function pointers are hilarious.

And funnily enough I don't know how I'd live without them in other languages now.  Not sure how useful they are in c++ but they are fantastic in scripting languages.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout
Pages: 1 ... 126 127 [128] 129 130 ... 796