11 Replies - 1077 Views - Last Post: 10 November 2016 - 02:51 PM Rate Topic: -----

#1 wad67   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-November 16

Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 11:04 AM

Been trying to get into programming for about 8 years now, have not had much success with anything other than HTML, a little javascript and Freebasic.
I have studied many tutorials, guides and various documentation for a wide range of languages over the years.
I cannot seem to develop any fluency with coding at all!

That being said, I have a deficiency with mathematics, I wouldn't know how to write a formula pertaining to practically anything.
I understands grids/graphs, bit of boolean logic, basic algebra.

Each cup of coffee nets me around 5 to 6 lines of code, most likely not working.

I am attempting to create a 2d, top down game.
Preferably with collision detection, textures and sounds.
I have made minimal progress in each area.

Below is the result of a few weeks work,
I started this in python, using the wx library and pygame, on debian.
I decided that it was rubbish and started using FREEBASIC, on windows.
Freebasic is proving to be difficult, especially with sourcing/figuring out how libraries work.
Considering starting again in Javascript, using html5 canvas.
#include "fbgfx.bi"

'I wish to display some kind of textured background, not sure how to do this
'as using the cls function to redraw is confusing
'need to put some kind of function into the main loop, to detect if the game needs to be redrawn
' then do so

Using FB
ScreenRes 640, 480, 32
Dim as integer mx, my, mwheel, mbuttons
Dim As Integer x, y
main:

DO 
    cls
    'update variables with data from the mouse
    GETMOUSE mx, my, mwheel, mbuttons
    'load the main menu, which is just a bmp
    BLoad "main.bmp"
    print mx, my, mwheel, mbuttons
    'bit of code to spit out where we just clicked the mouse
    'no matter how much I mess around with it, I cannot get it to append to the file
    if mbuttons = 1 then
        open "debug.txt" For Output as #1
        print #1, mx, my, mwheel, mbuttons,;
        Close #1
    END IF
    'continue to game, if mouse is in the correct region of the screen and the mousebutton is down
    if mx > 193 and my > 187 and mbuttons = 1 and mx < 424 and my < 259 then
        open "debug.txt" For Output as #1
        print #1, "we clicked something",;
        Close #1
        'this is the only sound effect I can manage, sound libraries don't make sense
        beep
        goto startgame:
    END IF
    'as above, except quit
    if mx > 193 and my > 279 and mbuttons = 1 and mx < 424 and my < 358 then
        open "debug.txt" For Output as #1
        print #1, "we quit",;
        Close #1
        beep
        goto quit
    END IF
    sleep 60
   


  
LOOP

startgame:
'todo, finish all of the game init functions, finish actual game, etc
'at least there is keyboard input I suppose
cls
print "You have reached the end of the demo, have a nice day.  "  
sleep 2000
'the rest of the code past this point is just examplecode
Do
    'this bit of code actually manages to move something around the screen
    'no idea how to implement a level with colisions 
    ' Check arrow keys and update the (x, y) position accordingly
    If MultiKey(SC_LEFT ) And x >   0 Then x = x - 1.5
    If MultiKey(SC_RIGHT) And x < 639 Then x = x + 1.5
    If MultiKey(SC_UP   ) And y >   0 Then y = y - 1.5
    If MultiKey(SC_DOWN ) And y < 479 Then y = y + 1.5
    
    ' Lock the page while we work on it
    ScreenLock
        ' Clear the screen and draw a circle at the position (x, y)
        Cls
        Circle(x + 15, y), 30, , , , ,F
        draw string (x,y), "0__0", 232
        
    ScreenUnlock
    
    Sleep 15, 1
    
    ' Run loop until user presses Escape
Loop Until MultiKey(SC_ESCAPE)
While Inkey <> "": Wend
quit:



I have a friend who is keen to try his hand at development, he works mainly with python. Started roughly 6 months ago and has already surpassed my level of skill.

I'm guessing the best answer would be to just give up and pursue other avenues.
Failing that, what would be the best course of action?

Is This A Good Question/Topic? 0
  • +

Replies To: Working on a game in freebasic, having difficulty.

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15567
  • View blog
  • Posts: 62,327
  • Joined: 12-June 08

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 11:08 AM

Why would you use FREEBASIC? It's not a good or fun platform.

What was wrong with python?

Even VB.NET provides a substantially better option.
http://www.dreaminco...-basics-part-1/

Quote

Failing that, what would be the best course of action?

Chiefly - don't use FREEBASIC. Use something more modern.
Was This Post Helpful? 0
  • +
  • -

#3 wad67   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-November 16

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 11:22 AM

View Postmodi123_1, on 10 November 2016 - 11:08 AM, said:

Why would you use FREEBASIC? It's not a good or fun platform.

What was wrong with python?

Even VB.NET provides a substantially better option.
http://www.dreaminco...-basics-part-1/

Quote

Failing that, what would be the best course of action?

Chiefly - don't use FREEBASIC. Use something more modern.


I understand that freebasic is outdated,
that being said I can actually understand most of the syntax for it
And it's fun for me, as code tends to work most of the time

