• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Requirements

Status
Not open for further replies.
Basic is: Knowledge of the programming language that you want to use

and knowledge about the different things that your program requires (i.e. each operation, principles behind it etc)...

Ex:

For the calculator, I made one using Visual Basic (vb.NET)

It's pretty easy, but you need to know how each operation is made mathematically, else you cannot come up with a calculator that has so many functions, only basic arithmetic...

As for full games, well it's far more complicated... And you'd be better off with languages like C++ or java I think...
 
Knowledge in programming is really not enough, I think...just like in WC3...I know jass/gui, but if idk the objects and how to include them in my trigger then it's pointless...

So that's what Im askin', what is needed to create such programs?, photo/video editors?, model creators?, sounds?, etc...basically everything?...

Coz I think you cant just write codes then chess graphics for example is already there...
 
Of course you need the resources too... Codes are just codes, without the proper objects/files then they wouldn't be enough to show graphics and such...

If by objects you mean the in-game objects, well they are part of knowing the programming part IMO... because if you make your own game, you'll most probably end up creating abstract representations of these objects using codes...

If its a 2D game: Photo editor, Sound editor, code editor, compiler
If it's a 3D game: Photo editor, 3D modelling software, Sound editor, code editor, compiler

then if you want to have videos, you'd need a vid editor too...

and of course, you also need skills in all of those fields...

For 2D, I think it's fine to do everything from scratch...

but for 3D, I think it's a lot easier to just use the available game development kits out there like Unity, Unreal, Cry etc...
 

fladdermasken

Off-Topic Moderator
Level 39
Joined
Dec 27, 2006
Messages
3,690
A long long time ago I wrote a pretty shitty graphical calculator and expression parser in Haskell.

Code:
module Main where

import Graphics.UI.Gtk
import Graphics.UI.Gtk.Gdk.GC
import Data.Char
import Data.Maybe
import Test.QuickCheck

{-
////////////////////////////////////////////////////////////
///////////////// __EXPRESSION PARSER__ ///////////////////
-}

data Expr = Num Double | Add Expr Expr | Mul Expr Expr | Fun Func Expr | Var
  deriving (Show, Eq)

data Func = Sin | Cos
  deriving (Show, Eq)

{-
instance Show Expr where
  show = showExpr
-}

-- Converts an expression to a string.

showExpr :: Expr -> String
showExpr (Num x)   = show x
showExpr (Add x y) = showExpr x ++ "+" ++ showExpr y
showExpr (Mul x y) = showFactor x ++ "*" ++ showFactor y
showExpr (Fun f x) = showFunc f ++ showArg x
showExpr  Var      = "x"

-- Decides whether or not to show parentheses

showFactor :: Expr -> String
showFactor (Add x y) = "(" ++ showExpr (Add x y) ++ ")"
showFactor x         =        showExpr x

showArg :: Expr -> String
showArg (Mul x y) = "(" ++ showExpr (Mul x y) ++ ")"
showArg (Add x y) = "(" ++ showExpr (Add x y) ++ ")"
showArg e         =        showExpr e

showFunc :: Func -> String
showFunc Sin = "sin "
showFunc Cos = "cos "

-- Calculates the value of an expression (evaluates).

eval :: Expr -> Double -> Double
eval (Num n)     x = n
eval (Add a b)   x = eval a x + eval b x 
eval (Mul a b)   x = eval a x * eval b x
eval  Var        x = x
eval (Fun Sin a) x = sin (eval a x)
eval (Fun Cos a) x = cos (eval a x)

type Parser a = String -> Maybe (a,String)

-- Parses a string to an expression.

readExpr :: String -> Maybe Expr
readExpr s =
  case expr (filter (/= ' ') s) of
    Just (a,"") -> Just a
    _           -> Nothing

expr, term :: Parser Expr
expr = chain term   '+' Add
term = chain factor '*' Mul

factor :: Parser Expr
factor ('x':s) = Just (Var, s)
factor ('s':'i':'n':s) =
   case factor s of
      Just (a, s1)     -> Just (Fun Sin a, s1)
      _                -> Nothing
factor ('c':'o':'s':s) =
   case factor s of
      Just (a, s1) -> Just (Fun Cos a, s1)
      _            -> Nothing
factor ('(':s) =
   case expr s of
      Just (a, ')':s1) -> Just (a, s1)
      _                -> Nothing
factor s = num s

num :: Parser Expr
num s =
  case listToMaybe (reads s :: [(Double, String)]) of
    Just (n,s') -> Just (Num n, s')
    Nothing     -> Nothing

chain :: Parser a -> Char -> (a -> a -> a) -> Parser a
chain p op f s1 =
  case p s1 of
     Just (a,s2) -> case s2 of
                      c:s3 | c == op -> case chain p op f s3 of
                                          Just (b,s4) -> Just (f a b, s4)
                                          Nothing     -> Just (a,s2)
                      _              -> Just (a,s2)
     Nothing     -> Nothing

{-
/////////////////////////////////////////////////////////////////////
///////////////// __ARBITRARY EXPRESSION GENERATOR__ ///////////////
-}

instance Arbitrary Expr where
  arbitrary = sized arbExpr

{- "t" is 4 times smaller in order to generate
tangible sin and cos expressions. -}

