Tuesday, January 28, 2020

Procurement Purchasing Supplier

Procurement Purchasing Supplier After having investigated briefly in general the concept of procurement and the emergence of the concept of procurement , it is imperative for us in this chapter to delve in detail the analysis of the concept of procurement , the various theories which have been predicated at the international level and their relevance for our study under investigation . We would also have to critically scrutinise how the different models of procurement effectiveness measurements can help us in our analysis to delve in greater detail the relevance of procurement from the perspective of SOM . It is important that we have to undertake a holistic approach in the investigation of procurement practices and procurement effectiveness in our literature Review chapter for this forms the foundation of our secondary research. Our primary research which would be delved in detail in the subsequent chapters would be further developed on the strong foundations of this chapter. In the final analysis we would be util ising in adequate measure the concepts from the secondary research as they develop in this chapter and couple it with our derivations from primary research to gain a greater in-depth understanding of procurement practices in Shell Oman and hypothesize relevant recommendations and remedial solutions for bringing about effective changes in the present operational systems at SOM Definition of Procurement Relevance : it is important for our study to understand clearly the meaning and exact phraseology behind procurement for the purposes of investigation of procurement practices in SOM . Since Procurement is an extremely broad concept which has applicability from strategic , operations and tactical level , various definitions would have to be looked into and strategically decipher their level of applicability for our purpose of investigation . Procurement, purchasing, and supplier management are all terms used extensively. They may mean the same or sometimes may have significant differences. Since the term procurement covers many areas, from operational to strategic levels, Knudsen (1999) has summarized the different terms, used for acquiring good and services in the following table. Level Term Meaning Strategic Supply Management To be aware of the strategic impact of procurement and fully exploit it by formulating a supply strategy Tactical Procurement To satisfy internal demands with external sources which adhere to objectives set at the strategic level Operational Purchasing The minimum activities required to obtain external products or services that result in invoice from an external source Timo et al (2005), argued in their document, the quantitative definition of purchasing is not accurate and suggest to a broader scope of purchasing, adding pensions, other personnel costs, financial expenses and increase in assets within the scope. They define Purchasing as: â€Å"Invoices or payments based on exchange of physical objects, services or rights†. There are two basic types of purchasing in the business world: (1) Purchasing for resale and (2) purchasing for consumption or conversion (Dobler and Burt, 1996). Purchasing for resale is performed primarily by merchants. Industrial buyers buy materials, services etc. for manufacturing companies, service business, institutions, utilities, and various government agencies. Other definitions of Procurement are as follows: Procurement is the acquisition of systems, goods or services at the best possible total cost of ownership, in the right quantity, at the right time, in the right place for the direct benefit or use of the governments, corporations, or individuals generally via, but not limited to a contract. (Project Management Body of Knowledge, 2000) Procurement is the process of acquiring goods, works and services, covering both acquisition from third parties and from in-house providers. The process spans the whole life from identification of need, through to the end of a service contract or the end of the useful life of an asset. It involves options appraisal and the critical â€Å"make or buy† decision which may result in the provision of services in-house in appropriate circumstances. (The Procurement process The Buyers Magazine, 2000). In the context of a procurement process, obtaining â€Å"best value for money† means choosing the bid that offers â€Å"the optimum combination of whole life cost and benefits to meet the customers requirement†.† (National Procurement Strategy for Local Government in England, 2003) The Importance of Procurement Relevance : The importance of procurement in the changing face of corporate scenario of today is all the more important as there is a greater strategic interface between the procurement department and the other key departments within functional global corporate entities . In this regard the study of importance of procurement as a terminology would help us in understanding and appreciating the strategic shift in focus of procurement operations from tactical to a crucial strategic level . This would help us in highlighting the importance of procurement practices in organisations such as SOM under investigation Many authors wrote about the importance of procurement function in todays organization and how it can impact the bottom line. Different terms are used in the literature, Procurement, Purchasing or Supply management but they all apply to the process of acquiring goods and services for the business, which account for a huge corporate expenditure. The following main objectives show how the procurement function can contribute to a companys competitiveness (Axelsson et al, 2005): †¢ Cost optimisation (e.g. lower transaction costs and overhead costs) †¢ Asset utilisation (e.g. outsourcing and inventory management) †¢ Value creation (e.g. process/products development and quality improvement) According to Procurement strategy council, the procurement function today is viewed as an important component of a firms strategic arsenal, the modern purchasing department can reduce a firms operational expenditure through streamlined purchasing and price reductions for goods and services. The article discuss that a smart purchasing can reduce costs 20% to 30%, freeing up funds to be used elsewhere. The realization that purchasing can impact bottom line saving has elevated procurements strategic importance. (Procurement Strategy Council, 2001) Improving the Bottom Line Reductions in Procurement Costs Directly Affect Net Income Income Statement (in millions US$) Initial 3% Reduction in OR Revenues $1000$1000 Operating Resources (OR) $350 $339 Direct Materials$220$220 Wages, Salaries, Benefits$200$200 Depreciation$110 $110 Taxes $60$60 Net Income After Taxes $60$71 Reducing purchasing costs translates directly into bottom line savings. By lowering OR costs by $11 million, a firm directly raises its after tax income by the same amount. Source: (Procurement Strategy Council, 2001) Further, van Weele describes in his book, ways that procurement can contribute to the companys competitiveness. They play a critical role in quality assurance by working with suppliers to ensure higher quality standards regarding incoming goods and services. Procurement can also effect how quickly a firm reacts to changes in demand, through increased involvement in supply chain coordination and inventory management. In addition, by reducing purchasing costs the function can contribute to substantial price reductions of the end product. The leverage effect of purchasing can be considerable depending on the purchasing-to-sales ratio and the capital turnover ratio. (van Weele, 2005) Nowadays companies outsource most of their activities, increasing their reliance on the competitiveness of their suppliers. . (J. Hamilton, 2002). As a support case study, the case of Toyota cars (Japan), can be highlighted, wherein 83% of all activities are outsourced form various global suppliers. (Toyota, 2000). This makes the process of procurement quintessential and in fact the most important, in todays business world. If a company procures the right quality products, at the right price, with the right delivery schedule, only then and then alone can it remain productive and competitive in todays environment (Ian McMillan, 2005) This shows that if the procurement process is not right, then the company product, the company image, competitiveness et al would surely take a dive. According to van Weele, â€Å"This is why management has become increasingly aware of the purchasing function†. Once regarded as a reactive activity, the procurement and sourcing process at leading firms is at the forefront of responding to and creating change. (Procurement Strategy Council, 2001) Within the past year, several new research initiatives from different relevant perspectives prove persuasively that excellence in procurement can lead to a host of proven, quantifiable business benefits (Procurement Strategy council, 2001). Lower operating costs, higher ROI, and a direct contribution to the bottom line are among the principal advantages that have been documented. The increased impact from purchasing on corporate performance is supported by a study recently conducted by IBM Business Consulting Services. In the study, called The 2005 Chief Procurement Survey, purchasing managers and other people in leading positions at companies around the world were interviewed concerning the current and future role of purchasing. Many reasons to the increased importance are pointed out, for example the growth in outsourcing, corporate restructuring and increased supplier value adding and risk. (The 2005 Chief Procurement Survey, 2005) Another study, conducted by business consultancy Archstone Consulting, found that nearly 90 percent of participants agreed that procurement plays a strategic role in the competitiveness of their organization, but needs to be further elevated in the organizational hierarchy to be truly effective. (Supply and Demand Chain Executives, 2004) The best-practice companies truly understand the power of procurement, says Pierre Mitchell, a director at The Hackett Group, which recently concluded an in-depth research into the procurement practices of more than 300 companies, found that world-class organizations generate 133 percent greater return on their investment in procurement than the average companies. The bottom line is that world-class companies continue to take a very different view of procurement, looking at it as an investment rather than as a cost center, says Mitchell. This is how they generate the millions of dollars in additional savings that other companies dont see. (Quinn, 2005) Ready or not, procurement is moving to center stage, with top billing on the corporate agenda. At companies around the world, CEOs and boards are counting on procurement initiatives to keep their businesses favourable positioned in todays intensely competitive marketplace. (The Global CPO Survey, 2005) To understand the new found omnipotence of the procurement process in organisational hierarchy, it is imperative to understand the stages of development of the process, right from its inception (Quinn, 2005). Historical Development Relevance : The historical development of procurement would help us to analyse the changing face and role of global procurement practices and understand critically how over the years the concept of procurement has begun to occupy the one of the centre stages for corporate performance . As would be revealed in this section we would find that procurement can no longer be visualised as an isolated entity but has to be strongly viewed as an inherent and integral part of the process of company operations. The historical development of procurement would add on a chronological dimension to understand the growing importance of procurement over the past decades . In the early 1970s, Ansoff, opined that the purchasing process played a passive role in the business organization and did not have any strategic role. (Ellram and Carr, 1994). The 1973-74 oil crisis and related raw materials shortages drew significant attention to the importance of purchasing. However, top management and purchasing professionals, did not react to enhance the role of purchasing in corporate strategy until when Porter came with his famous five force model that shape the competitive nature of industry, identified buyers and suppliers as two of the five critical forces. Thus, the strategic importance of the supplier and the firm as a buying entity began receiving recognition in the mainstream strategy literature. (Ellram and Carr, 1994). Since then 1980s the attitude toward procurement was changes and evolving to a more strategic level. According to the procurement strategy council article, the procurements movement from a tactical to a more strategic role in corporate operations is predicated on a broader shift in corporate strategy. Before World War II, purchasing departments accounted for barely 20% of corporate expenditures. Today, purchasing departments are responsible for 50% to 70% of corporate expenditures. This explanation is supported by Monczka et al. First, that the role of purchasing is presently being reshaped in order to fit the modern economy. This is related to the increasing globalisation, technology development and changing consumer demands. Another conclusion, according to Monczka et al, is that purchasing must continue its integration with customers, information systems, operations etc. (Monczka et al, 2000) The following table shows a compilation of strategic and operation tasks carried out in the procurement function. Strategic Procurement Identify necessary capabilities to match the customers needs regarding flexibility, innovation, agility, quality, responsiveness, cost levels and price levels Assess ones own capabilities (Knowledge, technology, capacity, competence, long term importance, total cost) Assess supplier capabilities (knowledge, technology, capacity, competency, long term imprtance, total cost, type of market, localisation, and substitutability) Model cost drives for items purchased Model Single/ Multiple sourcing effect on total cost Model how supplier relationship affect total cost (cost benefit of engaging in a close supplier relationship) For close supplier relationships share information and knowledge and make relation-specific investments Procurement Process Identify needs Conduct market analysis Send out and expedite RFx Do Background review Negotiate contracts and select suppliers Purchase order fulfilment Monitor supplier performance Internal Tasks Analyse corporate spending Parts bundling Aggregated corporate expenditures Develop relationships with internal customers Reduce maverick buying and promote compliance Disseminating procurement relation information External Tasks Scan for innovations Monitor, disseminate and stimulate Develop new sources Foster external capabilities Source Strategic Procurement Council, 2001. Value Improvement (Value Based Procurement The Organisational Quintessential) Relevance : It is important for us to understand the concept behind value improvements or value based procurement . The fact that tangible and intangible values could be quantified to procurement products and services makes the study of procurement systems all the more interesting for definitive mathematical extrapolation of the relevant results. Value systems and the ability to attribute value systems makes the procurement operational systems multidimensional and unique . Furthermore this is a system which could be aptly applied for effecting improvements in procurement systems for SOM, therefore a thorough investigation of the relevant concept is deemed important for our investigation . To be successful in business, we need to satisfy our customer by providing them with something they perceive as value. Since we are dealing with internal customers and suppliers, the concept of value becomes vital, which is directly linked to customer satisfaction. High customer satisfaction means their needs are met at high level. The customers will be satisfied if the product or service provides them with value. The term ‘value is used in every day business language however it is often misused and misunderstood. The concept of value has many definitions (Zeithaml, 1988; Anderson et al., 1993; Monroe, 1990; Gale, 1994; Woodruff, 1997) but generally they are not distinct. Common themes throughout these definitions are that (Dumond, 2000): Customer value is linked to the use of a product or service, thereby removing it from personal values; Customer value is perceived by the customers rather than objectively determined by the seller; and Customer value typically involves a trade-off between what the customer receives (e.g. quality, benefits, worth) and what he or she gives up to acquire and use a product or service (e.g. price, sacrifices). The concept of value is important for this study since our purpose is to illustrate value improvement initiatives to enhance the current procurement system with Shell Oman Marketing. According to Hill (2005), value can be classified under two headings: Use Value: The properties and qualities that accomplish the function of service or product. Esteem value: the properties, features or attractiveness that causes people to want to own or use it. Value, therefore, consists of a combination of use and esteem properties related to the cost of providing them. However, the measure of value added is directly linked to customer satisfaction. The measurement of procurement activities based on traditional efficiency report, and short terms savings doesnt support value base procurement. In order to reflect shift in the focus in procurement activities, new measurement techniques must be target at those activates which reflect value to the stakeholder. (Butler, 1995). An interesting study conducted by Dumond (1994) about creating a value base procurement. Based on his finding, many firms the operating environment does not support value-based purchasing. Senior management plays a critical role in developing an environment that will support and encourage value-based purchasing, the following steps are recommended: Focus individual purchasers on customers needs and identify the value-adding processes Develop a performance measurement system that emphasizes quality, process improvement, and customer satisfaction Integrate purchasing into the firms communication system (elevate if needed) Educate-not only individual purchasers but also their customers. 2.4Value Analysis Framework To analysis value in a system, it will be useful to the use the value analysis procedure, which is discussed in Terry Hill book of Operation Management (2005). The steps involved are: Select the service or product Gather information about it Analysis its function and its value for money Generate alternative ways to provide the same function through speculation and brain-storming Assess the worth of these ideas. Decide what is to be done Implement the decisions Evaluate the result EFQM Excellence Model Relevance : EFQM system analysis is extremely important for our investigation because EFQM model based on European models of operational management and Quality management help us through an exhaustive interface between strategic inputs and outputs to measure the effectiveness of procurement systems and delve on the findings to derive adequate strengths and measures for any procurement operational system . Since our investigation is essentially based on finding the points of improvement in SOM and capitalising on the strengths an understanding of the relevant model is highly warranted for our investigation and proposed study . Moreover since EFQM model visualise the operational mechanics of procurement system from multidimensional angles it is imperative for us to investigate the mechanics of operation of EFQM model in sufficient details for finding the relevant applicability for our study under investigation . The European Foundation for Quality Management (EFQM) is widely discussed in the literature and many organizations have applied it as a tool for assessing all aspects of an organisations activities and results. According to EFQM, the model is intended to promote continuous improvement and is an aid to effective benchmarking. Excellence Model was introduced at the beginning of 1992 as the framework for assessing organisations for the European Quality Award. Now it became the most widely used organisational framework in Europe and considered as the basis for the majority of national and regional Quality Awards. 2.4.2Benefit of EFQM The EFQM Excellence Model  is a  business model tool  that can be applied in many different ways: As a business model for being able to assess independently the competency of the organization by the organisation itself. As a measure to benchmark other organisational functioning and strategy. As an improvement tool for highlighting areas to improve. As a common denominator, standard measurement scale or a common vocabulary. As a structural guide for the management of any organisation. The fundamentals of the EFQM Excellence model are based on nine criterions which are cannot be prescribed and such are practical in nature and application. Five of these are Enablers and four are Results. What a particular organisation does, those factors qualify as ‘Enablers†. The achievement of an organisation qualifies as the Results Criterion. Results are caused by Enablers and Enablers are improved using feedback from Results. Excellent results with respect to Performance, Customers, People and Society are achieved through Leadership driving Policy and Strategy that is delivered through People, Partnerships and Resources, and Processes. (Procurement modelling-a discussion, Harvard Review Press, 1996) The Fundamental Concept of EFQM Excellence Model are: Results Orientation Every organisation should look for the outcome of â€Å"enablers† to delight customers. . Customer Focus Excellence is creating sustainable customer value. Leadership and Constancy of Purpose Excellence is visionary backed by inspirational leadership, with constancy of purpose. . Management by Processes and Facts Excellence is managing the organisation through a set of interdependent and interrelated systems, processes and facts. People Development and Involvement Excellence is maximising employee contribution through employee development and involvement. Continuous Learning, Innovation and Improvement Excellence is challenging the status quo and bringing change by learning and innovation. Partnership Development Excellence is developing and maintaining value-adding partnerships. Corporate Social Responsibility Excellence is exceeding the minimum regulatory framework in which the organisation operates and to strive to understand and respond to the expectati ons of their stakeholders in society (Harvard Review Press, 1996) 2.5 Procurement Value Improvement Framework (The Shell Oman perspective) The structure of literature is in line with the value analysis framework. First, we identified the service we want to investigate, which procurement activities in Shell Oman Marketing. Secondly, we provided information about the procurement function in Shell Oman and its structure. Thirdly, we use Soft System Methodology (SSM), which is strong in analyzing a holistic situation and capture qualitative data. The SSM will only be used to develop understanding of the challenges exist in the current system. Unstructured Interview is strong in determine many qualities aspect which will be useful in revealing out issues and problems that other method of research can meet this object effectively. Therefore, to get different perception, it will be useful to carry out a survey through an interview with five key internal business stakeholders to analysis the strength and weakness of current contract and procurement activities. Fourthly, we dig in the literature and journals to search for ways o f adding value improvement to procurement function. Plus, interviews with two large companies in similar field to identifying the industry best practice in procurement function. Fifthly, an analysis of all the procurement best practices generated from above stage, which will be discussed in chapter 4 in detail. Sixthly, in chapter 5, based on the analysis, we will recommend the way forward. Unfortunately, this research will be limited at the recommendation stage and will not have the opportunity to implement and evaluation the result. 2.6The Purchasing Maturity (Organisational Stratagem) We can observe that the purchasing role in providing added value has evolved and has been modified along with the importance and the place taken by purchasing in organizations. In figure 3 the main values added by purchasing are related to each of the evolution stages towards purchasing maturity (van Weele, 1998). In the first stage the main value added by purchasing is by assuring the continuity of the supply. In the second stage the already purchased items have an increased importance in companys costing cost structure. The role of purchasing then left is to minimize material costs and improve /up the bottom line. Stage 3 would center on co-ordination between various departments .The main values added by purchasing are greater compliance with pre-negotiated contracts, uniform buying policies and systems and capturing the benefits from internal co-ordination. The next stage lays stress on use of inter-functional teams and the reduction pf the total systems costs satisfaction of the internal customer seems to be the main focus of purchasing then. The supply orientation stage envisages the selection of suppliers on strategic company guidelines, requirements, long-term relationships design, supplier network management and early involvement in the new product development process. In the final s tage the main goal is to design the most effective and efficient value chain possible to serve the end customer. This last stage is characterized by an extensive use of cross- functional supplier development teams and a close collaboration on advance technology with suppliers. (Telgen Sitar, 2001) 2.7 Categories of Value Added Procurement The literature review highlights five main categories of value added procurement which are representative and important for every organization: Better contracts Improved purchasing efficiency Customer satisfaction (improved quality and service) Closer and more cooperative relationships with suppliers Reduced costs, improved quality and increased time to market resulting from an early involvement of the purchasing department in the new product development process (NPD). The first four categories of values added are based on Leenders and Schiele (1999). Basically, the researcher took one aspect from each of the above categories of value added. The role of the purchasing department should be considered from all possible angles and viewpoints. There is an increasing contribution of the purchasing department in the new process development in todays organisations, with specific and special interests in -the contribution of the purchasing department in the areas of quality, cost and time to market resulting from an early involvement of the purchasing department in the NPD process. The Resource Based View of Procurement Relevance : The analysis of this model for procurement is important for adding diversity to our investigation of procurement systems and their mechanics . Resource based view of procurement is one of the important views for procurement practices from the global perspective especially from the point of view of competing firms in highly dense and competitive markets , where because of oligopoly of procurement practising firms each firm would have to build a set of unique identifiable resources to capitalise on a

