Author Topic: Language for 2D gaming to start with  (Read 6114 times)

dragomrak

  • Guest
Language for 2D gaming to start with
« on: January 28, 2016, 03:21:12 PM »
Hello,

I'd like to start a little step into gamecoding. Which language would be a good choice to make the first steps with. I use Linux. There are not much options I suppose. And BTW: should I be good in mathematics? What do I need from mathematics? It's never been one of my favourites in school.
« Last Edit: January 28, 2016, 04:02:32 PM by dragomrak »

B+

  • Guest
Re: Language for 2D gaming to start with
« Reply #1 on: January 28, 2016, 03:28:04 PM »
Hi Dragomrak,

You did nice job of turning cvs file reading into a game!

IMO learning is best game.

dragomrak

  • Guest
Re: Language for 2D gaming to start with
« Reply #2 on: January 28, 2016, 03:31:09 PM »
LOL. Good joke. My routine is not working up to now and it seems that it wont for a while. There are some more problems to solve...

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Language for 2D gaming to start with
« Reply #3 on: January 28, 2016, 04:53:58 PM »
The question is what do you want to achieve? Of course you start slowly but do you want to keep that language after you learned the basics?
What languages do you already know? Keep in mind: if you'll ask 10 people, you'll probably get 10 different answers ...

Tomaaz

  • Guest
Re: Language for 2D gaming to start with
« Reply #4 on: January 28, 2016, 04:59:22 PM »
I'd like to start a little step into gamecoding. Which language would be a good choice to make the first steps with.

The answer is rather obvious - Lua. There are several projects based on it and dedicated to 2D coding. EGSL is the best place to start (it's been replaced by Pulsar2D based on SDL2, but there is almost no documentation for Pulsar). There is also LOVE - more powerful and popular project based on Lua. Lua itself is extremely easy to start with. You can start with this tutorial - http://www.tutorialspoint.com/lua/ .
« Last Edit: January 28, 2016, 05:01:05 PM by Tomaaz »

dragomrak

  • Guest
Re: Language for 2D gaming to start with
« Reply #5 on: January 28, 2016, 05:08:42 PM »
What do I want to achieve? At first I'd like to find out, if I like gamecoding and whether I'm good enough to do that. The languages I know a bit are Basic ( Qbasic, Freebasic, JB, LB ) and Pascal ( Delphi not much ) and at the moment I look at COBOL just because I am curious, which is no option for gamecoding *grin*. Anyway. The first step is to find out, if I like gamecoding. The optimal language would be the one, which is not only good for gamecoding but for "usual" programmes as well. At first sight JB or LB look good but I do not know, whether they are good for simple games.
« Last Edit: January 28, 2016, 05:12:33 PM by dragomrak »

Tomaaz

  • Guest
Re: Language for 2D gaming to start with
« Reply #6 on: January 28, 2016, 05:12:58 PM »
The first is to find out, if I like gamecoding.

Definitely EGSL. You won't find anything easier, but you can create real 2D games with it. You can start with this : http://www.egsl.retrogamecoding.org//modules/download_gallery/dlc.php?file=72 . Have a look and you'll see how easy and cool it is. ;)

dragomrak

  • Guest
Re: Language for 2D gaming to start with
« Reply #7 on: January 28, 2016, 05:19:20 PM »
Thank you. That looks pretty easy and cool. :-)

B+

  • Guest
Re: Language for 2D gaming to start with
« Reply #8 on: January 29, 2016, 07:33:52 PM »
Hi dragomrak,

We have started a Starfleet Academy project at SdlBasic's brand spanking new site:
http://sdlbasic.epizy.com/index.php

If you played old Star Trek games, we need your help because our cadets are from all over space with knowledge of BASIC's, languages and dialects, and countries languages and dialects. The moderator uses Linux and can help with those issues or will certainly try.

I speak for myself when I say none of us know what the h, we are doing or talking about but that is half the fun!

Even if you dont know Star Trek you are invited, just dont talk about Star Wars too much ;) a joke, talk about whatever you like but desire to learn and have fun doing it!