arbExpr :: Int -> Gen Expr
arbExpr s =
  frequency [ (1, do n <- arbitrary
                     return (Num n))
            , (s, do a <- arbExpr s'
                     b <- arbExpr s'
                     return (Add a b))
            , (s, do a <- arbExpr s'
                     b <- arbExpr s'
                     return (Mul a b))
            , (s, do a <- arbExpr t
                     return (Fun Sin a))
            , (s, do a <- arbExpr t
                     return (Fun Cos a))
            , (1, do return Var)
            ]
 where
  s' = s `div` 2
  t  = s `div` 4

{- Testing the parser by first showing, 
then reading an expression, after which it
compares it to the original expression.-}

prop_ShowReadAssoc :: Expr -> Bool
prop_ShowReadAssoc a =
  readExpr (showExpr a) == Just (assoc a)

-- Rearranges associative operators.

assoc :: Expr -> Expr
assoc (Add (Add a b) c) = assoc (Add a (Add b c))
assoc (Add a b)         = Add (assoc a) (assoc b)
assoc (Mul (Mul a b) c) = assoc (Mul a (Mul b c))
assoc (Mul a b)         = Mul (assoc a) (assoc b)
assoc (Fun Sin a)       = Fun Sin (assoc a)
assoc (Fun Cos a)       = Fun Cos (assoc a)
assoc a                 = a

{-
////////////////////////////////////////////////////////////
///////////////// __GRAPHICAL CALCULATOR__ ////////////////
-}



-- Calculates all the points of the graph in terms of pixels.

points :: Expr -> Double -> (Int, Int) -> [Point]
points exp scl (w,h) = zip [0..w] (map realToPix (map (eval exp) (map pixToReal [0..w])))
  where
    pixToReal :: Int -> Double  -- converts a pixel x-coordinate to a real x-coordinate
    pixToReal x = scl * fromIntegral (x -  w `div` 2)

    realToPix :: Double -> Int  -- converts a real y-coordinate to a pixel y-coordinate
    realToPix y = round ((-1)/scl*y) + (h `div` 2)

-- Calculates the lines that will connect the points.

linez :: Expr -> Double -> (Int, Int) -> [(Point, Point)]
linez exp scl size = linez' xs
  where (xs) = points exp scl size

linez' :: [Point] -> [(Point, Point)]
linez' []       = error "can't make line"
linez' (a:[])   = error "can't make line"
linez' (a:b:[]) = (a,b):[]
linez' (a:b:xs) = (a,b):(linez' (b:xs))

---------------------------------------------------------------------------

-- Height, width and scale of the drawing area.

sizeX, sizeY :: Int
sizeX = 300
sizeY = 300

scale :: Double
scale = 0.04

main :: IO()
main = 
  do initGUI
     
     win <- windowNew
     windowSetTitle win "Calculator"
     win `onDestroy` mainQuit

     can <- drawingAreaNew
     can `onSizeRequest` return (Requisition sizeX sizeY)

     exp <- entryNew
     entrySetText exp "(enter function here)"
     exp `onEntryActivate` drawCanvas can exp

     lay <- vBoxNew False 5
     containerAdd lay can
     containerAdd lay exp

     containerAdd win lay
     widgetShowAll win
     mainGUI

drawCanvas :: DrawingArea -> Entry -> IO ()
drawCanvas can ent =
    do dw <- widgetGetDrawWindow can
       drawWindowClear dw
       gc <- gcNew dw
       ex <- entryGetText ent
       case readExpr ex of
         Nothing     -> drawLine dw gc (0,0) (0,0)
         (Just expr) -> sequence_ [ drawLine dw gc p q | (p,q) <- 
                        linez expr scale (sizeX, sizeY) ]

Couldn't use syntax highlighting the way it's implemented here on THW because for some reason it converts (') to string so like half my code is highlighted as a string. Anyways I think I had like one month worth of experience at this point. U CAN B WHO U WANNA B! TEH ONLY DIFFRENCE BTWEEN TRI ND TRIUMPH IS UMPH!
 

fladdermasken

Off-Topic Moderator
Level 39
Joined
Dec 27, 2006
Messages
3,690
Look, don't do C++ at first. Really. It's important that you learn some fundamentals of computer science and some programming methodology which you will get easier from non-procedural languages. I could recommend Haskell personally, but Scheme, SML, Lisp are supposedly good alternatives too. I guess you could do Java too eventually but it's reeeaally really bureaucratic.

If you still want to go in this direction, at least learn C before C++.

Also,
http://harmful.cat-v.org/software/c++/linus
 
Well, simply because C++ is built upon C... basically, the main difference IMO (and per research) is that C++ has some OOP features that C doesn't have...

C++ is still procedural by nature, it just have some OOP features... Java is OOP by nature...

Current popular OOP would be VB.net (Visual Basic), Java and C#...
 
The differences between C and C++ are not limited to OOP features, you get so much more in C++:

- Proper scoping (namespaces, enum class, less reasons to use #defines that pollute the global namespace)
- Stronger typing (void* is not promoted to anything, you have strongly typed enum classes, you have static_cast, dynamic_cast and the like)
- Easier memory management (unique_ptr, shared_ptr, the less-often used weak_ptr, RAII)
- Useful standard library classes (map, vector, list, queue, priority_queue, unordered_map, set, deque, etc...)
- Value semantics and operator overloading
- Move semantics and rvalue references
- Exceptions
- ~~Templates~~, TMP is mindfucking and awesome. (Finally, you have a way of managing variadic functions without the use of shitty va_lists)
- You don't have to pass shit by pointer all the time, you can use references or references to const and be guaranteed a valid object
- You have new and delete, but you shouldn't be using them anyway~

I probably missed a few differences
 
Status
Not open for further replies.
Top