Learning to code
Moderators: Public Relations Department, Players Department
- DylPickle
- Posts: 1224
- Joined: Sun Aug 15, 2004 6:01 pm
- Location: Canada
Learning to code
With this semester coming to a close and my schedule gradually clearing up, I've been thinking about trying to learn how to do a little coding as a hobby.
Does anyone have some advice on which type of language I should consider looking into to make little games for my own amusement?
Does anyone have some advice on which type of language I should consider looking into to make little games for my own amusement?
- SekoETC
- Posts: 15525
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
Re: Learning to code
I'd recommend Flash with actionscript but some might argue that's not real coding. I found it easy because it has very good help topics with examples and you can easily test things visually. The downside is it costs a ton to get it legally, but it can be torrented.
I'm not sure how easy it would be to learn php without taking a class and I don't know how to do visual stuff with that, only text-based. Also you'd need a server that supports it in order to test your code, although you can install xampp to run websites from your own computer, but it was a total bitch to setup and I couldn't have figured it out without Echoman's help.
One option would be javascript - that can be tested in a regular browser, and "coding" generally consists of googling for someone else's script, copying it and possibly modifying it for your own purposes. I haven't tried it myself in ages since somehow it seems difficult to remember the rules and then it's hard to figure out where I went wrong.
I'm not sure how easy it would be to learn php without taking a class and I don't know how to do visual stuff with that, only text-based. Also you'd need a server that supports it in order to test your code, although you can install xampp to run websites from your own computer, but it was a total bitch to setup and I couldn't have figured it out without Echoman's help.
One option would be javascript - that can be tested in a regular browser, and "coding" generally consists of googling for someone else's script, copying it and possibly modifying it for your own purposes. I haven't tried it myself in ages since somehow it seems difficult to remember the rules and then it's hard to figure out where I went wrong.
Not-so-sad panda
-
- Posts: 86
- Joined: Sat Jan 16, 2010 11:11 pm
- Location: Near Ottawa, Canada
Re: Learning to code
If you are looking at 2D or basic 3D (or not so basic) and are working on Windows, I suggest XNA (C#). It's reasonably easy to learn and there are a lot of good resources around for it.
- joo
- Posts: 5021
- Joined: Fri Jun 17, 2005 2:26 pm
- Location: London, UK
Re: Learning to code
Python.
Every other language suggested so far (with the possible exception of C#) will cause you more trouble than necessary.
Every other language suggested so far (with the possible exception of C#) will cause you more trouble than necessary.
- gejyspa
- Posts: 1397
- Joined: Fri May 14, 2010 2:32 pm
Re: Learning to code
I would suggest APL, LISP, or MUMPS, my three favorite languages. But then, I'm weird.
Two extremely obfuscatory functions to write out the string "LOL" in APL (your browser may not show all the characters correctly):
⎕AV[¯1+((⎕AV='A')/⍳256)+3×3+(3⍴10)⊤11*2]
or
⎕AV[¯1+((⎕AV='A')/⍳256)+3×3+2-2|⍳3]
Proper way to do it:
'LOL'
Two extremely obfuscatory functions to write out the string "LOL" in APL (your browser may not show all the characters correctly):
⎕AV[¯1+((⎕AV='A')/⍳256)+3×3+(3⍴10)⊤11*2]
or
⎕AV[¯1+((⎕AV='A')/⍳256)+3×3+2-2|⍳3]
Proper way to do it:
'LOL'
- Armulus Satchula
- Posts: 1244
- Joined: Wed Oct 29, 2003 3:57 am
Re: Learning to code
I would pick Python or PHP. Both have a lot of information online and you can pretty quickly find answers to any of the questions you have. Both are pretty simple to learn. Admittedly, I find Python development on linux to be a lot easier than on windows. For PHP you can set up a WAMP which basically installs everything need or you could spend 5 bucks a month to get a small hosted server. I'd probably install GEdit for Windows to get syntax highlighting if you were to do PHP or Python.
C# is not a bad option. Microsoft Visual Studio is a great tool. C# is also one of the most popular languages in professional development. Thus, if you find that you really like programming, there are plenty of job options. (I do C# for a living) As C# is a microsoft language, don't expect this to work outside of windows. You'll be able to create applications and websites plus microsoft does provide the XNA library for xbox 360 development. If you have an xbox 360 and time to read a lot of online tutorials or money to purchases an XNA development book, then you may find this to be a way to write code that is fun enough to keep your interest. You'll learn a lot about programming writing a video game.
Either way, I would stick to a language that is more popular now. If you truly end up liking programming and dig deeper into it, you'll pretty much be able to switch to any language you like. In time you'll learn what language meets your persona best.
C# is not a bad option. Microsoft Visual Studio is a great tool. C# is also one of the most popular languages in professional development. Thus, if you find that you really like programming, there are plenty of job options. (I do C# for a living) As C# is a microsoft language, don't expect this to work outside of windows. You'll be able to create applications and websites plus microsoft does provide the XNA library for xbox 360 development. If you have an xbox 360 and time to read a lot of online tutorials or money to purchases an XNA development book, then you may find this to be a way to write code that is fun enough to keep your interest. You'll learn a lot about programming writing a video game.
Either way, I would stick to a language that is more popular now. If you truly end up liking programming and dig deeper into it, you'll pretty much be able to switch to any language you like. In time you'll learn what language meets your persona best.
- psychowico
- Posts: 1732
- Joined: Wed Mar 02, 2011 9:57 am
- Contact:
Re: Learning to code
Yeah, if you like wrote some simple classic 2D/3D games and you not have experience with programming I recommend you C# + XNA. Their have best IDE like Armulus said. I wrote some games in this in 48h write game competition and it not give me any big problems.
If you think about some browser game like Cantr you should use PHP I think. Maybe ASP.NET if you want have cleaner, nicer code.
If you want do some mixes - classic 2D/3D in game browser I recommend Unity3D engine - it give you way to do many things without coding - and all others you can code using C#/JavaScript. But I think it isn't best choose for learning begin - because you will bypass many basic things that you should know about game programming.
Oh, I really advise against LISP and some like it.. Reallly
If you think about some browser game like Cantr you should use PHP I think. Maybe ASP.NET if you want have cleaner, nicer code.
If you want do some mixes - classic 2D/3D in game browser I recommend Unity3D engine - it give you way to do many things without coding - and all others you can code using C#/JavaScript. But I think it isn't best choose for learning begin - because you will bypass many basic things that you should know about game programming.
Oh, I really advise against LISP and some like it.. Reallly

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
https://www.kinkykitty.pl
https://www.kinkykitty.pl
- EchoMan
- Posts: 7768
- Joined: Fri Aug 26, 2005 1:01 pm
- Location: Stockholm, Sweden
Re: Learning to code
This is (a bit out of topic and) an actual working flight simulator written in C :
it can be compiled with (on a *(u|i)x system, after naming the code banks.c):
Code: Select all
#include <math.h>
#include <sys/time.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
double L ,o ,P
,_=dt,T,Z,D=1,d,
s[999],E,h= 8,I,
J,K,w[999],M,m,O
,n[999],j=33e-3,i=
1E3,r,t, u,v ,W,S=
74.5,l=221,X=7.26,
a,B,A=32.2,c, F,H;
int N,q, C, y,p,U;
Window z; char f[52]
; GC k; main(){ Display*e=
XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0))
; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400,
0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6}
; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B=
sin(j); a=B*T*D-E*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E
*T*B,E*d/K *B+v+B/K*F*D)*_; p<y; ){ T=p[s]+i; E=c-p[w]; D=n[p]-L; K=D*m-B*T-H*E; if(p [n]+w[ p]+p[s
]== 0|K <fabs(W=T*r-I*E +D*P) |fabs(D=t *D+Z *T-a *E)> K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K
*D; N-1E4&& XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M;
XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){
XEvent z; XNextEvent(e ,&z);
++*((N=XLookupKeysym
(&z.xkey,0))-IT?
N-LT? UP-N?& E:&
J:& u: &h); --*(
DN -N? N-DT ?N==
RT?&u: & W:&h:&J
); } m=15*F/l;
c+=(I=M/ l,l*H
+I*M+a*X)*_; H
=A*r+v*X-F*l+(
E=.1+X*4.9/l,t
=T*m/32-I*T/24
)/S; K=F*M+(
h* 1e4/l-(T+
E*5*T*E)/3e2
)/S-X*d-B*A;
a=2.63 /l*d;
X+=( d*l-T/S
*(.19*E +a
*.64+J/1e3
)-M* v +A*
Z)*_; l +=
K *_; W=d;
sprintf(f,
"%5d %3d"
"%7d",p =l
/1.7,(C=9E3+
O*57.3)%0550,(int)i); d+=T*(.45-14/l*
X-a*130-J* .14)*_/125e2+F*_*v; P=(T*(47
*I-m* 52+E*94 *D-t*.38+u*.21*E) /1e2+W*
179*v)/2312; select(p=0,0,0,0,&G); v-=(
W*F-T*(.63*m-I*.086+m*E*19-D*25-.11*u
)/107e2)*_; D=cos(o); E=sin(o); } }
it can be compiled with (on a *(u|i)x system, after naming the code banks.c):
Code: Select all
cc banks.c -o banks -DIT=XK_Page_Up -DDT=XK_Page_Down \
-DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
-DCS=XK_Return -Ddt=0.02 -lm -lX11 -L/usr/X11R6/lib
- MelloYell
- Posts: 598
- Joined: Fri Sep 03, 2010 7:16 pm
Re: Learning to code
so random, but coding is foreign to me and that just looks like an airplane to me. 

