Games

ช่วงหลังมานี้แม้เครื่องรุ่นใหม่ๆ ที่เราเพิ่งซื้อกันจะใช้ซีพียูดูอัลคอร์กันหมดแล้ว แต่เกมส่วนใหญ่ก็ยังไม่ได้รับประโยชน์อะไร เพราะเกมส่วนมากยังคงใช้เพียงเธรดเดียวเท่านั้น แต่ข้อจำกัดนี้อาจจะอยู่กับเราอีกไม่นาน เมื่อบริษัทเกมอย่าง Valve ผู้ผลิตเกม Half-Life เตรียมตัวพัฒนาเกมรุ่นต่อๆ ไปให้รองรับเธรดกันในตัวแล้ว

โดยทั่วแล้วแนวทางการใช้เธรดในเกมนั้นมีสองแนวทางด้วยกันคือการแยกเอาการทำงานที่ต่างกันชัดเจนออกจากกัน เช่นเธรดกราฟิก และเธรด AI เป็นต้น แต่วิธีการนี้มีปัญหาคือในโลกความเป็นจริงนั้นเธรดที่ทำงานหนักจริงๆ ยังคงเป็นเรื่องของกราฟิกมากกว่าอย่างอื่น ทำให้การแยกกันอย่างนี้ไม่ได้ช่วยเพิ่มประสิทธิภาพเท่าใหร่ ส่วนอีกวีธีการหนึ่งคือการแยกออปเจกต์ในเกมออกจากกัน แล้วให้แต่ละเธรดจัดการออปเจกต์ในความรับผิดชอบของตัวเอง วิธีการนี้แม้จะได้ประสิทธิภาพเพิ่มขึ้นมาก แต่การเขียนโปรแกรมจะค่อนข้างยุ่งยาก

แต่วิธีการที่ทาง Valve เลือกใช้นั้นเป็นวิธีที่ยากที่สุด ด้วยการรวมเอาทั้งสองวิธีเข้าด้วยกัน ด้วยการแบ่งเธรดตามฟังก์ชั่นการทำงาน ในส่วนที่แยกได้ และยังแบ่งตามออปเจกต์ในส่วนของกราฟิกอีกด้วย โดยทาง Valve ระบุว่าในเธรดที่ทำงานได้รวดเร็วเช่น AI นั้นจะมีการคำนวณล่วงหน้าไว้ด้วยเพื่อให้ตอบสนองได้ดีกว่าเดิม

ที่นี้เราก็เตรียมเก็บเงินซื้อ Quad-Core กันได้เลย

ที่มา - ArsTechnica

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

tong053 Mon, 06/11/2006 - 16:52

น่าจะมี s/w ที่ทำหน้าที่เหมือน virtual cpu แล้วทำหน้าที่จัดการ thread สำหรับ multi core กับ s/w single thread รู้นะ ว่า sw ตัวนี้ต้องสร้างยากมากแน่ๆ แต่คงจะดีนะ ถ้ามีให้ใช้

เอ แล้ว IDE ที่เรามีอยู่มันจะช่วยให้เราเขียน software เพื่อทำงานกับไอ้เจ้า dual core ยังไงดีหนอ

หุ ๆ สงสัย assembly ล้วน ๆ ครับ

----- http://www.peetai.com | เว๊ปบล็อกที่โม้แต่เรื่อง Software as a Service.

narok119 Mon, 06/11/2006 - 19:26

สำหรับคนเขียนโปรแกรม ผมคิดว่าจริงๆแล้ว ถ้าใช้พวก java ที่มี JVM ครอบไว้เนี่ย

เราก็แค่ควรจะหันมาใช้งาน MultiThread กันมากขึ้น เพื่อทำให้ประสิทธิภาพโปรแกรมทำงานให้สอดคล้องกับ Dual Core จริงๆเท่านั้นเอง

ตัวโปรแกรมเมอร์เองไม่น่าถึงกับต้องเปลี่ยน IDE หรืออ่ะไรแบบนี้นะครับ

ส่วนการจัดการที่อยู่เบื้องหลังก็โยนให้ JVM แล้วละครับ

pt Mon, 06/11/2006 - 19:33

น่าจะแยกได้ในระดับ Hardware ไม่น่าต้องให้คนเขียนมานั่งมึน เพราะถ้าต่อ ๆ ไปมันยิ่งแบ่งคอร์ออกไปอีก ก็ต้องมาทำใหม่อีก

wiennat Mon, 06/11/2006 - 19:47

โห เกมตั้งใหญ่โต มีแค่ เธรดเดียวเองเหรอครับ นึกว่าพวกนี้เค้าทำ multi threading กันหมดแล้ว

:-P :D

PaePae Mon, 06/11/2006 - 23:14

> tong053 อันนั้นหน้าที่ของ OS แล้วมั้งครับ ^^"

> พี่ไท้ ผมมองว่าเป็นเรื่องของการทำ multithread ซึ่งเป็นสิ่งที่ภาษาโปรแกรมมันทำได้อยู่แล้วล่ะนะ ไำม่เกี่ยวกับ IDE เท่าไหร่ (นอกจากเรื่อง debug ที่หารองรับ multithread debugging ยาก)

(อ่า จริง ๆ ก็ตามที่คุณ narok119 ตอบไปนั่นแหละ)

> wiennat ต้องบอกว่า ปกติก็ใช้ multithread อยู่แล้ว เพียงแต่ใช้ไม่มากครับ เพราะตัวซีพียูเองก็ยังคำนวณได้แค่ทีละ 1 thread การแบ่ง thread ของเกมมาก ๆ จะทำให้ synchronization time ระหว่าง thread สูงขึ้น ส่งผลให้เกมทำงานได้ไม่เร็วพอที่จะตอบสนองกับประสาทสัมผัสของผู้เล่นครับ

สรุปง่าย ๆ ก็ต้องบอกว่า แต่เดิมใช้ thread เพื่อให้จัดการกับส่วนต่าง ๆ ของโปรแกรมเกมได้ง่ายขึ้น แต่ในข่าวนี้บอกว่า ต่อไปนี้ จะเริ่มใช้ thread เพื่อให้มันคำนวณได้เร็วขึ้นด้วย

mk Tue, 07/11/2006 - 13:33

ผมอ่านข่าวนี้รู้สึกว่าต้องรอ John Carmack เขียน engine ยังไงก็ไม่รู้สิ

ppp Sun, 19/11/2006 - 00:15

valve นั้นสุดยอด ขนาด HDR ยังเขียนของตัวเองเลย