I have tried my hand with visual basic, I tend to struggle with anything that is rather object orientated.
Plus, I don't really like the big, flashy IDEs.
I have a way with crashing them.

Couldn't really achieve anything in python, other than a window with some text on it.
Or a window with an image in it, but not both.
I made a few console applications, mainly a simple calculator.
I tried a few different libraries, pyglet, pygame. A few different window libraries too.
Simply could not make much progress. A problem I have had with virtually any language.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15567
  • View blog
  • Posts: 62,327
  • Joined: 12-June 08

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 12:09 PM

Quote

Simply could not make much progress. A problem I have had with virtually any language.

Well that's a bummer. You could always pick up a book on a language and start working through it.
Was This Post Helpful? 0
  • +
  • -

#5 wad67   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-November 16

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 12:37 PM

View Postmodi123_1, on 10 November 2016 - 12:09 PM, said:

Quote

Simply could not make much progress. A problem I have had with virtually any language.

Well that's a bummer. You could always pick up a book on a language and start working through it.


I have done this with some outdated books I found, One was a HTML 3? Handbook.
In addition to that I have a QBASIC book somewhere.

I have worked my way through a lot of online courses, see: code academy

The biggest thing I struggle with is retention of information, I struggle to recall even the simplest of syntax.
When I start on something, I generally have a browser running on my other monitor, it fills up full of new tabs quite quickly.

I have a C/C++ environment set up on my linux installation, The best I can manage with that is cin, cout and a few other simple statements, Basic conditionals and program control.

It's almost as if I have the inability to apply my knowledge in such a way that I can write code, difficult to explain. Equivalent to writer's block I suppose.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15567
  • View blog
  • Posts: 62,327
  • Joined: 12-June 08

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 01:04 PM

That's certainly a handicap in writing code. How do you do your design work? Do you sit down a head of time to break down functionality, functions, user interactions, data needed, display states, etc?
Was This Post Helpful? 0
  • +
  • -

#7 wad67   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-November 16

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 01:15 PM

View Postmodi123_1, on 10 November 2016 - 01:04 PM, said:

That's certainly a handicap in writing code. How do you do your design work? Do you sit down a head of time to break down functionality, functions, user interactions, data needed, display states, etc?


I generally just write down the premise for what I wish to make, when I was in highschool, a teacher told me how to draw up a pseudo- code table([Input],[Function],[Output]) but that's about it.

I can outline the general game features, and what I expect the code to do.
But beyond that, I would not have a clue as to how to continue.

I'm fairly artistically inclined, so I usually have my idea portrayed in a variety of media types.
I do a fair bit of mocking up Ui's and such in paint.
Scene sketches in paint, sometimes a drawing of my computer, with the program or game running.


My failing point is that I cannot produce the code in order to make these ideas a reality.
Or rather, I cannot create code pertaining to my ideas.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15567
  • View blog
  • Posts: 62,327
  • Joined: 12-June 08

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 01:25 PM

I do less pseudo code, but more a design doc. How the character should move, environment, user interaction, etc.. then start thinking about what I want to track.. Example - does the player have a health value, attack value, movement direction, current location, an inventory, etc.. and that would help direct classes to make and data to shuffle.

Quote

so I usually have my idea portrayed in a variety of media types.

I'm not sure if I follow. Like cut outs from a magazine, photographs, and collage sort of things?

Quote

I do a fair bit of mocking up Ui's and such in paint.

Paint? MS Paint? Not Paint.NET or something else?

Quote

Or rather, I cannot create code pertaining to my ideas.

It's a learning process for sure. Though if it's not up your alley it may worth hiring someone, or get a collaboration on.
Was This Post Helpful? 0
  • +
  • -

#9 wad67   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-November 16

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 01:54 PM

I tend to do a fair bit of creative writing, storyboarding and various graphics.
MS paint is fine for this, although I do typically use Paint.net or Inkscape
On occasion I also do some minor sounds, soundtracks.

Similar to something like game-maker, I like to create my assets before I use them.

I have dealt with the good learning cliff often enough, Ie. Dwarf Fortress.
Programming is something I have always wanted to get into, from an early age.
I recall writing mods for minor games in my youth, Namely stranded 2 and a few old falling sand clones.

Majority of my skills revolve around the use of computers, programming would be nice to have.
I have a few projects on github, never been able to do much though.

This post has been edited by andrewsw: 10 November 2016 - 02:57 PM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15567
  • View blog
  • Posts: 62,327
  • Joined: 12-June 08

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 02:13 PM

Wow.. that neocities site is.. something.
Was This Post Helpful? 0
  • +
  • -

#11 wad67   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-November 16

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 02:42 PM

View Postmodi123_1, on 10 November 2016 - 02:13 PM, said:

Wow.. that neocities site is.. something.

Thanks, put my heart and soul into that bastard
Was This Post Helpful? 0
  • +
  • -

#12 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15567
  • View blog
  • Posts: 62,327
  • Joined: 12-June 08

Re: Working on a game in freebasic, having difficulty.

Posted 10 November 2016 - 02:51 PM

Then I'll refrain from making a comment on the depth and quality of your heart/soul. ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1