Smilebasic programming 101

View previous topic View next topic Go down

Smilebasic programming 101

Post by Haneko on Wed Nov 13, 2013 1:01 am

this is for people to learn how to program and make their own little projects.

smile basic isn't all that much different from "basic" only it has sound and picture functions. In this thread I will be making a game for you guys to try and learn from the code, its going to be an RPG since RPGs are Awesome and I like making them.

From time to time I will introduce a new piece of code for you guys to play around with. making the code is nice and easy but we need to tie images and sounds to make our game work. but the imagery we will do before the sound.

First me must ask ourselves what makes a game function like the many we see around us? we have to inspect the various elements that make a game a game, now with the fact that we are making RPGs, what is an RPG?

An RPG is where the player spends time some times a lot of time enjoying the story, most true RPGs use a story to feed the players a sense of excitement and adventure, not grinding for levels or merely doing requests.
What makes an RPG is the story, this means for people to make really good games they have to make a good story and a good ending. this means a lot of writing.

An RPG is an art form that most people take for granted. A terrific RPG will get you so involved into the story that 80hrs + is barely small change, and by the time you get to the story's end the ending will mark you forever. that in essence is what an rpg at its core.

here's a list of things we will cover...

-title screen
-title menu
-new game
-loading/saving
-backgrounds
-sprites
-animations
-collisions
-bgms
-variables(for stats and other things)
-arrays
-loops
-buttons(BUTTONS! OH MAN... I LUV BUTTONS!)
-strings and setting up inputs commands cleverly

all these things you will learn but more so on my next post.
avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Azihayya on Mon Dec 23, 2013 1:58 am

Hi, Haneko. I'm extremely interested in learning how to program in BASIC, specifically smileBASIC (as my searches for tutorials has lead me to here, and I noticed that you created this rather recently and I am hoping that I can provide you with some incentive to continue your tutorial). Of course, I have a lot of ideas of what I'd like to make, but almost absolutely no understanding of how to achieve those things - I've followed a guide here and there for simple things and managed to understand, at least on the surface, what those tutorials we're saying about the language, but I could feel that there lurked far more depth underneath, and it's my wish to divulge into those depths and emerge with a better understanding of how to manipulate the computer to my will.

What I'm hoping to gain from your tutorial is to be able to mimic the functions that you create and modify them in simple ways that may or may not dynamically alter the game. I'd like to include a few of the inquiries that I foresee myself having so that maybe you can attempt to address them.

1) The interface for PetitComputer is somewhat alien to me; I've attempted to save things and had errors occur - thought I've saved things and lost them. Alternatively, the Sprite, Graphics, etc, functions of the game seem totally foreign to me, and I'm afraid of pressing any buttons for fear of permanently altering them - or sit wondering how I can organize my own resources for use and know how to find and edit them. (side note: I've also noticed that some people ultimately end up creating in-game functions to traverse their game world, for debugging purposes, mostly, I suppose.) If you could shed some light into the interface for the program, I'd certainly appreciate that. One question that I immediately had while reading about creating music tracks was, if you create songs using the available slots, are those all that you have to work with for every game that you make, or can you personalize each different program with a different set of songs using those available slots? I imagined that you would tell the computer something like... "Forget song 128" then program the song into that spot, for each program you make.

2) I am presently failing to understand the mechanics of Space & Time in the game - I've dabbled around and found out about commands such as VSYNC and know that animations and perhaps other functions revolve around Intervals of Time that are represented by linear numbers... In regards to space, I have a very difficult time conceptualizing how space is perceived in the computer (for example, when you command the computer to find an X & Y coordinate), and in one such tutorial I followed, a sprite controlled by the player was made to move a fixed distance when a direction button was pressed, and I wondered how the character ultimately ended up fitting onto the screen in a way that was logical and easy to understand (for example, in the way that Chess pieces sit on a board with 64 squares). I figured that, considering my experience with games like the original Zelda, that moving pixel by pixel by holding down a direction arrow was possible, although I was completely dumbfounded as to how I myself could program movement in such a way.  These two ideas continue to baffle me, as I wonder how a factor like time might operate in the system, where it might be necessary, and how the computer ends up reading the code.

