= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 A u t h o r :   Y o u n g w o o k   K i m   ( K o r e a n ) 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 C o n t a c t :   r u m i a 0 6 0 1 @ g m a i l . c o m 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 P r o l o g ?   W h y   P y g a m e ? 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 A s   w e   k n o w ,   e v e r y   k i n d   o f   g a m e   h a s   3   s e c t i o n s   ( B e c a u s e   g a m e   i s   a   s u b g r o u p   o f   p r o g r a m ) :   * * i n p u t * * ,   * * p r o c e s s * *   a n d   * * o u t p u t * * .   I f   y o u   w a n t   t o   m a k e   a   g a m e   i n   C   * * c o n s o l e   e n v i r o n m e n t * *   ( W r i t e   C   s o u r c e   c o d e   t h e n   e x e c u t e   t h a t   o n   t h e   c o n s o l e )   s i m p l y ,   a l l   y o u   h a v e   t o   d o   i s   j u s t   u s i n g   l o t s   o f   s c a n f ( o r   u n n o r m a l i z e d   g e t c h   f u n c t i o n )   f u n c t i o n s   a n d   p r o c e d u r a l   c o m p l e x   a l g o r i t h m   f o l l o w e d   b y   p r i n t f ( w i t h   b l i n k i n g   c l e a r   f u n c t i o n )   f u n c t i o n s   w i t h   A S C I I   a r t s !   H o w e v e r ,   w h e n   y o u   g e t   b o r e d   o f   m a k i n g   o u t d a t e d ,   g r a p h i c - l e s s   C U I ,   d i s c o n t i n u o u s   g a m e ,   n o w   i t  s   t i m e   t o   l e a r n   G U I   b a s e d   g a m e   m a k i n g   t o o l .   Y o u   c a n   d i r e c t l y   e n t e r   i n t o   U n i t y   * * g a m e   e n g i n e * *   o r   U n r e a l   g a m e   e n g i n e .   H o w e v e r ,   t h e r e   a r e   t o o   m u c h   b a r r i e r   t o   o v e r c o m e .   Q u a t e r n i o n   f o r   3 D   c o l l i s i o n ,   M e c h a n i m / L e g a c y   a n i m a t i o n   c o m p a t i b i l i t y ,   L a r g e r   m e m o r y / F a s t e r   C P U   f o r   s i m u l a t e   i n   h i g h - g r a p h i c   m o d ,   a n d   e t c !   S o ,   t h e r e   i s   a   d i l e m m a   b e t w e e n   c o n s o l e   e n v i r o n m e n t   a n d   g a m e   e n g i n e .   C a n   t h i s   d i l e m m a   t o   b e   s o l v e d ? 
 
 
 
 
 
 . .   i m a g e : :   i n t r o d u c t i o n - P u y o P u y o . p n g 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   2 2 0 ,   1 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " i n t r o d u c t i o n - P u y o P u y o . p n g " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 ( E x m a p l e   o f   C   c o n s o l e   g a m e   -   P u y o P u y o ) 
 
 
 
 
 
 . .   i m a g e : :   i n t r o d u c t i o n - T P S . p n g 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   2 2 0 ,   1 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " i n t r o d u c t i o n - T P S . p n g " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 ( E x m a p l e   o f   U n i t y   E n g i n e   g a m e   -   T P S ) 
 
 
 
 Y e s .   P y g a m e   c a n   s o l v e   t h a t .   P y g a m e   i s   a n   e x t e r n a l   l i b r a r y   o f   * * P y t h o n * *   w h i c h   e n a b l e s   y o u   t o   m a k e   a   * * g a m e * * .   P y g a m e   h a s   a d v a n t a g e s   o f   c o n s o l e   e n v i r o n m e n t .   F o r   e x a m p l e ,   s i n g l e   p y g a m e   p r o j e c t   n e a r l y   e q u a l s   s i n g l e   s o u r c e   c o d e ,   s o   w e   h a v e   t o   f o c u s   o n   w r i t i n g   s o u r c e   c o d e   o n l y .   ( w i t h   s o m e   s o u n d   f i l e   o r   s o m e   i m a g e   f i l e   i n   t h e   s a m e   d i r e c t o r y ) .   B e c a u s e   P y g a m e   i s   n o t   a   t o o l   b u t   a   l i b r a r y ,   s i n g l e   c o m m a n d    i m p o r t   p y g a m e    m a k e s   c u r r e n t   s o u r c e   c o d e   t o   u s e   p y g a m e  s   e v e r y t h i n g .   T h a t   i s ,   P y g a m e   i s   s i m p l e   t o   a c c e s s .   P y g a m e   h a s   a d v a n t a g e s   o f   g a m e   e n g i n e ,   t o o .   F o r   e x a m p l e ,   P y g a m e   p r o v i d e   i n p u t   f u n c t i o n s   ( w h i c h   c h e c k   e v e r y   p o s s i b l e   s t a t e   o f   k e y b o a r d ,   m o u s e   a n d   e v e n   f i l e s )   a n d   o u t p u t   f u n c t i o n s   ( d r a w i n g   g e o m e t r y ,   f i l l   c e r t a i n   c o l o r s   o r   s e t   d i s p l a y )   t o   u s e r .   T h a t   i s ,   u s e r   c a n   r u n   t h e   p r o g r a m   o n   t h e   G U I   e n v i r o n m e n t   i f   i t   b a s e d   o n   P y g a m e .   B e c a u s e   P y g a m e   i s   b a s e d   o n   P y t h o n ,   f u n c t i o n s   i n   P y g a m e   p r o j e c t   c a n   b e   e x e c u t e d   s e l e c t i v e l y ,   e v e n   a l m o s t   s i m u l t a n e o u s l y .   T h a t   i s ,   P y g a m e   i s   e v e n t - d r i v e n . 
 
 
 
 
 
 . .   i m a g e : :   i n t r o d u c t i o n - B a t t l e s h i p . p n g 
 
       : c l a s s :   i n l i n e d - r i g h t 
 
 
 
 . .   c o d e - b l o c k : :   p y t h o n 
 
       : l i n e n o s : 
 
 
 
       i m p o r t   s y s ,   p y g a m e 
 
       p y g a m e . i n i t ( ) 
 
 
 
       s i z e   =   w i d t h ,   h e i g h t   =   2 2 0 ,   1 4 0 
 
       s p e e d   =   [ 2 ,   2 ] 
 
       b l a c k   =   0 ,   0 ,   0 
 
 
 
       s c r e e n   =   p y g a m e . d i s p l a y . s e t _ m o d e ( s i z e ) 
 
 
 
       b a l l   =   p y g a m e . i m a g e . l o a d ( " i n t r o d u c t i o n - B a t t l e s h i p . p n g " ) 
 
       b a l l r e c t   =   b a l l . g e t _ r e c t ( ) 
 
 
 
       w h i l e   1 : 
 
               f o r   e v e n t   i n   p y g a m e . e v e n t . g e t ( ) : 
 
                       i f   e v e n t . t y p e   = =   p y g a m e . Q U I T :   s y s . e x i t ( ) 
 
 
 
               b a l l r e c t   =   b a l l r e c t . m o v e ( s p e e d ) 
 
               i f   b a l l r e c t . l e f t   <   0   o r   b a l l r e c t . r i g h t   >   w i d t h : 
 
                       s p e e d [ 0 ]   =   - s p e e d [ 0 ] 
 
               i f   b a l l r e c t . t o p   <   0   o r   b a l l r e c t . b o t t o m   >   h e i g h t : 
 
                       s p e e d [ 1 ]   =   - s p e e d [ 1 ] 
 
 
 
               s c r e e n . f i l l ( b l a c k ) 
 
               s c r e e n . b l i t ( b a l l ,   b a l l r e c t ) 
 
               p y g a m e . d i s p l a y . f l i p ( ) 
 
 
 
 ( E x a m p l e   o f   P y g a m e   -   B a t t l e s h i p ) 
 
 
 
 S o ,   P y g a m e   h a s   b o t h   g o o d   p o i n t   o f   c o n s o l e   e n v i r o n m e n t   ( e x a m p l e   o f   l o w - l e v e l   g a m e   m a k e r )   a n d   g a m e   e n g i n e   ( e x a m p l e   o f   h i g h - l e v e l   g a m e   m a k e r ) .   P y g a m e   i s   g o o d   * * i n t e r s e c t i o n * *   b e t w e e n   c o n s o l e   e n v i r o n m e n t   t o   g a m e   e n g i n e .   T h a t  s   e n o u g h   t o   u s e   P y g a m e .   N o   n e e d   t o   m a s t e r   i t   ( i f   y o u r   d r e a m   i s   o n e - m a n   g a m e   d e v e l o p e r   i n   a d v a n c e d   g a m e   e n g i n e ,   s t a r t   t o   l e a r n   a b o u t   t h a t   g a m e   e n g i n e   r i g h t   n o w ! ) ,   b u t   a t   l e a s t ,   t r y   P y g a m e .   ( i f   y o u   a r e   i n t e r e s t e d   i n   a n y   k i n d   o f   u n i q u e   p r o g r a m   i n c l u d i n g   g a m e   m a k e r   o r   i f   y o u   w a n t   t o   c o d e   a n y   g a m e   o n   a d v a n c e d   e n v i r o n m e n t   a s i d e   f r o m   c o n s o l e   e n v i r o n m e n t ) 
 
 