Monday, January 20, 2020

Comparing the Quest in M. Butterfly and American Beauty Essays -- Comp

The Quest in M. Butterfly and American Beauty      Ã‚   Happiness is defined as enjoying, showing, or characterized by pleasure; joyous; contented. Based on this definition we all search for happiness our entire lives. Two very different stories address this idea of the quest for happiness. M. Butterfly by David Henry Hwang is the story of a man named Gallimard who is longing for his love "Butterfly" to return to him. John Deeney describes it as him, clinging to his idea of a "Perfect Woman" to the end by costuming himself into the victimized Butterfly though his final suicide. Although Gallimard’s infatuation with Song sometimes makes him cut a rather ridiculous figure, his dead seriousness at the end evokes a certain amount of pathos and even admiration as he dies for his ultimate ideal of perfect womanhood. On the other hand, there is Sam Mendes’ American Beauty. This story approaches the idea of happiness in a different way; it presents an entire family and their pursuit of sweet bliss. The quests of Carolyn, Jane, and Lester Burnham, as well as their next-door neighbor, Frank Fits, are on display. Paul Arthur describes American Beauty as "An authentic Life Lesson, a spiritual world view grounded in the discovery of beauty." In both M. Butterfly and American Beauty, the characters are presented as unhappy and searching for happiness. Of the characters, however, only Jane Burnham, Frank Fitts, and Lester Burnham find their new happiness. Song in M. Butterfly lives life as a false image to make herself happy. Song is an actor who plays the part of a lady in an opera. He allows a man, Gallimard, to fall in love with his character. He then uses this love affair to help his government receive classified information. When a... ... be a relationship, a sexual preference, or simply a life style, the lack there of is always apparent. In M. Butterfly and American Beauty each character is on a pursuit to find his or her own happiness. In the end, only Jane Burnham, Frank Fits, and Lester Burnham find the happiness they are looking for. They display that more than anything; happiness is the most important thing in life. Without happiness, money, personal success and status do not mean anything. Works Cited American Beauty. Dir. Sam Mendes. Dream Works, 1999 Arthur, Paul. "American Beauty." Cineaste 2000 Vol 25 Issue 2: 51. Deeney, John. "Of Monkeys and butterflies: Transformation in M. H. Kingston’s Tripmaster Monkey and D. H. Hwangs’ M. Butterfly." Melus Winter 93/94; 21. Meyer, Michael. The Compact Bedford Introduction to Literature. Boston: Bedford/ St. Martin’s, 2000.