3) In the case of the tutorial I followed, there were no boundaries on the screen, and the character ended up walking straight past it, and I wondered, "Will the character ever hit a wall? Or will the computer produce an error?" because I didn't see anywhere in the code where it was using a concrete reference point (like 0,0 on a graph) to contrast the characters location with, or anywhere where the code might suggest how much memory was being used to track that characters location; I was simply left to suppose that perhaps the computer didn't expend superfluous amounts of resources in order to track the location of the character, and that if I held down the left button for exactly one day, for example, and then held down the right button for exactly one day, that my character would appear directly back onto the screen where he started.


Anyway, I'm looking forward to your tutorial and hope that you have the motivation to go forward with it because I would genuinely like to learn how to manipulate the language myself and be able to teach other people how it works as well. I happen to have a knack for designing gameplay elements, and I noticed that after you mention covering -title screen, -title menu, -new game, -loading/saving, -backgrounds, -sprites, -animations, -collisions, and -bgms that you plan on covering more generalized programming functions since you mention -variables(for stats and other things), -arrays, -loops, -buttons, -strings, and setting up inputs commands cleverly, rather than what I immediately expected, which were easily identifiable objectives such as Battle Events and an In-Game Menu; it's probably pretty difficult to mention everything on the surface though, since there are so many components that you may or may not plan on implementing, like Random Encounter Zones or Dialogue Operations... What I mean to say is that I think that it would be pretty useful to organize all of those factors into tables to have a clearer direction of how the program will be developed, and I may have some feedback to contribute regarding the balance and dynamics of the core gameplay.


Last edited by Azihayya on Wed Jan 01, 2014 4:04 am; edited 1 time in total

Azihayya

Posts : 5
Join date : 2013-12-23

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Mon Dec 30, 2013 10:12 pm

ok well that was a large post but your welcome I'm learning what I can from it but keep in mind that this is a hobby for me, So im no master.

Ok as regarding to point 1:ok since ptc is somewhat hard for beginners there are some things you need to lean. When you are in edit mode or run mode the commands are structured the same. you have to declare to the computer what your going to use and how you want to use it and when you want to use it. declarations are as follows.
To declare a string you have 3 ways to declare a string.
first you Use the Print"type your text here!" to have the computer show your string on the screen. "?" this question mark does it too.
Print " blablablabla" or ?"blablabla" are the same commands.
Second is the label the symbol is used a lot in emails."@" this is your label symbol. @blabla is a coordinate for your goto command.
And then theres the input string "Name$" means that your string is a variable now. for example I will have a dialogue program just for this one.

L0001 ACLS:CLEAR
L0002 input "Hellow my name is"
L0003 input = Name$
L0004 Print"Hello, "Name$"!"
L0005 NAme$ goto @status
L0006 @Status
L0007 locate 10, 12:Print"Name: "Name$"
etc,etc...

string variables are letters, computer understands numbers well but not words, this is how we make it understand words.

Setting dialogue is a bit more than print commands, we use a delay command known as "wait" then we in put a number and is wait that amount of time. this is usefull to determine if the urgency is there or if its a more relaxing delay. very usefull for talking with npcs.

now for movement of sprites we are talking something different. im not all that good at it, but you need to have sprites, I like 16 wide by 32 pixel high sprites so I have to make them by hand. they look bad in 8 or sixteen bit but its what we have to work with. the movement is x and y on your screen this is a bit more complicated the speed is distance related not time related, time is only a constant for making a game with time in it. like harvest moon, minecraft, these are merely examples you can check on youtube.

To set up a boundary that would be what we call collisions, an area where the sprite can't go past. this is also used for a player hitting an enemy and an enemy hitting a player.

How I intend to structure my gameplay elements will be how a game is run.
Titlescreen is important and easy to do. its a picture or graphic file we load into the background, then in the foreground we have a Phrase to initiate the player to start the game,

