Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

What programming topic would you want the next challenge to be about?  (It might be a good opportunity to focus on a subject you're not familiar with or to reinforce knowledge on one that you already know)

Control Flow
- 2 (2.2%)
Arrays, Strings, Pointers, and References
- 8 (9%)
Functions
- 4 (4.5%)
Basic object-oriented programming
- 30 (33.7%)
A bit more advanced OOP (Composition, Operator overloading, Inheritance, Virtual Functions)
- 18 (20.2%)
Templates
- 8 (9%)
Other (Explain)
- 4 (4.5%)
Working with files?  (Streams)
- 15 (16.9%)

Total Members Voted: 89


Pages: 1 ... 22 23 [24] 25 26 ... 78

Author Topic: Programming Challenges & Resources (#bay12prog) Initiative  (Read 95919 times)

ed boy

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #345 on: August 12, 2010, 06:41:09 pm »

Have it output the time before it starts, and have it output the time at the end.
Logged

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #346 on: August 12, 2010, 07:16:42 pm »

What's the best and/or easiest way of figuring out how long a particular section of code spends running in C++ (for optimization purposes)?
I'm using MSVC++ 2008 EE if that helps.
The best way, if you're working in Visual Studio, is to get a full copy of Visual Studio and run it through the profiler--no joke, the VS profiler is the best in the business. Profile-guided optimization is awesome. (GCC can do PGO too, but its profiling tools are a little squishy and more difficult to use, except from within XCode on a Mac.)

The next-best way is to use timing code and measure it in your program, but that's going to involve modifying your code directory. Building a stopwatch class or something is probably the most easily-extricable way.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #347 on: August 12, 2010, 07:52:31 pm »

What's the best and/or easiest way of figuring out how long a particular section of code spends running in C++ (for optimization purposes)?
I'm using MSVC++ 2008 EE if that helps.
The best way, if you're working in Visual Studio, is to get a full copy of Visual Studio and run it through the profiler--no joke, the VS profiler is the best in the business. Profile-guided optimization is awesome. (GCC can do PGO too, but its profiling tools are a little squishy and more difficult to use, except from within XCode on a Mac.)

The next-best way is to use timing code and measure it in your program, but that's going to involve modifying your code directory. Building a stopwatch class or something is probably the most easily-extricable way.
Figured as much. Since my university classes don't start until later this month, no free VS'08 for me yet. My code currently uses QueryPerformanceFrequency and QueryPerformanceCounter for FPS, so I'll probably just use that for optimizing as well.
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #348 on: August 12, 2010, 08:24:10 pm »

xcode does c++?
Logged

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #349 on: August 12, 2010, 09:42:40 pm »

Sure. It's a frontend for the GNU compiler collection--it would be stranger if it didn't support C++.

It also doesn't come even remotely close to NetBeans or Visual Studio, but you can't have everything.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

DrPizza

  • Bay Watcher
    • View Profile
    • Ars Technica
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #350 on: August 13, 2010, 12:27:29 pm »

What's the best and/or easiest way of figuring out how long a particular section of code spends running in C++ (for optimization purposes)?
I'm using MSVC++ 2008 EE if that helps.
The best way, if you're working in Visual Studio, is to get a full copy of Visual Studio and run it through the profiler--no joke, the VS profiler is the best in the business. Profile-guided optimization is awesome. (GCC can do PGO too, but its profiling tools are a little squishy and more difficult to use, except from within XCode on a Mac.)
The PGO may work well, but VS's profiler is shit compared to the tools available on Mac OS X (for free).
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #351 on: August 26, 2010, 03:48:41 am »

So... I've got a challenge :)

I've got a world, made out of cubes. And it looks like crap minecraft. So what I want is to "smooth" it over, at least until you start digging.

Now, interpolating vertices according to the neighbour-blocks is easy, but only works in 2d. As I've got overhangs and caves, that's not going to work. The sides and bottom faces of a cube need "smoothing" as well, and preferably smoother (taking more than just nearest neighbour) than just "ramps" like DF uses (45-degree connections between cubes).

So what I need is a three-dimensional function that can trace smooth lines over discrete points, needs only a few of those points to do so, and is fast. I've come up with tons of ideas that were all bad.

Any ideas?
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))

Outcast Orange

  • Bay Watcher
  • [SOMETIMES_SQUID]
    • View Profile
    • The Outcast Orange
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #352 on: August 26, 2010, 10:29:10 am »

Sounds sexy.
Logged
[7:53:55 PM] Armok, why did you demand that I don't eat you?
[7:54:34 PM] [Armok]: woooooo

Burried Houses - Platform Explorer Demo H - Cloud Scream

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #353 on: August 26, 2010, 10:34:46 am »

marching cubes

look it up
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #354 on: August 26, 2010, 11:05:26 am »

Awesome, thanks Japa! I'll look into it tonight.

Yes Outcast, I'm doing a Cloudscream ;) Although at only a few lines of code per day, it's coming along pretty slowly. Wait until 2040.

I've got procedural textures and procedural terrain, though. Yeah.
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))

Outcast Orange

  • Bay Watcher
  • [SOMETIMES_SQUID]
    • View Profile
    • The Outcast Orange
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #355 on: August 31, 2010, 01:07:31 am »

Very cool.

I'm more interested in your GUI though. Will there be mouse controls? How will the camera work?
Logged
[7:53:55 PM] Armok, why did you demand that I don't eat you?
[7:54:34 PM] [Armok]: woooooo

Burried Houses - Platform Explorer Demo H - Cloud Scream

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #356 on: August 31, 2010, 05:54:55 pm »

I'm very interested in how that's going to work, as well...  ;)

As with most projects, the boring stuff comes last (read: never). Frankly, I've got no idea how I'm going to do the GUI, but probably use a library from somewhere because it's just a plain bore to design (as in: I started on a technical design, then got bored). You have to make things poppable draggable clickable typeable etc and every event needs to percolate down through layers or not depending on event handlers etc. Making a functional design is already boring (as in, I do that stuff enough at work), making it technically work is just re-inventing the wheel.
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))

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #357 on: September 02, 2010, 01:43:10 pm »

Minor necro, but I have a question on bitshifts. I hope you don't mind.

I'm starting to see a pattern in them. Bitshifting x by y bits is equal to x*2y, and a bitshift right is x/2y, right? Or am I completely off my rockers?

Sorry if I'm being ignorant here, as I'm rather new to this stuff.
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #358 on: September 02, 2010, 01:51:26 pm »

I think so, though I'd be the last person one would look to for programming help. iirc it says something like that in the K&R book.
Logged
Pages: 1 ... 22 23 [24] 25 26 ... 78