• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
tom_mai78101

Can we do multithreading without relying on Win32 programming?

10 posts in this topic

If I were given a choice between Java and C++ to do multiprogramming, I would always choose Java, for its simplicity in multithreading. I would not choose C++ to do multithreading, because of Win32. But, if I'm forced to use one of the languages, then I will not complain.

A little while ago, I read something about C++1x, a standard of C++. I know all of this new standard and whatnots. Then I see that there will be a <thread.h> standard template library header in the C++0x (somehow jumped to C++1x for being too slow).

If <thread.h> are to be included in C++ STL, I won't be needing Win32 to create multithreading applications. From here, it becomes a chain of memories.

I imagine myself creating non-Win32 C++ programs with multithreading, drawing non-Win32 frames (similar to Java JFrames), using STLs to create a window frame in C++, etc. Then dreams of me wishing for C++ and Java to be alike (C++ with an universal STL that is just like Java SDK).

God, help me.

Do you think we can do multithreading without doing Win32 programming in the future?
0

Share this post


Link to post
Share on other sites
Why are you so against Win32? It seems strange to dismiss an entire language because of that. Win32 will make up a tiny fraction of the boilerplate stuff for a game project, the majority of the game code is not dependent on anything.

Java still uses win32 under the hood. There are application toolkits and libraries for C++ like wxWidgets and Qt which allow you to do the things you want to do without having to touch Win32, but you will never see such a thing in the STL/standard library
0

Share this post


Link to post
Share on other sites
[quote name='tom_mai78101' timestamp='1326566848' post='4902713']A little while ago, I read something about C++1x, a standard of C++. I know all of this new standard and whatnots. Then I see that there will be a <thread.h> standard template library header in the C++0x (somehow jumped to C++1x for being too slow).
Do you think we can do multithreading without doing Win32 programming in the future?[/quote]Yes, as you just said, the new version of C++ includes threads in it's standard library.

At the moment though, you're not at all forced to use Win32 threads; you could be using pthreads, or boost::threads, etc...[quote]I imagine myself creating non-Win32 C++ programs, drawing non-Win32 frames (similar to Java JFrames), using STLs to create a window frame in C++, etc. Then dreams of me wishing for C++ and Java to be alike (C++ with an universal STL that is just like Java SDK).[/quote]Features such as windows/layouts will likely never be a part of the standard C++ library.

However, as with the above threading libraries, there's plenty of C++ GUI libraries, such as Wx or Qt, etc...
2

Share this post


Link to post
Share on other sites
[quote name='tom_mai78101' timestamp='1326566848' post='4902713']
Do you think we can do multithreading without doing Win32 programming in the future?
[/quote]
As was mentioned you can already do this with Pthreads, etc. so I don't get what you're trying to get at?
0

Share this post


Link to post
Share on other sites
[url="http://threadingbuildingblocks.org/"]Intel Threading Building Blocks[/url]
0

Share this post


Link to post
Share on other sites
[quote name='daviangel' timestamp='1326672048' post='4903077']

As was mentioned you can already do this with Pthreads, etc. so I don't get what you're trying to get at?
[/quote]

I was more keen on having a standard thread library for C++ embedded in the STL, and no having to rely on downloading additional libraries and have to do the include/lib setup in each C++ project settings.

Unlike C++, Java has them entirely bundled up upon initial startup. The only thing I like more than C++ is the ability to have all the libraries (SDK) bundled up, ready for use. What C++ lacks in the STL is some things Java had covered, like threading, networking, some multimedia stuffs, etc.

Or I may have mistaken something and obviously saw what Java had, but haven't seen what C++ had evidently. That's the only thing I have when comparing Java and C++. It's not like I choose a language over Win32 or holding onto a grudge with one of the languages.
0

Share this post


Link to post
Share on other sites
[quote name='tom_mai78101' timestamp='1326796548' post='4903571']
[quote name='daviangel' timestamp='1326672048' post='4903077']
As was mentioned you can already do this with Pthreads, etc. so I don't get what you're trying to get at?
[/quote]