Title menus are the next phase, here we give the player 3 choices but that's just for this exercise its up to you for the amount of choices, but the three choices are going to be newgame, continue, options.
WE work on building the newgame functions first because a player hase to be able to start his new game to create a save file to be able to be used later with continue. options will be for little things like volume commands and brightness commands but we can add more later.
avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Yuri on Mon Dec 30, 2013 10:52 pm

Cool, your making so much progress. o:< Just asking, what will our server be and such? Or have you not really thought about that yet? [This may be stupid, but I'm assuming you haven't done the Monsters?] I'd like it if we were to have a server and everything, so that I can help with the mapping and so on. I understand how your really busy as well though.
Okay, so this is probably my last question at the moment... I think.
But do you have a estimate of when we will have a server?
Thanks.
avatar
Yuri
Admin

Posts : 27
Join date : 2013-10-07
Location : Proto Sphere World. :3

View user profile http://protosphereonline.forumsmotion.com

Back to top Go down

Re: Smilebasic programming 101

Post by Azihayya on Tue Dec 31, 2013 3:01 am

Alright! I've learned that $ stands for strings, and I thought that the GOTO and @ commands were pretty clever and easy enough to understand on the surface - but in researching the Sample programs I was mostly at a loss for understanding what anything meant, so I'm quite eager to see how you explain things as you start to get into constructing the game. I did happen to read one tutorial which explained one way how to use Sprites and buttons.

I've found that the community over at GameFaqs has a pretty active PetitComputer forum, so I've been perusing over there to see what I can learn. I input your example into the computer and guessed that I was supposed to type in "MY NAME IS AZIHAYYA" and the computer would say, "HELLO, AZIHAYYA" but I got a syntax error when I tried that.


What are you planning for combat? I've played a lot of RPG's in the past, from Super Mario RPG to Final Fantasy Tactics and I think I've got a few good idea depending on what you're thinking about doing initially. Are you planning on implementing cinematics, like you'd see at the beginning of an RPG with a castle panning into the view and lightning strikes flashing on the screen? How about the story?

I feel as if this is a pretty neat opportunity to create an RPG, something that I've probably aspired to do over the years, as well as a good opportunity to learn more about smileBASIC in general.

Azihayya

Posts : 5
Join date : 2013-12-23

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Tue Dec 31, 2013 3:05 pm

@Phoenix: the system should be done its the graphics and mml data the problem... This is where my time is right now making that stuff. its not easy stuff. but I'll let you know when I have the tiles finished at the very least. Sorry for it taking so long.

@Azihayya: forget line 5-7 but otherwise it should work. But its good to know another person has played with the nes and the supernes systems playing games is a good background to have when making games, it gives actual insight.

For the combat system, its going to be like pokemon, its mostly scripting at that point...big diff here is your monster trainer can actually fight. also im working on a game engine for players to build their adventure piece by piece,(via modules, craft a module and use it and you have a route or an area). this is the hard stuff.

avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Tue Dec 31, 2013 3:07 pm

ok  I want to use variables for stats, do I use the graphics as a variable? to make a "pokemon" battle engine mechanics.
like the fight I want to display it like this
[][][][][][][][][][]enemy
[][][][][][][][][][][][][][]
player[][][][][][][][][][][]

and swap the tags with graphics and their respective UI.

Enemy(Lv)(+0 or 0+>)
Health: -[===========]
Energy: --[===========]
Resolve:--[===========]


Monster/player (LV)(gender)
Health:--[==============]
Energy: [==============]
Resolve: [==============]
[X][o][o][o][o][o][M]
Commands
Fight[][][][]Defend[][][][]Item[][][][]switch[][][][]Retreat

just an idea I have for the ui I want to make.

Im also interested in making a menu more efficiently designed so I can just go and have my menus for a template.
the numbers should be like 2,3,4,5,10