- EchoMan
- Posts: 7768
- Joined: Fri Aug 26, 2005 1:01 pm
- Location: Stockholm, Sweden
Re: Learning to code
Thatis the point of obfuscation. The code should be impossible to read (and sometimes contain a pun). My post was more or less a reply to gejyspa's post.
-
- Posts: 87
- Joined: Tue Dec 06, 2011 5:54 pm
Re: Learning to code
On a similar note, I've always liked this one. It calculates n! (factorial) and is also in C.
Many others here: http://www.ioccc.org/years-spoiler.html
Code: Select all
#include <stdio.h>
#define l11l 0xFFFF
#define ll1 for
#define ll111 if
#define l1l1 unsigned
#define l111 struct
#define lll11 short
#define ll11l long
#define ll1ll putchar
#define l1l1l(l) l=malloc(sizeof(l111 llll1));l->lll1l=1-1;l->ll1l1=1-1;
#define l1ll1 *lllll++=l1ll%10000;l1ll/=10000;
#define l1lll ll111(!l1->lll1l){l1l1l(l1->lll1l);l1->lll1l->ll1l1=l1;}\
lllll=(l1=l1->lll1l)->lll;ll=1-1;
#define llll 1000
l111 llll1 {
l111 llll1 *
lll1l,*ll1l1 ;l1l1 lll11 lll [
llll];};main (){l111 llll1 *ll11,*l1l,*
l1, *ll1l, * malloc ( ) ; l1l1 ll11l l1ll ;
ll11l l11,ll ,l;l1l1 lll11 *lll1,* lllll; ll1(l
=1-1 ;l< 14; ll1ll("\t\"8)>l\"9!.)>vl" [l]^'L'),++l
);scanf("%d",&l);l1l1l(l1l) l1l1l(ll11 ) (l1=l1l)->
lll[l1l->lll[1-1] =1]=l11l;ll1(l11 =1+1;l11<=l;
++l11){l1=ll11; lll1 = (ll1l=( ll11=l1l))->
lll; lllll =( l1l=l1)->lll; ll=(l1ll=1-1
);ll1(;ll1l-> lll1l||l11l!= *lll1;){l1ll
+=l11**lll1++ ;l1ll1 ll111 (++ll>llll){
l1lll lll1=( ll1l =ll1l-> lll1l)->lll;
}}ll1(;l1ll; ){l1ll1 ll111 (++ll>=llll)
{ l1lll} } * lllll=l11l;}
ll1(l=(ll=1- 1);(l<llll)&&
(l1->lll[ l] !=l11l);++l); ll1 (;l1;l1=
l1->ll1l1,l= llll){ll1(--l ;l>=1-1;--l,
++ll)printf( (ll)?((ll%19) ?"%04d":(ll=
19,"\n%04d") ):"%4d",l1-> lll[l] ) ; }
ll1ll(10); }
Many others here: http://www.ioccc.org/years-spoiler.html
- MelloYell
- Posts: 598
- Joined: Fri Sep 03, 2010 7:16 pm
Re: Learning to code
they actually look like that when you code them? or do you make them look like that? (similar to that one type of poetry whose name alludes me at the moment...)
-
- Posts: 87
- Joined: Tue Dec 06, 2011 5:54 pm
Re: Learning to code
It's made to look like that. It is very hard to actually understand what it is doing written like that. As Echoman said, that's the point of obfuscation.
- MelloYell
- Posts: 598
- Joined: Fri Sep 03, 2010 7:16 pm
Re: Learning to code
oh.....okay! *runs off to feel silly somewhere else* 

- gejyspa
- Posts: 1397
- Joined: Fri May 14, 2010 2:32 pm
Re: Learning to code
And now.. even sillier APL code. The following prints HELLO WORLD
(((2+3*2)⍴2)⊤(5×(¯1+2*5)×1+3×4))\⎕AV[¯1+(⎕AV⍳'A')+,2⌽(3×4),3⌽((2×⍳2+2)+(4⍴2*3)⊤⌊(2×5*2)+○(+/⍳2×2)*3),[.5]((2×3*2)+(4⍴¯1++/⍳5)⊤⌈(((+/⍳2*2)*5)÷!3)-2*2×3)-3*¯1+⍳2+2]
(((2+3*2)⍴2)⊤(5×(¯1+2*5)×1+3×4))\⎕AV[¯1+(⎕AV⍳'A')+,2⌽(3×4),3⌽((2×⍳2+2)+(4⍴2*3)⊤⌊(2×5*2)+○(+/⍳2×2)*3),[.5]((2×3*2)+(4⍴¯1++/⍳5)⊤⌈(((+/⍳2*2)*5)÷!3)-2*2×3)-3*¯1+⍳2+2]
Return to “Non-Cantr-Related Discussion”
Who is online
Users browsing this forum: No registered users and 1 guest