I was more keen on having a standard thread library for C++ embedded in the STL, and no having to rely on downloading additional libraries and have to do the include/lib setup in each C++ project settings.

Unlike C++, Java has them entirely bundled up upon initial startup. The only thing I like more than C++ is the ability to have all the libraries (SDK) bundled up, ready for use. What C++ lacks in the STL is some things Java had covered, like threading, networking, some multimedia stuffs, etc.

Or I may have mistaken something and obviously saw what Java had, but haven't seen what C++ had evidently. That's the only thing I have when comparing Java and C++. It's not like I choose a language over Win32 or holding onto a grudge with one of the languages.
[/quote]

Your mistake is to think that Win32 is part of C and C++, and Java libraries (networking, multimedia, etc.) are part of Java. They are not.

C and C++ does not come with all the fancy libraries because a lot of them are platform specific. If you want to make an application in Windows, then you should create application in the way that Windows like it. If you create for Mac OS X, then use Mac OS X libraries. Maybe one day there's a new embedded OS which runs in an entirely different platform and hardware that the concept of GUI no longer existed, so then you had to use what the platform had to offer.

Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.
0

Share this post


Link to post
Share on other sites
[quote name='alnite' timestamp='1326800998' post='4903584']
Your mistake is to think that Win32 is part of C and C++, and Java libraries (networking, multimedia, etc.) are part of Java. They are not.

C and C++ does not come with all the fancy libraries because a lot of them are platform specific. If you want to make an application in Windows, then you should create application in the way that Windows like it. If you create for Mac OS X, then use Mac OS X libraries. Maybe one day there's a new embedded OS which runs in an entirely different platform and hardware that the concept of GUI no longer existed, so then you had to use what the platform had to offer.

Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.
[/quote]


This is actually no longer true, C++11 includes threading as part of the STL. As has been mentioned earlier, 3rd party cross platform threading libraries have been available for a while, basically they deal with the nitty gritty of threads so you don't have to. I think I disagree with your suggestion to go native whenever possible. Frankly if you don't make significant gains, writing separate code for different OSes is just a waste of your time and resources. Platforms such as Java or .NET, or frameworks such as Qt or wxWindows, make it so you don't have to roll your own for each platform, and generally, you should take advantage.



Also, the concept of threading is a bit muddied, as there are hardware threads, software threads, WIn32 threads, Java threads, .NET threads, etc... and these aren't all the same thing, although in some cases they are. Often times, when you peel back all the layers, you will discover the JVM or .NET runtime are calling CreateThread or a similar ilk from the Win32 subsystem ( when running on Windows that is ). Throw in mutli-processor machines and it gets even more confusing ( as a hardware thread is tied to a single core ).
0

Share this post


Link to post
Share on other sites
I swear, once Microsoft updates their compiler to be compatible with C++1x completely, it will be in year 2020...

[quote name='alnite' timestamp='1326800998' post='4903584']
Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.
[/quote]

EXACTLY how you described my thought! But yeah... If there's a VM for all platforms to C++, then maybe I don't have to worry a thing about this at all. If only Microsoft would create .NET for all platforms available, then I'm in heavens!
-1

Share this post


Link to post
Share on other sites
[quote name='tom_mai78101' timestamp='1326820338' post='4903681']
I swear, once Microsoft updates their compiler to be compatible with C++1x completely, it will be in year 2020...

[quote name='alnite' timestamp='1326800998' post='4903584']
Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.
[/quote]

EXACTLY how you described my thought! But yeah... If there's a VM for all platforms to C++, then maybe I don't have to worry a thing about this at all. If only Microsoft would create .NET for all platforms available, then I'm in heavens!
[/quote]

You shouldn't compare Java to C++. As far as programming languages go, you really couldn't get more apples to oranges than that. C++ is a native compiled language. If you want a VM language, then just stick to Java.
0

Share this post


Link to post
Share on other sites
I would strongly suggest just getting "over" the issue with external libs and use Boost.Thread. It's great and multiplatform. In Windows-land, you'll have to wait for "maybe" VC11 for <thread> support and even then thread-local storage support is iffy.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0