Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 84 85 [86] 87 88 ... 796

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

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1275 on: February 04, 2012, 08:02:16 pm »

I picked a language and assumed it was taught at a college somewhere, so I don't really know if it's offered, but I do know colleges offer story telling class, (my brother took it)
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1276 on: February 04, 2012, 09:28:49 pm »

The best analogy for the problems which arise in multithreading are the situations I've seen in OpenTransportTycoon. There's a reason multithreading functionality like mutexes and semaphores are named after railroad components. Race conditions resulting in collisions can be seen in quite literal terms, as can deadlocks, ect, resulting from semaphore problems and such.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1277 on: February 04, 2012, 11:12:44 pm »

Spoiler (click to show/hide)

The problem is, most compilers don't have support for C++11 threads yet. So, for portable code at the moment, you have to do a clusterfuck like this:


Even that isn't 100% portable, but it's closer.

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1278 on: February 04, 2012, 11:40:20 pm »

I know :(
as I said before the compiler I use can't compile c++ yet either.
hopefully sometime this year most of the compilers will be up to date.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #1279 on: February 05, 2012, 01:46:13 am »

Actually a good way around the C++11 support for threads I've found is to, if it's not supported, bring boost's threading classes into the std namespace.

I've got a whole set of headers I've been working on that exist solely around faking C++11 features that are missing in.
« Last Edit: February 05, 2012, 01:50:35 am by MorleyDev »
Logged

malloc

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1280 on: February 05, 2012, 04:50:16 am »

^ Threading gets hard when treading tasks that are not meant to be parallel, which is in fact, most of the stuff you will ever program.
What can be easily threaded are functions that are doing same task, perhaps with different parameters, a lot of times. They can share read only memory, but they should not share data that they manipulate, it introduces mutexes where data will be locked when a thread is using it.

If you have a large portion of a program which is more or less independent, for an example this could be a rasteriser or some smart query based pathfinding. If this component is more or less independent from the main program, that means it does not change or control any global states, you could thread it.

Some people often start foolishly threading everything, which is very error prone, and introducing some extremely complex series of mutexes you are essentially bogging your program down to a halt. You can even, by error, deadlock the program, because two threads are waiting for each other to finish.

Having dealt with threading a lot, I can honestly say that it will never be easy to thread applications. Also, few applications will actually get huge benefits from threading. If you are going to use threads, then only use them in places that you know are bottlenecks, and that can actually benefit from threading.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #1281 on: February 05, 2012, 07:50:24 am »

Ah yes, designing for threading is....not fun. Especially making things scale to an unknown number of cores. Few things are embarrassingly parallel...

Building things as "Task-based" helps, and if something is functional it's very easy to run the parts that don't out-right depend on others in parallel.

Things like life-like Simulations are easy to make always use all of the available cores almost all of the time, you just split it into n sections and give each section to a thread. Process all sections, wait for all sections to be finished, repeat. You can keep it in synch with a barrier.

If most of the threads are spending most of their time waiting, then all you really have is a single-threaded program.
« Last Edit: February 05, 2012, 07:53:59 am by MorleyDev »
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1282 on: February 05, 2012, 08:00:44 am »

Let's face it, as with all things in computing, the more powerful, the harder it is.
Although that doesn't mean the harder it is, the more powerful, or brainfuck would be an industry standard language.

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1283 on: February 05, 2012, 11:30:23 am »

Off-topic: When I was 13, I programmed a platformer with Perl/Tk. It was strictly procedural, had no kind of object structure, didn't use references or pointers, and on top of it all, used only global variables (not even function parameters). Input was raw terminal input, so the protagonist's speed depended on the system's keyboard settings (character repeat speed/delay), and every creature was drawn by changing the coordinates of 64 rectangles on Tk's canvas. Even so, it was completely playable, had checkpoints, power-ups, different types of badguys, moving platforms and even a final boss.
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1284 on: February 05, 2012, 04:49:11 pm »

There is something terribly inconsistent about Visual C++ trying to find and open files.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1285 on: February 05, 2012, 05:11:14 pm »

"When I was 13", I made a game in qbasic, that had a 3D (first-person view, like you see in old RPG's) grid where me and my brother could walk around, and dig (splitscreen multiplayer). You were supposed to be an ant and shoot the other one with acid, or something.
In hindsight, I made a fucking Multiplayer-DF-FPS-crossover in qbasic.

So I just looked up the Qbasic site and, looking at the code there, I got this warm, fuzzy feeling.  :D
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 #1286 on: February 05, 2012, 08:12:36 pm »

There is something terribly inconsistent about Visual C++ trying to find and open files.
You are meant to add files that you want to open to the project, and make them copy over on compile if newer.

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1287 on: February 05, 2012, 08:13:59 pm »

I did. 's just that my program manages to open one file, but not another which is located at the same place.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1288 on: February 05, 2012, 08:15:08 pm »

Sounds like some other IOException then. What sort of files?

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1289 on: February 06, 2012, 12:04:23 am »

On the subject of Visual C++...I installed Visual Studio 11 Dev Preview solely because I could.  How the crap do I get VC++ to link libraries correctly?  For the life of me, I could not find the right linker operation...which is stupid considering how easy it is from the command line...  I historically do C++ development from Linux...I can handle a commandline so much better than an IDE, for the most part.
Logged
Pages: 1 ... 84 85 [86] 87 88 ... 796