Sunday, January 12, 2020

Computer Mediated Learning Education

For busy adults with conflicting schedules facing a multitude of family and work demands, who still wish to add to their academic credentials or vocational qualifications, computer mediated learning may seem like an ideal way for such adults to satisfy their educational needs. For an elementary school instructor, however, computer mediated learning lacks the supervisory, mentoring, and hands-on capacity that is usually deemed necessary for imparting basic skills. An â€Å"on-line, collaborative learning approach using the Internet offers solutions to many of the problems plaguing university education,† such as oversubscribed classes and the difficulty for university students to gain access to the required classes that they need to graduate on time. (Jones, 2004) At a higher education level, computer mediated learning allows for students to be enrolled in more sections on a year 'round basis in a university environment-but this is not an advantage enjoyed by elementary school students. At best, in terms of dealing with high enrollment, the computer-mediated classroom is an asset, not a supplement to face-to-face learning on the lower levels of education. Even advocates of distance or computer mediated learning on the university level have stressed that such an educational format works best when students are mature, preferably adult learners, â€Å"comfortable with independent learning and computers,† who have a clear intention of why they wish to obtain their degree. Jones, 2004) Such a description could not be more antithetical to elementary school children. Moreover â€Å"to be successful, the implementation of such a learning approach requires significant technical and educational skills and experience,† as well as motivation on the part of the learners. (Jones, 2004) Does this mean that computer based learning has no place in an elementary school curriculum? Not necessarily. Foreign language instruction that would not otherwise be available to elementary school children is possible through the use of computer based learning, as children can hear and interact with native speakers, and even communicate with classes their own age, across the world. (Perez, 1996) When teaching a foreign language, one teacher found that the new technology encouraged students to think critically, encouraged self-directed learning, and provided a library on-screen of different texts in the language the students was learning. But because the computer medium can allow for passivity on the part of the student, Lucia Perez stresses that a teacher must take an intensively constructivist or hands on approach, to motivate the students to be proactive in their learning, such as assigning independent research topics, rather than permitting students to ‘veg out' in front of a screen, as might be their custom at home when using the computer for pleasure. Likewise, when using computer based learning to teach, for example â€Å"the teaching dilemma was how to simultaneously motivate the students by applying mathematics learning to real life problems of concern to them, and help them to gain quickly the basic skills to do the necessary mathematics manipulations almost automatically,† and once this motivation was integrated into the computer based learning, the program appeared to work well. (Shaw, 1996) Thus, computer based learning can and must be more than simply an effort to transfer face to face classroom instructional practices into a different or virtual medium, for the learning does not take place face to face, but is primarily student-directed. Also, there is more responsibility upon the head of an average Elementary teacher to create assignments that motivate and engage student's imagination when making use of computer based learning for specific, targeted purposes, but when done so effectively, the rewards are great for both teachers and students.

Saturday, January 4, 2020

2D Game Programming in C Tutorial Snake

The purpose of this tutorial is to teach 2D game programming and C-language through examples. The author used to program games in the mid-1980s and was a game designer at MicroProse for a year in the 90s. Although much of that is not relevant to the programming of todays big 3D games, for small casual games it will serve as a useful introduction. Implementing Snake Games like snake where objects are moving over a 2D field can represent the game objects either in a 2D grid or as a single dimension array of objects. Object here meaning any game object, not an object as used in object-oriented programming. Game Controls The keys are move with Wup, A left, Sdown, Dright. Press Esc to quit the game, f to toggle frame rate (this isnt synchronized to the display so can be fast), tab key to toggle debug info and p to pause it. When its paused the caption changes and the snake flashes, In snake the main game objects are The snakeTraps and fruit For purposes of gameplay, an array of ints will hold every game object (or part for the snake). This can also help when rendering the objects into the screen buffer. Ive designed the graphics for the game as follows: Horizontal Snake Body - 0Vertical Snake Body - 1Head in 4 x 90-degree rotations 2-5Tail in 4 x 90-degree rotations 6-9Curves for Directions Change. 10-13Apple - 14Strawberry - 15Banana - 16Trap - 17View the snake graphics file snake.gif So, it makes sense to use these values in a grid type defined as block[WIDTH*HEIGHT]. As there are only 256 locations in the grid Ive chosen to store it in a single dimension array. Each coordinate on the 16 x16 grid is an integer 0-255. Weve used ints so you could make the grid bigger. Everything is defined by #defines with WIDTH and HEIGHT both 16. As the snake graphics are 48 x 48 pixels (GRWIDTH and GRHEIGHT #defines) the window is initially defined as 17 x GRWIDTH and 17 x GRHEIGHT to be just slightly bigger than the grid. This has benefits in game speed as using two indexes is always slower than one but it means instead of adding or subtracting 1 from the snakes Y coordinates to move vertically, you subtract WIDTH. Add 1 to move right. However being sneaky weve also defined a macro l(x,y) which converts the x and y coordinates at compile time. What Is a Macro? #define l(X,Y)(Y*WIDTH)X The first row is index 0-15, the 2nd 16-31 etc. If the snake is in the first column and moving left then the check to hit the wall, before moving left, must check if coordinate %WIDTH 0 and for the right wall coordinate %WIDTH WIDTH-1. The % is the C modulus operator (like clock arithmetic) and returns the remainder after division. 31 div 16 leaves a remainder of 15. Managing the Snake There are three blocks (int arrays) used in the game. snake[], a ring buffershape[] - Holds Snake graphic indexesdir[] - Holds the direction of every segment in the snake including head and tail. At the game start, the snake is two segments long with a head and a tail. Both can point in 4 directions. For north the head is index 3, the tail is 7, for the east head is 4, the tail is 8, for the south head is 5 and the tail is 9, and for the west, the head is 6 and tail is 10. While the snake is two segments long the head and tail are always 180 degrees apart, but after the snake grows they can be 90 or 270 degrees. The game starts with the head facing north at location 120 and the tail facing south at 136, roughly central. At a slight cost of some 1,600 bytes of storage, we can gain a discernible speed improvement in the game by holding the snakes locations in the snake[] ring buffer mentioned above. What Is a Ring Buffer? A ring buffer is a block of memory used for storing a queue that is a fixed size and must be big enough to hold all data. In this case, its just for the snake. The data is pushed on the front of the queue and taken off the back. If the front of the queue hits the end of the block, then it wraps around. So long as the block is big enough, the front of the queue will never catch up with the back. Every location of the snake (i.e., the single int coordinate) from the tail to the head (i.e., backwards) is stored in the ring buffer. This gives speed benefits because no matter how long the snake gets, only the head, tail and the first segment after the head (if it exists) need to be changed as it moves. Storing it backwards is also beneficial because when the snake gets food, the snake will grow when its next moved. This is done by moving the head one location in the ring buffer and changing the old head location to become a segment. The snake is made up of a head, 0-n segments), and then a tail. When the snake eats food, the atefood variable is set to 1 and checked in the function DoSnakeMove() Moving the Snake We use two index variables, headindex and tailindex to point to the head and tail locations in the ring buffer. These start at 1 (headindex) and 0. So location 1 in the ring buffer holds the location (0-255) of the snake on the board. Location 0 holds the tail location. When the snake moves one location forward, both the tailindex and headindex are incremented by one, wrapping round to 0 when they reach 256. So now the location that was the head is where the tail is. Even with a very long snake that is winding and convoluted in say 200 segments. only the headindex, segment next to the head and tailindex change each time it moves. Note because of the way SDL works, we have to draw the entire snake every frame. Every element is drawn into the frame buffer then flipped so its displayed. This has one advantage though in that we could draw the snake smoothly moving a few pixels, not an entire grid position.