All members here are invited.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Language for 2D gaming to start with
« Reply #9 on: January 29, 2016, 09:41:23 PM »
What do I want to achieve? At first I'd like to find out, if I like gamecoding and whether I'm good enough to do that. The languages I know a bit are Basic ( Qbasic, Freebasic, JB, LB ) and Pascal ( Delphi not much ) and at the moment I look at COBOL just because I am curious, which is no option for gamecoding *grin*. Anyway. The first step is to find out, if I like gamecoding. The optimal language would be the one, which is not only good for gamecoding but for "usual" programmes as well. At first sight JB or LB look good but I do not know, whether they are good for simple games.
You know FreeBASIC and Pascal, so why not use Pulsar2D? You can use it as a framework for both languages, although I would recommend starting with FreeBASIC. (That's because FreeBASIC comes with its own SDL2 header files.)
A small example looks like this:
Code: [Select]
' shows how to load an image and turn that into a sprite

#include once "pulsar2d.bi"

using p2d

TYPE player
x as integer
y as integer
image as p2d.sprite
END TYPE

dim win as p2d.window
dim image as p2d.image
dim grass as p2d.sprite
dim key as integer
dim knight as player

win = openwindow ("Simple Sprite Example",-1,-1,800,600)
setactivewindow (win)
setframetimer (100)

image = loadimage ("media/sprite.bmp")
knight.image = createsprite (image)
freeimage (image)

image = loadimage ("media/grass.bmp")
grass = createsprite (image)
freeimage (image)

knight.x=windowwidth/2
knight.y=windowheight/2
textsize (2)

do
key=p2d.getkey()
clearwindow()

if keystate (SDL_SCANCODE_RIGHT) then
knight.x=knight.x+1
end if
if keystate (SDL_SCANCODE_LEFT) then
knight.x=knight.x-1
end if
if keystate (SDL_SCANCODE_UP) then
knight.y=knight.y-1
end if
if keystate (SDL_SCANCODE_DOWN) then
knight.y=knight.y+1
end if

for i as integer = 0 to windowwidth() step spritewidth (grass)
for j as integer = 0 to windowheight() step spriteheight (grass)
drawsprite (grass,i,j,1,1,0,false,false)
next
next

drawsprite (knight.image,knight.x,knight.y,1,1,0,false,false)

color (255,255,255,255)
drawtext ("Cursor keys to move knight, ESC to quit",0,0)

sync()
loop until key = SDL_SCANCODE_ESCAPE
freesprite (knight.image)
freesprite (grass)
closewindow (win)
closeapplication()

dragomrak

  • Guest
Re: Language for 2D gaming to start with
« Reply #10 on: January 30, 2016, 06:30:41 AM »
Hi,

@B+
I did not play old Star Trek games, but I will look at it. I like the old serie "Enterprise" with Mr. Spock. Unfortunately I did not follow the series after that. If you need someone more, who ( the h ) is not knowing, what he's doing, I am the right one. I am so innocent concerning gamecoding as someone can be. What is the Starfleet Acaedmy?

@Cybermonkey
I like Freebasic and Pascal very much, but I did not get it up and running on my distro. Freebasic is very easy and fun to use. I'll try to install it  again. I never tried graphic programming or gamecoding, but I am interested. So I will need help to start.


It is good to hear, that I am not the only person hear, who is not a native English speaker. ;-)

Appendix: I managed to get FreeBasic running! Yeah! :-))
« Last Edit: January 30, 2016, 08:22:11 AM by dragomrak »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Language for 2D gaming to start with
« Reply #11 on: January 30, 2016, 09:21:30 AM »

@Cybermonkey
I like Freebasic and Pascal very much, but I did not get it up and running on my distro. Freebasic is very easy and fun to use. I'll try to install it  again. I never tried graphic programming or gamecoding, but I am interested. So I will need help to start.

Appendix: I managed to get FreeBasic running! Yeah! :-))
Ok, if you'd like to try Pulsar2D got to http://pulsar2d.org/ and download the source code (you'll need that for FreeBASIC).
Another thing: all FreeBASIC graphics routines won't work if you include pulsar2d.bi. That's because P2D comes with its own functions (e.g. circle etc.), so don't try to use fbc functions.
FBC has a getkey() function which I couldn't disable so use the P2D function with the prefix:
Code: [Select]
variable=p2d.getkey()The "variable" has to be declared as an integer.
Don't hesistate to ask questions about FreeBASIC and Pulsar2D in the Pulsar2D board.

B+

  • Guest
Re: Language for 2D gaming to start with
« Reply #12 on: January 30, 2016, 03:59:17 PM »
Hi dragonmrak,

Quote
@B+
I did not play old Star Trek games, but I will look at it. I like the old serie "Enterprise" with Mr. Spock. Unfortunately I did not follow the series after that. If you need someone more, who ( the h ) is not knowing, what he's doing, I am the right one. I am so innocent concerning gamecoding as someone can be. What is the Starfleet Acaedmy?

Starfleet Academy is a little project we started on SdlBasic to help get people up to speed with SdlBasic, practice gaming programming with Star Trek themes and metaphors, Starfleet in Star Trek is where people are trained to be officers for Federation space ships. Sitting at your laptop programming a game is sort of like sitting in the captains chair at the Enterprise.

I have to say you are certainly welcome at Starfleet (sdlBasic style) but I am concerned that you might try too many things and spread yourself too thin. What Cybermonkey recommends I would listen and seriously consider if I were in your position with your experience and with Linux. Here I think you would get more professional help, should you get stuck.

Tomaaz

  • Guest
Re: Language for 2D gaming to start with
« Reply #13 on: January 30, 2016, 04:45:20 PM »
SdlBasic is a better choice than Pulsar, simply because Pulsar doesn't come with a solid documentation and most likely never will. After my recent problems I must also change my opinion about EGSL. It looks like these two projects are not future proof on Linux. I'm using rolling release distro based on Debian, so I get the newest stuff (programs, libraries, kernel etc.). Pulsar and EGSL are already not working with it, while SdlBasic does. It's even in the repository (I'm pretty sure Elementary OS also has it - you need to install both sdlbasic and sdlbrt). I think SdlBasic may be the best way to go (at least on Linux). Sorry for confusing you.

ScriptBasic

  • Guest
Re: Language for 2D gaming to start with
« Reply #14 on: January 30, 2016, 08:10:40 PM »
Hi Tomaaz,

I agree with you on the SDL front but committing to it as your framework for the BASIC seems too restrictive for me. With Script BASIC SDL (gfx) is an extension module interface.

What value is there in the perfect hammer if it's never picked up and used?
« Last Edit: January 30, 2016, 09:53:05 PM by John »