ten is going to be for the Game menu(when in a game) its a 10 format
1.Spherepedia(my version of a pokedex)
2.Spheria(my 'Pokemon' option)
3.Bag(items are in four pages[usable non-med or non-food][material][key item][medicine/food]
4.Status(a 3 page screen in which l and r buttons are used to cycle between pages and b to exit)
5.Condition(condition of the body of your character or monster)
6.<----(Shift command not initially available until you cleared adventure[logout of main world or login game world])
7.<-------(interact[kinda like a pokemon amie idea. feed your monsters, pet them, wash them and play with them.)
8.option
9.save
10.exit

this is sort of a glimpse at the battle ui this is very hard thing to do. but this is why I'm working on making the battle system feasible.
avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Azihayya on Wed Jan 01, 2014 4:03 am

Interesting. Do you have an idea what kind of setting and story your game takes place in? I'm imagining a sublime world, full of treacherous caverns, giant mountain with clouds swirling around them, and tempestuous oceans filled with swirling vortexes. I'm vaguely reminded of Pokemon Conquest, which is a Final Fantasy Tactics-esque Pokemon game where nations went to war against each other using Pokemon in combat along-side them.

Are you planning on being able to fight along-side one monster at a time, and do you plan on using a similar 'catching' system as Pokemon to befriend or tame your monsters? Also, is smileBASIC the first programming language you learned? What is your experience with coding?

Azihayya

Posts : 5
Join date : 2013-12-23

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Fri Jan 03, 2014 7:55 pm

the story is an RPG based on a futuristic world where owning a private dimension is so common place now for gaming that it has become a coming of age ritual, like getting a drivers license. Your character(again this is for offline only) is trapped inside his new world, and has to adapt to it to recover his or her memory, the gender of your character will make certain changes to the story dialogue and some of the graphics to be used. neither gender are advantaged or penalized by their gender. certain events will only happen for the guy and some others will only happen for the girl.

Yes I'm going to making some things similar but its not a cut and past thing either, many many things are different from my project and pokemon, for one my stuff is all made by me and my team.
also there will be a lot of differences and I will have my mascot help the main character in all my projects. This is not a problem.

Right now I m working on my mascot and learning how to program her dialogues and options. I can even make her into a playable character to let the gamers experience some secret project demos.

as for the capture mechanics you can knock out a monster to capture it, or treat it wounds and let it run away. but the main character has to fight that monster, and this is one thing pokemon doesn't really do.
but if you treat its wounds often enough you might find a secret scene where you can safely capture the monster with 100% success rate. this is something I'm working on.

There are many, many, things I want to add to this project, and this I'm noting down on paper. I do need help but I'm not going to sit a whine if I don't get it. I'm just going to do it anyways. graphics and mmls would be nice but I never seem to find people good at those or willing to try it out. so it will fall unto me who isn't good at making this stuff to do it.

but yeah if you want to try it out I can let you help with some of the work. but make sure you warn me if you can't take it. its just courtesy.
avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Azihayya on Thu Jan 09, 2014 3:00 pm

That totally not what I expected xD

I watched Sword Art Online - was that one of your inspirations by any chance? There's also a really awesome French film called Avalon that has a similar concept. You should really check that out: http://www.imdb.com/title/tt0267287/

I've also been following your thread on the gamefaqs forums; you've got some really neat ideas planned for your game! I'm a big fan of the idea of creating your own world. I used to play the Dark Cloud games back in the day and creating your towns was one of the most fun features I'd ever seen before - it reminds me of board game-esque rules, which exemplify the spirit of gameplay in my opinion.

I can't help you with coding - I'm here to learn, though I do think that I've got some pretty intuitive ideas. Turn-based RPG battles can be really boring and static; each turn you might choose to use the same moves over and over again because they are simply superior to other moves. A lot of times the most strategic choices you make are when to heal - but I've never seen a single RPG that utilizes a Defend command in a practical manner. Some RPG's, like Mario RPG, attempted to address the problem of boring turn-based battles by adding mechanical attributes to attacking and using abilities, such as timing and precision, but there are seldom few games out there which really cause the player to think and react to the situation, although games like Pokemon do manage to achieve this, mostly in the player versus player aspect.

Over time I've developed quite a few core philosophies regarding game design - the most relevant one in this scenario is the importance of mystery. In any case where the player knows what they need to do to succeed then there is no challenge or incentive for them to proceed, other than to play out what they already know. An ideal encounter should be fraught with hidden dangers, involving an on-going struggle between what you want and what your enemy wants. So, the idea that I initially had before I asked you about your idea was two status conditions in combat caused by water and fire; on one hand, fire will burn a character continuously, but it can be put out by water. Water, on the other hand will cause a target to be prone to electrical attacks. If lightning struck one character it would also damage characters adjacent to it.

Anyway, that's just what I came up with while I was thinking about interesting gameplay elements to add to traditional RPG's like Final Fantasy, etc. As I learn more about what you have imagined for what you want combat to be like in your game, I may have more ideas or feedback to contribute. Immediately, what comes to mind is the idea of using the Defend command to protect your allies; this could make for an interesting dynamic where either you or your monster could protect the other, perhaps more fragile ally who could be a glass cannon type of character. That alone, though, isn't wholesomely interesting, since it can seem like if you come to depend on it that you really only have one character, since one is only like a shield and the second is only like an attack.

Azihayya

Posts : 5
Join date : 2013-12-23

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Sat Jan 11, 2014 5:15 pm

that is a logical aspect to it too. but the elemental wheel goes like
this; water douses fire, fire burns air, air shocks metal, metal cleaves earth, earth absorbs water. Light is good against dark but it is also weak against dark, dark is strong against light but is also weak to it.

This is how the elements work on the basic level, what you are mentioning would be like a 1-2 combo for big damage, would be something to add and yes it would make sense too. but it would be your character's skill for the support moves like those special status effects. that would give players something more to think about.

yea the defence is for when you need time to recharge a move like for example I don't have this in my game but lets say your monster is using a hyperbeam I has to regain his strength to be able to do something, but leaving yourself open for attack is retarded, this is really for what defence is for. you could have confused status on your monster and have to use defense to prevent the "it hurt itself in it's confusion" moments, you could be paralysed defend would help you wait till paralyse wears off, your opponents get some hits in but there is a big drop in damage when a monster defends.

if your into attrition battles you could force your opponent to run out of energy for moves. it adds a lot of dimension for it. won't stop damage but it will certainly lower the amount you take. that can save you but not forever.
avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Azihayya on Sun Jan 12, 2014 2:20 pm

That sounds really neat. I was considering that doused would be a temporary sort of status condition that lasted for one turn ordinarily, but if doused to a level of 3, perhaps the unit becomes soaked.

Recently I was watching a speed run of Chrono Trigger and I was impressed by various elements of the battle system, which can also perhaps in form be seen in titles like the Secret of Mana...

Azihayya

Posts : 5
Join date : 2013-12-23

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Wed Jan 15, 2014 7:19 pm

Legend of mana and chrono trigger have different battles systems so you can't really compare the two. you can compare chrono trigger and final fantasy because the combat mechanics are similar. legend of mana can be compared with Zelda for combat mechanics.
avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Haneko on Sun Apr 27, 2014 2:22 pm

ok back to the thread, now for programming your game you have to take into account of a certain flow to it.
now when making a title screen there are a number of ways to do it. I am lazy and want to make it look good,
so I make a graphic for the background screen, and draw the title like I want it to look like, print a string telling the player to press start button.(keep in mind this is because im using a console version of Petit computer.)

The code im often using is this;

ACLS:CLEAR<------This clears up the whole screen make sure this is on your first line.
Sysbeep = false <----------this mutes the loading sound. great for discreet loading.
Load "GRP:TITLESCREEN", false <--(our loading of the actual graphic in the graphic screen is discreet)
BGMPLAY 24<---------gives our title screen some music
x=:y=:select=0 <-------(you have to put values for your X and Y coordinates pay attention to your screen res)


@TITLE<---------These are tags used in loops, goto and subroutines. these tell where the information is.
BgmStop<----we don't want to hear the bgm drone on indefinitely.

((more later im going to re edit this post to finish our basic program))

avatar
Haneko
Admin

Posts : 59
Join date : 2013-10-07

View user profile

Back to top Go down

Re: Smilebasic programming 101

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum