Jump to content
Karrgoot

How hard is it to learn basic and acembly?

Recommended Posts

I have an itch, to program an text based game.

And the game is originaly a pen and papper game, and the rule system it is played in, is called Basic rollplay system. 

I wana maintain the way you play the game in the sens you throw dices but make the program do it for you oviusly. But how hard is it to program.

I need to program rooms, containers, items, npc, stats, skills, initiativ, etc.

I what to have dialog options and a ask funktion where the player can ask the npc about things like you could in fallout 1 and 2. 

No grafics, no sound and no hand holding.

 

Am i barking at the wrong tree och is this be dune?

 

SP: i am dyslektit and english is not my nativ toung. I hope you can read may shity fone typing 

 

 

Share this post


Link to post
Share on other sites

It's not difficult, but if you've never programmed before, don't start on something too complicated, build up to it. We all start of with PRINT "HELLO WORLD" or similar 🙂

There are many BASIC tutorials available for computers like the X16 - Vic20, Spectrum, C64, BBC Micro and so on. Have a look and find one that appeals to you (I've been told the Vic one is good) and try it on an emulator.

What you learn will translate fairly well to the X16.

One issue with dyslexia is that computers are fussy about spelling. For example, many of them are American and use COLOR rather than COLOUR which always drove me mad. So you will have to be careful when using instructions that you spell them correctly. (This may actually help you with your spelling in general, though dyslexia is not my field)

  • Thanks 1

Share this post


Link to post
Share on other sites

As Paul said, if you are new to programming, start with simple problems. Even though you intend to not use graphics, your project sounds like ambitious to me. When I started with the Commander X16 emulator, I started with BASIC, even though I intended to transition to machine language pretty quickly. It just gives me a feeling about how the machine works, and gives me some confidence with it. I started by implementing a couple of successively complex toy projects. From "hello world" to more challenging tasks I found interesting. For you, this could be to write a simple question and answer program. Like "How many apples do you want to buy? Enter a number" ... "Ok, you want 10 apples". "You don't have enough money".

You will have a lot of text ("string") processing in your program. This will be challenging to do in machine language. Therefore I would recommend taking your first steps with BASIC, because I think that it provides a bunch of convenient string operations you can use out of the box. If you hit the limits of BASIC programming, you can transition to machine language later.

 

To get started with BASIC, I recommend looking at this page. The Commander X16 can do everything the C64 could do in BASIC and works pretty much the same way. https://www.c64-wiki.com/wiki/BASIC

For more advanced BASIC tutorials, one place to look at would be Dusan Strakls really nice website: https://www.8bitcoding.com/p/commander-x16.html

Edited by kliepatsch
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thax paulscottrobson and kliepatsch.

Jay, it is a big plan and I have to bild my confidence and my programig skills b4 i can attempt it. 

There will be Babe steps.

  • Like 2

Share this post


Link to post
Share on other sites
36 minutes ago, Karrgoot said:

Can you program a game engine in basic or asembly?

A game engine would not work very well written in BASIC. It's already an interpreted language, and adding another layer of interpretation would be too much for the X16.

I made an adventure game engine for the X16 in assembly: https://github.com/SlithyMatt/x16-xci

That's another option if you don't want to try learning BASIC or Assembly, and I'm sure other engines will arrive for different types of games that use a similar application-specific language for writing a game

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
13 minutes ago, SlithyMatt said:

A game engine would not work very well written in BASIC. It's already an interpreted language, and adding another layer of interpretation would be too much for the X16.

I made an adventure game engine for the X16 in assembly: https://github.com/SlithyMatt/x16-xci

That's another option if you don't want to try learning BASIC or Assembly, and I'm sure other engines will arrive for different types of games that use a similar application-specific language for writing a game

wow so it is possible to do it in assembly, can you have different stats, skills, inventory, equipment and other stuff that are important to have in in a pen and paper roleplaying game!

Share this post


Link to post
Share on other sites
10 hours ago, Karrgoot said:

wow so it is possible to do it in assembly, can you have different stats, skills, inventory, equipment and other stuff that are important to have in in a pen and paper roleplaying game!

Absolutely. It's not easy, but completely doable. The X16 is significantly more powerful than a C64 or NES, and those types of games were commonplace. I am working on a series of tutorial videos to teach people how to program in assembly language for the X16. It does assume you have some experience with programming in at least a high-level language before.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
23 hours ago, SlithyMatt said:

A game engine would not work very well written in BASIC. It's already an interpreted language, and adding another layer of interpretation would be too much for the X16.

Note that a Basic compiler would allow for a development approach of working with integrated Basic for "rapid application development" prototyping, even if essentially "in slow motion", while compiling the most effective solutions allows it to respond "at full speed". However, early Basics were not natively equipped with the most effective information management keywords for managing the information needs of a typical adventure game, and implementing those IN Basic would further increase the overheads of working in Basic.

In between Basic and Assembly, both C and Forth offer opportunities for more rapid development than working in straight assembly, with more efficient execution than allowed by a Basic interpreter. However, they are substantially different programming approaches, so there really isn't a "one size fits all" solution in the space in between Basic and Assembly ... its likely different types of people who enjoy C programming and Forth programming.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 2/14/2021 at 12:51 AM, SlithyMatt said:

A game engine would not work very well written in BASIC. It's already an interpreted language, and adding another layer of interpretation would be too much for the X16.

I get where Matt's coming from, but I disagree in this case. I think you can make an 'engine' for the kind of game you describe, right in BASIC, without really adding another 'layer' of interpretation or slowing things down too much. (Keep in mind, speed doesn't matter much for a text-based game like this.)

In BASIC, your 'engine' would be a bunch of subroutines that handle the common tasks of your roleplay system.  For example, if your game has combat, you might have some subroutines that handle what happens when a player attempts to attack an enemy.  One for handling how the player selects what kind of attack to do, another for handling how the player selects which enemy to target, another that resolves the attack and assigns damage, etc.  Other subroutines might handle buying from a shop, equipping armor and changing the player's stats accordingly, branching with dialogue trees, navigating from room to room, etc.

Then when you go to write a new chapter of the game, you re-use all those same subroutines, but have new enemies, equipment, room descriptions, etc. Admittedly this may not be what's typically meant by an 'engine'.  But it would be a set of tools that you could use over and over to make new games in this genre.

Of course, this is exactly how you would do it in Assembly as well, but BASIC will be easier to learn as a programming language.  The downside to BASIC is that it will always run more slowly compared to Assembly, but for a text-based game like you describe, speed really won't really matter.  Speed starts to matter when you want to have graphical gameplay.

  • Thanks 1

Share this post


Link to post
Share on other sites

I guess I missed the part where it was strictly text-based. If you don't need to have graphics or responsive gameplay, sure you could do it in BASIC. Just be aware that it is difficult to scale and maintain a large BASIC program, especially when you are required to use line numbers and need to use 2-character variable names and unnamed subroutines. BASIC may be easier to learn at first, but it is anything but an easy platform for significant development.

 

 

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 2/14/2021 at 5:32 PM, SlithyMatt said:

It does assume you have some experience with programming in at least a high-level language before.

Thax, but i have not done eny programming realy, i played around whit a cracked rpg maker in the mid 90's and made a game, every action had to do with a sex act, every weapon was a sex toy, the goal was to cum the hardest and the enemy's wer a variation of fatt pigs in different color. 

Not high-level programming, but thax 🙂 you ment well.

Share this post


Link to post
Share on other sites

For a text adventure, I'd definitely go with BASIC on the X16.  It should be plenty fast.  There were plenty of text adventures written for Commodore systems in BASIC and those were only 1 Mhz.  BASIC is certainly a lot better for dealing with strings.

  • Like 5

Share this post


Link to post
Share on other sites

As I was hoping to 're-learn' BASIC not too long ago, I was planning on porting one of those old 'book games' into BASIC. Actually began doing that in an old Apple II emulator, since it was the computer I learned BASIC on, but now I'm more or less inclined to do it in the X16's emulator and see what happens. I have never even seen a real C64 in my life, let alone programmed in one. Is there any place where I can check the differences between Applesoft's and X16's/Commodore's BASIC? Or... is there any practical difference? Sorry for the newbness, but we gotta start somewhere 😛

Share this post


Link to post
Share on other sites

Although I have never used an Apple II, one significant difference that I am aware of is that Commodore BASIC lacks most commands for controlling the screen (no VTAB, HTAB, etc.). Instead, many aspects of the screen are controlled by printing special control characters. If you have never used a Commodore computer before, you may want to find an online version of the C64 manual to learn how exactly this works (I believe it is discussed in chapter 4). Anything that could not be controlled using these special characters would be done via POKE statements. Luckily, the Commander X16 has added commands to control several things that used to require POKE statements (a list of new commands can be found here).

Share this post


Link to post
Share on other sites
11 minutes ago, Elektron72 said:

Although I have never used an Apple II, one significant difference that I am aware of is that Commodore BASIC lacks most commands for controlling the screen (no VTAB, HTAB, etc.). Instead, many aspects of the screen are controlled by printing special control characters. If you have never used a Commodore computer before, you may want to find an online version of the C64 manual to learn how exactly this works (I believe it is discussed in chapter 4). Anything that could not be controlled using these special characters would be done via POKE statements. Luckily, the Commander X16 has added commands to control several things that used to require POKE statements (a list of new commands can be found here).

There's a KERNAL function called PLOT that allows someone to either get, or set, the current cursor position (depending on whether or not the carry bit is set in the status register), and it's not all that difficult to call it from BASIC.

When you invoke the 'SYS' command in BASIC, the registers are loaded with the contents of locations 780 through 783 ($30C through $30F) for the accumulator, X and Y index registers, and status register, respectively. So any KERNAL routine that needs arguments or returns results uses the values in those addresses when you SYS to the function's jump table entry point. When the function returns, those addresses will contain the return values.

POKE 781,RO:POKE 782,CL:POKE 783,0:SYS $FFF0

The above takes RO for row and CL for column and clears the carry bit, before calling PLOT to set the cursor position.

POKE 783,1:SYS $FFF0:RO=PEEK(781):CL=PEEK(782)

The above puts the current cursor position into the variables RO and CL.

(Do note that the X16's version of this function uses X for row and Y for column, while other computers using the Commodore KERNAL use X for column and Y for row, so any online documentation resources you find for those computers may be confusing if you don't take this into account.)

Share this post


Link to post
Share on other sites

If you're looking to write a text adventure engine in BASIC, let's talk more. Go ahead and open a dedicated forum topic. I have some ideas, as I was thinking of doing something similar.  What you don't want to do is try to write the game as a series of IF/THEN statements. Instead, it needs to be a data engine, with the data itself composing the game design and logic. 

I actually wrote a simple prototype a couple of years ago that stored the map in DATA statements, but now that we have access to the file system, it would be easy to rebuild that to use random access disk files for the game data. 

Your Rooms file, for example, would have a description of each room, along with the exits and a list of items contained in the room. It might also have some simple flags to create a rules engine, so you can (for example) require a specific Item to unlock a door, or have performed an action somewhere else to make an item visible. 

An Actors file might contain information about the enemies, NPCs, and interactive objects in the game. 

A Conversation file would contain the conversation tree, which would be part of all of your interaction with NPCs. 

... and so on. 

 

  • Like 1

Share this post


Link to post
Share on other sites
On 2/11/2021 at 3:46 AM, Karrgoot said:

And the game is originaly a pen and papper game, and the rule system it is played in, is called Basic rollplay system. 

I wana maintain the way you play the game in the sens you throw dices but make the program do it for you oviusly. But how hard is it to program.

Here is a book on writing RPGs in BASIC, it includes code for VIC-20 and C64 so should be suitable for the X16.

Write_Your_Own_Fantasy_Games_For_Your_Microcomputer.pdf

  • Like 2

Share this post


Link to post
Share on other sites
On 3/5/2021 at 8:39 PM, Nero said:

As I was hoping to 're-learn' BASIC not too long ago, I was planning on porting one of those old 'book games' into BASIC. Actually began doing that in an old Apple II emulator, since it was the computer I learned BASIC on, but now I'm more or less inclined to do it in the X16's emulator and see what happens. I have never even seen a real C64 in my life, let alone programmed in one. Is there any place where I can check the differences between Applesoft's and X16's/Commodore's BASIC? Or... is there any practical difference? Sorry for the newbness, but we gotta start somewhere 😛

In VIC20, C64, and X16 BASIC the AND, OR, and NOT operators are bitwise, but in Applesoft they are logical/boolean. 3=3 is -1 in X16 etc., but 1 in Applesoft. STR$(7) has an extra space for sign in X16 etc., but not in Applesoft. Applesoft is described here: https://www.calormen.com/jsbasic/reference.html
X16 BASIC is the same as C64 BASIC (CBM BASIC v.2), but with enhancements: https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use