Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Easy to make games?

Author
Message
dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 15th Oct 2011 13:21
Hello everyone,

I just bought DBPro and ofcourse I have an idea for a game (RTS), but I've never programmed in BASIC before.
My only programming experience is in HTML, CSS and PHP, which is completely different.

I tried to come up with a simple game to make to learn how to program in DBPro, but I couldn't really think of anything.

Could anyone suggest a game which is very simple to program, just to learn the language?
And maybe one a bit harder to program after that one.

Thanks
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 15th Oct 2011 17:31 Edited at: 15th Oct 2011 17:39
I wouldn't start with a game first. I would start here, with TDK'S tutorials

It will be worth more than I can even express if you stick to them. You will build a true foundation of the language, and with that; everything you do afterwards will be easier and make more sense.

Your signature has been erased by a mod please reduce it to 600 x 120.
dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 15th Oct 2011 17:58
Thank you, but I've already read those things
I forgot to mention that.

However, having read those things I still don't feel like I know nearly enough to start working on an RTS right away.
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 15th Oct 2011 19:13 Edited at: 15th Oct 2011 19:13
Well first do a text adventure, learn about variables and types and functions and labels and not to ever use goto's unless you have a good reason, use gosubs, goto's make a mess.

Then take it up a step, try placing sprites, and moving them with

Sprite number OR variable here, x coords go here + 2, y coords go here, image number goes here.

when rightkey() is pressed (= 1)

and if doing that is too hard, look up more tutorials, ask here for help, or just experiment. If anything go back to text adventure, try using new methods.

And have fun!

"Insert funny coding-related joke here"
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 15th Oct 2011 19:45
After you understand the core library, variables and functions; you should be able to learn how to create what ever it is you want. (Otherwise, creating a graphical demonstration or a spaceship game is quite simple. Sometimes text based games can get complex with all the branches of options to deal with).

Sometimes when you learn how create something simple; and move on to create the real deal; you find out it would have been easier to learn how to produce the real thing in first place.

Just think about what kind of game it is, and as you go along; learn how each part of it is done through the examples in the forum and in the codebase. Even in this thread, just post up any issues you fall into along the way.

I once started a simple project with a 3D environment and a moving character. That went ok; but it was my goal to make it work over a network. The way that the simple 3D project was created was completely different to the real thing with networking. I had to start from scratch.

Another example is when I spent months learning how to work with global variables and sub routines. It was basic; but when I got round to working on the real thing; I realized I should have learned how to work with arrays, UDTs and functions.

Goto is a good example of something simple that you often get into the habit of using because you used it while learning how to create something simple; but you soon find out how dangerous it is, if not used well.

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 15th Oct 2011 20:16 Edited at: 15th Oct 2011 20:24
Here's my opinion. I would say somewhere around 70+% of people skip understanding the core principles. This is why 70+% of the people wind up getting themselves into real jams when trying to complete a more complex project.

I include myself in that 70%, because I had previous experience in other languages including multiple BASICS; so I figured I could just leap ahead and skip the core. I get by, but had I truly got a better core foundation in DBpro specifically, I would have been much further than my current understanding AND in a quicker amount of time, with a lot less frustration AND more to show for my efforts. The amount of time I lose to fumbling around is absolutely crazy. Coming back to DBpro recently, I have decided to actually go back to some core tutorials and my enjoyment of the product is increasing.

It's also ok to try your hand at things AS you are progressing through the tutorials. It can help movitate you and add to the enjoyment of the learning process. Just keep the projects reasonable. Don't ignore the core learning for too long. Balance your time.

Your signature has been erased by a mod please reduce it to 600 x 120.
nonZero
12
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 15th Oct 2011 23:18
Personal experience here (and we're all different so I can't speak for anyone but myself) but I'd say the easiest thing to do AFTER THE TUTORIALS would be a 2D top-down shooter. Just something simple. That should teach you almost every aspect except for the 3D stuff (Unless you want to get clever with backdrops).

You will probably make one big mess at first and stumble through but you will gain useful experience BECAUSE of the mistakes you make (that is how we learn).

After making the game and have attained the necessary experience, move onto "skill honing". I mean by this, refine your code by constantly seeking the most concise, truncated, flexible and logical code structures possible.

THEN make the game you actually want to make.

Final Hints: FORCE family and friends to play your games/demos and give you feedback as you need the layman's perspective too. Don't be afraid to ask questions. Everyone was a n00b once.

dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 16th Oct 2011 15:46
Thanks for the tips guys!
I will start working on a 2D top down game.
Maybe even implement some things from the RTS I want to make.
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 16th Oct 2011 20:23
Just out of interest, where are these core principles to learn. I have read through many tutorials and the hands on books as well (lovely books loads of command info). And yet i struggle with putting things together myself.
For example if i wanted to make a side scrolling platformer with a simple character and some jump/gravity in it and collision. Ill bet the code for exactly what i am looking for is what i already know. Ill bet there isnt a single command in something as simple as a side scrolling platformer that i havent heard of. My problem would be implimenting everything together. How would i make the gravity work for example. I presume its a core principle to learn but i have not encountered it yet, just all the commands in the simplest form to make them work. By the at this moment in time i do not actually want to make a side scrolling platformer i was just using an example.

Too many tutorials only throw a handful of commands together to make something simple which is nice to understand but taking it further is more dificult for some folk than it is others. It took me a while to understand how to lay down tiles for a scrolling map in an array but all of the commands were there, i knew them just couldnt use them. Is there a specific place we can learn some of these fundementals, even if we dont plan on using them. Just something a little past the beginner stage but not quite the intermediate stage. Some people im sure are like myself and are not great at making things work through experimentation as we havent built enough knowledge of what can be done and how to do it first.
dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 16th Oct 2011 20:33
I have to agree with you there.
I've read alot of tutorials explaining which command does what, but like I said, I don't feel like I'm ready to make a proper game right now.
That's the exact reason I wanted to start with an easy to program game.
If I run into a problem I will search these forums or make a new post and hope that I can find the answer.
That seems like the only way to actually learn how to make games in DBPro.
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 16th Oct 2011 20:51
I agree, knowledge is one thing, but skill is harder to master, im still learning alot of that and getting better, alot of times its just good to practice, and eventually you'll peice it together.

"Insert funny coding-related joke here"
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Oct 2011 23:13
Quote: "That's the exact reason I wanted to start with an easy to program game."

Zombie Island sounds like a good starting point for an RPG.

The basic idea is that you have an island that has holes in, along with a population of zombies. You and the zombies take it in turns to make a move, with the zombies always moving 1 step towards you. You have to move in such a way as to get the zombies to fall down a hole.

Example steps:
- Start with a turn-based game
- Add obstacles that cannot be passed through
- Add 'safe' areas (if you are in a safe area, zombies cannot see you and won't chase you)
- Make it run in realtime rather than turn-based
- Make the play area larger than the screen by scrolling the world around your player
- Add different types of zombies with different targeting and fighting behaviours
- Give your player hit points - every zombie deducts one or more points when they touch you
- Give your player different weapons
- Make the safe areas into shops and provide a menu to enable (buy) or disable (sell) weapons

You get the idea. Taking fairly small steps, you can build your game into a full-fledged 2D RPG quite easily.

dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 17th Oct 2011 01:01
I'm working on a menu now, and I've already ran into a problem.

For some reason
does not work..
I know that I could put
, but that would mean that if you press the right mouse button, you've got a problem.
The reason I want to do this is because I don't want the game to close immediately after you press the QUIT button, but only after you've released the left mouse button while your mouse is still hovering the QUIT button.

The code (I've cut out the irrelevant code):
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Oct 2011 10:26
You can use the < and > to do the same thing.

The following line reads as "if mouseclick is less than or more than 1".

if mouseclick()<>1

Also you need to reset variable quit to equal zero just in case the user moves the mouse off the sprite to let go of the mouse... otherwise the next time their on the sprite it'll automatically END because the variable quit still equals 1.



dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 17th Oct 2011 14:19
Thanks, that worked.

A friend suggested that I should make a tower defense game, which doesn't seem too hard.

However I'm having some trouble with the matrix.
I've searched the forums for a while, but I still don't understand it entirely.
I want to have a 16x16 matrix with 64x64 tiles.
Am I right saying that you can texture each tile individually with
and could you tell me if I've used the prepare matrix texture correctly (code is down below)?
And is this the correct way to create the matrix I want:


Is there any other way to texture the matrix more easily (I used
, etc.)

I'm also having trouble with viewing the matrix.
I've set up the camera:


And I've created the matrix:


But all that happens (or all that I can see happening) is the backdrop color changing from white to green.
I know it's alot of questions, but I couldn't find the answer anywhere else on these forums

Also, I'd like to say that it's very encouraging to see how many people respond to my questions so quickly and that you're all trying to help!
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 17th Oct 2011 16:18 Edited at: 17th Oct 2011 16:20
As Grog says...

Just a note about the NOT operator; it is a little wierd to understand at first; but the expression [NOT MouseClick()], when unclicked returns -1. [NOT MouseClick() = 1] = [NOT -1 = 1], so it will not work nicely.

The expression 0 AND 1 (Quit), is thus false.



I personally never use the NOT operator in expressions, out of personal preference. I would have done something like this inside of your loop:



or



But what you have done will work if you sort out the NOT operand.

There is a page on my website that talks indepth about the not operator:


zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 17th Oct 2011 16:22 Edited at: 17th Oct 2011 17:40
EDIT
After more tests my original explanation of using a value as opposed to an expression/equation with "Unary operators" sort-of fell apart.

I knew this wouldn't work:


However, These work: (I assumed they wouldn't, before testing)


Add them to the codesnippet below to check them out.


I've put together a small snippet to illustrate some points.



NOTE*: MouseClick() is not the best command to combine with the "operators" like NOT, because the values that are returned are not limited to "one button" nor just a value of 1 or 0. Tracing the logic, while it does work correctly, is not always immediately clear.
===========


Other interesting discoveries.......

Somewhat confusing to me is the result of the following line of code:
if 0 = mousclick()=0

what result would you expect? Add this to the snippet and run it.


I believe it's just ignoring the evaluation after the mouseclick().


I think adding to the confusion is:
Unlike BASIC, C has an assignment operator "=" and a relational operator "==" for evaluating conditions. I've always disliked the fact that basic uses "=" for both. It leads to ambiguity/confusion IMHO.

Also the default compiler prompts that the required parameter folllowing NOT is a boolean. Even when IF preceeds it (IF NOT)... But NOT can act as a "boolean operator" a "Unary operator" or a "bitwise operator".

Now to add to all of this. DBpro's bool type is not actually a boolean, and I can find no difference between a boolean and an integer. Not sure why that is.

Your signature has been erased by a mod please reduce it to 600 x 120.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Oct 2011 21:05
Best to use the && operator to test for specific buttons:


or (note the brackets to control the evaluation order):


I only ever use NOT in binary manipulations, never in a standard expression.

Quote: "if 0 = mouseclick()=0"

Just evaluate from left to right.

Assuming the mouse button is not pressed, then this is the evaluation:
: (0 = 0) = 0
> 1 = 0
> 0

Assuming the mouse button is pressed, then this is the evaluation:
: (0 = 1) = 0
> 0 = 0
> 1

Quote: "DBpro's bool type is not actually a boolean, and I can find no difference between a boolean and an integer."

I think it's actually stored as a byte, but is used as an integer in a calculation.

Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Oct 2011 21:44 Edited at: 17th Oct 2011 21:48
Quote: "I think it's actually stored as a byte, but is used as an integer in a calculation."


Yeah, booleans in Darkbasic go up to 255 so it's definitely a byte.



The way a boolean should act when adding 1 (works with all data types):


zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 17th Oct 2011 22:36
Yeah, I goofed when I said integer. I did mean byte. And the priniciples help is clearly wrong when it comes to booleans

Quote: "
INTEGER Range : –2,147,483,648 to 2,147,483,647
REAL Range : 3.4E +/- 38 (7 digits)
BOOLEAN Range : 0 to 1
BYTE Range : 0 to 255
WORD Range : 0 to 65535
DWORD Range : 0 to 4,294,967,295
DOUBLE INTEGER Range : –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
DOUBLE FLOAT Range : 1.7E +/- 308 (15 digits)
"


Your signature has been erased by a mod please reduce it to 600 x 120.
nonZero
12
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 17th Oct 2011 23:46
@Somarl

Quote: "
...I have read through many tutorials and the hands on books as well (lovely books loads of command info). And yet i struggle with putting things together myself.
For example if i wanted to make a side scrolling platformer with a simple character and some jump/gravity in it and collision. Ill bet the code for exactly what i am looking for is what i already know. Ill bet there isnt a single command in something as simple as a side scrolling platformer that i havent heard of...
"


Don't look for commands for everything. Try to utilise what you know. For example, A 2D sidescroller requires that a background, foreground and player/enemies be moved. By adjusting the sprite positions we can do this. So physics? Doesn't have to be that complex. This is where FLAGS come in. FLAGS are more crucial to programming than most realise. In this situation you have a Rising Flag (if jumping), a Falling Flag (if falling) and a bunch of control flags for AI, moving platforms, weather conditions(very optional, lol), etc. You can learn a lot by actually playing some NES and SNES sidescrollers like megaman(aka Rockman), Ghouls and Ghosts, etc.

Quote: "
Just out of interest, where are these core principles to learn.
"


A lot of these core principles are gained through experience by writing code, reading code and doing the RIGHT tutorials. The important thing is just never stop asking WHY it works like that.
The only other thing I can say is don't give up too easily. It's tough at first but you grow and learn. You just got to hit this thing with determination.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 18th Oct 2011 21:27
@nonZero Thanks, it does all make sense, its just sometimes i wish there were neater tutorials that go into a little more detail on a particular way to do something rather than releasing you into the wild with what you know. If you fail you can usually try a few more ways before you're out of ideas. Somewhere that bit by bit had certain ways of doing each of the 5 or 6 core learner games to get people past the very basic stuff would just be really fantastic.

Games like a top down rpg (with ways of doing inventory, making and scrolling a map - which i know now but had so much help from people to understand - swapping out weapons and armor, simple enemy placement, enemy and npc ai etc) all of these concepts for just something like that would be great. Other games like a side scrolling shooter and a few others. Once beginners had got past all this they would know enough to expand i presume or pursue a new way of doing something, they would certainly be better prepared.

Unfortunately there only seems to be little snippets here and there with a few lines of help. Or a lot of detail but on just one command. A great help for folk in my boat would be a place to go to learn some core principles from simple enough games, written for someone who knows the absolute basics but cant put it all together. Rather than just pointing us to TDK's tutorials and saying things like the best way to learn is to experiment.

Sometimes with experimenting its difficult to know where to start.
I would love to write a consolidated place of tutorials like a how to make a .... whatever game but in great detail so you go through in detail step by step how to do certain seemingly simple things (like on an rpg reading data into a map array then placing the tiles down on the screen, something i could not have worked out on my own as it was beyond me but the principle is simple when explained right and now i get it.)

If anyone experienced enough would like to collaborate with me id love to write something up as i think i know what certain people need to know its just i dont know it in the first place to do this.
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 18th Oct 2011 22:44
Feel free to post up any questions regarding your projects Somarl.

About your points, which are totally valid;

I'd say that most of what I learned came from code snippets and the official documentation. Particularly, playing around with snippets, performing scientific method, testing out the commands and building my own library of small programs helped me not only to memorize frequently used techniques and frequently used commands; but helped me to understand why things work the way they work.

Now, I am still playing around with functions to see how I can optimize. Today I would say that I tend to skip tutorials and go straight to the code snippets. But as you say, code snippets often contain only a few lines; also they can be poorly written.

The thing about posting a tutorial that takes you through the development of a full game is the amount of time it takes.

Granted, a few 'medium sized' walkthroughs would be wonderful. By medium size, I'm talking about 10 or more hours of gameplay. By looking at the amount of tutorials available for such a thing over the past number of years; shows how difficult it is.

Getting my game completed, even as an experienced developer, is difficult for me; in-terms of time.

I am still learning new things, and encountering unexpected problems. I used to get upset when code problems occur; but now, if something goes wrong I don't even sweat; because 99% of time it is a silly typo, or something was forgotten - hence careful commenting helps. After a while, you get a lot of practice dealing with such problems, and you become more efficient at rectifying them.

I wouldn't say from my perspective, that it will ever be easy to narrow things down into a tutorial; you'd need a novel and hundreds of pages to fit the amount of actions and principles that are required to explain to someone with only basic knowledge, how to build a modern feature packed full game; even a medium sized one.

So for now, we all have to make do with what is available.

Post up any issues you have with your projects

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 19th Oct 2011 00:33 Edited at: 19th Oct 2011 00:34
Most of the information I learn from is geared towards another language. In my case C/C++. I try to find as much straight C code as possible, but that isn't always an option. There is a wealth of in-depth knowledge out there on a vast amount of topics. It's then a matter of converting those concepts to implementations in DBpro. I'll be the first to admit that the latter is sometimes easier "read" then done.

Most of the texts that I have do a fairly good job of explaining the concepts in a code-neutral or psuedo-code form. Unfortunately, there is no 1:1 translation, and certain things that are trivial in C become a chore in DBpro, and quite often vice-versa.

I believe that even people not proficient in a given language can extract enough from many resources to make them worthwhile... but of course having some experience is going to help. For instance, I have never programmed in java,, but I can usually figure out the gist of what is being done from the background I do have.

So my advice is...

Don't just limit yourself to reading articles, snippets, tutorials specific to DBpro.

Your signature has been erased by a mod please reduce it to 600 x 120.
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 19th Oct 2011 00:55
@dbrekelmans, went to have a look at you matrix code that you posted yesterday but can't help as you've fragmented it. Could you post the whole thing so we can have a look (unless you've already sorted it out).

I think a top down game is about the right level but a tower defense game might be too complicated.

On a more general note:

I was a bit lucky in that I got taught a bit of qBASIC as part of my degree but we didn't learn much more than how to do calculations. But this is where I caught the coding bug as I saw the potential to learn more and make games.

When I first started to make my own programs, I didn't worry too much about actuall games but concentrated on things like:

how to tell if a key has been pressed
how to use the mouse
how to get things to move
how to control that movement (hence needing to know about key presses and mouse control)
how to code decision making (i.e. does the enemy move left or right in order to catch you)
how to point the camera in the right direction or to follow the player (i.e. third / first person)
how to determine if two circles overlap or if two rectangles overlap (essential for determining if enemies have hit the player and so on)

This is really just repeating what IanM said but breaking the steps he suggested into even smaller steps. What you'll then find is that complicated games are really just combinations of very small pieces of code.

My first games were:

1: A simple racing game where the track was two concentric circles and the object of the game was to get round the track as fast as possible (there was a simple "timer" that was really just counting the number of loops the program went through).
2: A game where you had to dodge falling blocks.
3: A game where you were being chased and had to collect boxes (a bit like my rolling marble game on the 20 line challenge board, except it was in 2d and didn't have rolling marbles just circles).

All of them 2D made with circles, lines and boxes.

I still do simple demos of things I don't understand and then incorperate them into the main game. I recently did a small program to work out how to randomly shuffle a list of names. The program will then use this shuffled list to load levels into the main game so that the levels will come in a random order.

What is really helpful is to pin down what you want the game / demo to do. For example, if you have falling blocks, do they move at a constant velocity or do they accelerate due to gravity. To begin with, always go to what's easiest (so forget acceleration due to gravity). Sometimes it's not always obvious what is the easy and what isn't (which is sort of the point of the original post, I suppose) but if you start to get stuck, you've probably over complicated things.

Anyway, that was my two pence / cents worth.
dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 19th Oct 2011 01:02 Edited at: 19th Oct 2011 01:42
Quote: "(like on an rpg reading data into a map array then placing the tiles down on the screen,"


This is EXACTLY the problem I'm facing right now.
I want create a top down tower defense game as my first game, but I can't figure out how to use arrays effectively to do this.
Right now I have a UDT called MapTile with x1,x2,y1,y2 and an array called Tile(x, y).
Since I have a 16x16 map (64x64 tiles) the array Tile(1,1) contains the position data for the first tile (in terms of Tile(1,1).x1 = ..., etc.) and Tile(16,16) contains the data for the last tile.

This will be useful for checking if the mouse is on a tile, but I can't figure out how to use this to actually build the map.
I'm assuming I should use sprites (rather than a matrix) and I have a sprite for each different object (tree, road, tower).
If you could explain how to do this, it would be very helpful

EDIT: This is the code for filling the array with the tile positions.
I'm not sure if I did this right, maybe someone could check

Yakkers
12
Years of Service
User Offline
Joined: 15th Jul 2011
Location:
Posted: 19th Oct 2011 04:51
I'd reccomend making a player vs. computer AI tic tac toe game, that was my first completed project when I was first learning BASIC. It was relatively simple to make and feels nice and satisfying to see it come together.
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Oct 2011 06:08
Quote: "Thanks, it does all make sense, its just sometimes i wish there were neater tutorials that go into a little more detail on a particular way to do something rather than releasing you into the wild with what you know. If you fail you can usually try a few more ways before you're out of ideas. Somewhere that bit by bit had certain ways of doing each of the 5 or 6 core learner games to get people past the very basic stuff would just be really fantastic."


The wild is actually a fun place if you look at everything and try to dismantle it programming-wise. Back when I was a kid and programming in QuickBasic I would frequent our local arcade and look at the games people were playing and try to deconstruct how they programmed the game (just mentally). I remember when I heard for the first time a video game that had digitized voice on it. It was Gauntlet and I was amazed it said stuff like "Red Warrior needs food badly." and "Green Wizzard is about to die!" in a sentence. Then I thought "How can they program that? Surely not every possible outcome for 4 different character 4 different colors and each phrase." Then it dawned on me they did separate everything but because they played them right after each other it sounded like it was all natural. "Red" "Warrior" "needs food badly". Now I didn't have digitized speech on QuickBasic but if I ever did I knew exactly how to make that particular thing work best in a program with or without actually making it.

That's the beauty of programming. You take all these little things you learn and throw them all together to make something unique and amazing.

nonZero
12
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 19th Oct 2011 11:26
@dbrekelmans:

Just out of interest, why are you using tiles for your game. Is it for the sake of learning to use arrays or is it just the way you decided to go about it. The reason I ask is because there is a simpler way of doing it. If this is a standard topdown tower deffence game then why no use a static background? You can then add "objects". 2D is not as limited as people think and the use of tiles is unnecessary in this game. You can still use snapto-positioning for players and enemies by setting enemy movement to specific increments per "turn" and snapping the player's cursor to specific points when s/he errects a structure.

Also:


Hope this is useful.

dbrekelmans
12
Years of Service
User Offline
Joined: 15th Oct 2011
Location: Netherlands
Posted: 19th Oct 2011 13:31
At first I wanted to do this with a matrix, but I didn't quite understand it and I thought using sprites and creating tiles was easier so that's what I did.
I also want to learn more about arrays (since I don't completely understand them yet).

What other ways are you talking about?
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 19th Oct 2011 21:19 Edited at: 19th Oct 2011 21:20
Ready for a wall of post. Bare with me cause this is good.

First off @ dbrekelmans there is a post on scrolling tiles for an rpg here http://forum.thegamecreators.com/?m=forum_view&b=7&t=183032&p=0 it took me a while to understand so there is more than enough help in here I think.

@Chris Tate – yeah a lot of people seem to get all their programming skills through tinkering with code snippets. I guess im not that way inclined as usually I fail to understand what is going on a lot of the time or don’t know even where to look to start tinkering. I must say in the past I have expanded code well beyond what it intended to teach so I knew I fully grasped the concept but in many cases its not that easy. Now what I said before about making a game and running a tutorial with it, im not talking about something medium, I mean something small. Say for instance once you have gone through TDK’s and possibly the books (as I have) and many other tutorials, then you have had a play around yourself and asked a few questions on the forums. Then where would be nice to go is a tutorial that goes through a couple of principles on doing a few things that might come in useful or at least start making you think like a programmer, making you put pieces together.

A wonderful example (not only because it is kind of simple – though I cant do it – but many people usually want to start off doing this sort of thing anyway) would be to do a top down RPG.

1) Firstly how to use a tilesheet and what one is, then how to load it into a map form and display it in an array.
2) How to scroll that map so it reveals part of a bigger map.
3) How to place a character down from another tilesheet with simple animation in 8 directions.
4) Giving that character a WASD movement function
5) 2 or 3 different ways of doing collision so they can either have the map as is and place objects(sprites) on the map that arent passable or having the tiles themselves impassable.
6) Placing houses or buildings down that the player can enter and have it change the view to the interior then back out to the exterior when they leave. Two floor buildings would be nice aswell.
7) Placing NPCs to interact with and making a way to interact with them like talking, so ways of storing what the npcs will say to you and handling that data.
8) Creating enemies and giving them paths to patrol and ways to create a simple AI so they attack you if you get too close or run away, and pursue you for a time or distance.
9) Methods of handling inventory, like a grid and icon based inventory. How to store the information on items and use them properly so everything in the inventory can have purpose.
10) Weapons and armour changing for the character.
11) A way of increasing or decreasing stats on the players and having it make a difference to certain things they do in game.
Like seeing their strength increase which in turn makes them hit harder, how to incorporate that into the algorithm previously created to determine how hard to hit a mob etc.
12) How to have goals and events and triggers for the game to know the win conditions.

I know all this seems like a lot but if someone went through this properly id love to write it up as a nice guide and I would if I knew how to do everything (as it stands I can only do 1 – 4 on that list).

Not a ten hour game literally just the bare basic amount in it just to demo how to do everything, so not 40 different weapon types and 12 different armour types, just 3 of each to demonstrate how the player can get hold of it, keep it in inventory or another chest, or wear it and watch his stats rise/fall. No need for an expansive 30km map, just literally enough to hide a village, a few npcs and a few mobs (not 50 different type of enemies). If the beginner wanted more they can always elaborate on what is given.
In answer to what else you said about posting up any issues with projects im having I already have, several of my threads are currently floating round abandoned because I went as far as I could, sometimes I understand sometimes I don’t. Also they are not really projects as I am not attempting a game just yet, I just want to get more principles down and do some small demos. Im not up for making a huge FPS RPG just yet, its not the right place to start with my current skill level so I am just testing a few ideas and trying to make them work. A better set of more modern detailed beginner to intermediate fundamentals tutorials which cover some interesting principles would be much more use to me at this current time.

@zenassem - that is good advice thinking outside the box a little and not just worrying about DB pro but also thinking how other programming languages work. However I have tried C++ in the past and it is an awful language for a beginner, very ugly and painful. Many of the principles for just pasting an image are just too far beyond my capacity so I cant seem to learn anything from it. Shame really as I paid over £40 for the massive fat heavy programming principles and practice using c++, its just all garbage to me after the first 150 pages, when I compare it to the first 150 pages of Hands on I seemed to achieve a lot more and in better time.

That's the beauty of programming. You take all these little things you learn and throw them all together to make something unique and amazing.

@Grog – I have often found myself trying to mentally deconstruct a program and I only really get to the very basics of what a program is doing. Really to help I would need to get down to the pseudo code of the programming to fully transport it to programming which I cant do without the principles in the first place. Take Deus Ex for example. How does the main character duck behind the cover when the right mouse is pressed. Simple right?

1) See if right mouse is clicked
2) If it is check if the barrier or whatever in front of you is actually cover.
3) Make the character go into the cover mode.

Yeah simple. But actually none of that is translatable unless you break it down further, I don’t know how to do that, I could possibly get as far as running a check to see if the right mouse is clicked, after that hell knows. Id be damned if I know how to make the character interact with whatever 3d object is in front of it but that’s just because I don’t know any good fundeamentals.
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 20th Oct 2011 00:13
@ Somarl I think what you're talking about, with regard to the Deus Ex cover system, is the difference between coding and problem solving.

The problem with tutorials is that they can only cover a finite amount of examples and they will never cover everything people want to do. Even a subtle difference could change the fundamental approach to doing something. There may also be a number of different solutions and no best solutions.

Problem solving is: part knowledge, part creative thinking and part experimentation. This all needs to be wrapped up in a methodical approach and a clear head. You can only develop these skills if you actually solve problems.

The sort of approach I use is to break a problem down into something that's more simple and may not be what I actually want but it's a start, draw lots of diagrams if appropriate (such as problems that involve geometry, shapes, positions etc) and write small experimental code that solely focuses on the little problem at hand.

The only example I can give you as an insight into my problem solving method is this thread (I appear a few posts down):

http://forum.thegamecreators.com/?m=forum_view&t=189846&b=1

where Ranietz wanted to do some box on line collision. The first demo I posted was a simplified version of what was asked for because that for me was the start point. The pdf download in my next post shows the full problem as I saw it. Ranietz then figured out the code and it turned out really well. What you will notice is that decisions needed to be made about what constituted box on line collision and that depends on what is acceptable, which is a matter of opinion and no answer is correct.

What you don't see is all the other little programs that I wrote years ago to:
1: deal with something jumping and falling (forget moving side to side and just deal with the up and down)
2: how to get a circle to move along the line (forget jumping and treat the cirle as a point)
3: determine if a point is above or below a diaganol line (just use the mouse position and have a bit of text that says "above line" or "below line" as appropriate)

You then put all these little ideas together, one at a time if necessary, to form a more complicated demo / game.

Even the Deus Ex cover system can be boiled down like this.

Maybe what's really needed are tutorials on problem solving and creative thinking.
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 20th Oct 2011 01:35 Edited at: 20th Oct 2011 01:42
Quote: "Problem solving is: part knowledge, part creative thinking and part experimentation. This all needs to be wrapped up in a methodical approach and a clear head. You can only develop these skills if you actually solve problems."


Yes indeed, hence the purpose of programming is problem solving, is it not. So a good programmer is a good problem solver; in terms of software development.


Quote: "1) Firstly how to use a tilesheet and what one is, then how to load it into a map form and display it in an array.
2) How to scroll that map so it reveals part of a bigger map.
3) How to place a character down from another tilesheet with simple animation in 8 directions.
4) Giving that character a WASD movement function
5) 2 or 3 different ways of doing collision so they can either have the map as is and place objects(sprites) on the map that arent passable or having the tiles themselves impassable.
6) Placing houses or buildings down that the player can enter and have it change the view to the interior then back out to the exterior when they leave. Two floor buildings would be nice aswell.
7) Placing NPCs to interact with and making a way to interact with them like talking, so ways of storing what the npcs will say to you and handling that data.
8) Creating enemies and giving them paths to patrol and ways to create a simple AI so they attack you if you get too close or run away, and pursue you for a time or distance.
9) Methods of handling inventory, like a grid and icon based inventory. How to store the information on items and use them properly so everything in the inventory can have purpose.
10) Weapons and armour changing for the character.
11) A way of increasing or decreasing stats on the players and having it make a difference to certain things they do in game.
Like seeing their strength increase which in turn makes them hit harder, how to incorporate that into the algorithm previously created to determine how hard to hit a mob etc.
12) How to have goals and events and triggers for the game to know the win conditions.

I know all this seems like a lot but if someone went through this properly id love to write it up as a nice guide and I would if I knew how to do everything (as it stands I can only do 1 – 4 on that list)"


To me, this list of problems is a matter of time; I, and certain others, can answer all of the questions, but it takes time to explain it to someone who cannot solve those problems.

I am busy right now; but the best I can do is talk alittle about problem 5; which will require a little feedback.

5) 2 or 3 different ways of doing collision so they can either have the map as is and place objects(sprites) on the map that arent passable or having the tiles themselves impassable.

Well, we know you want 8 directions of movement for characters, so we need to prevent direction towards tiles occupied by an obstacle.

Judging by your posts, I would say you are experienced enough to write your own code based on the following explaination that I will type directly in this thread without compiling.

We have a tile type with our properties set up. MapDepth and MapWidth needs to be set as dwords or byte values representing their obvious purpose

type tileType
obstacle as boolean
id as dword


We have a multidimensional array called tiles( mapWidth, mapDepth) as tileType with 100 tiles in each dimension as an example -

Or we could use a single list like the following if we prefer working with lists:
type tileType
x as dword
y as dword
id as dword
obstacle as boolean


tiles(mapWidth * mapDepth) as tileType

Now the [id] property is optional as we could use the list index as an id for images, sprites and other references; by references we mean ids.

For this example, we will stick with multidimensional arrays.

We develop a level definition with the obstacles set as true or in their tile.

We create a player (or entity) data type with X and Y positions. (I tend to specify Z instead of Y, because to me, from the top down, Z is forwards and Y is up.) Whether Y is the top or bottom (end or front) of the map is up to you, but for this example Y is the top.

player
x
y


Based on this information; we prevent the user from moving towards obstacle tiles using something similar to this; note that I have not properly limited the parameters to avoid array index issues; we will add that part next



So, there we have it. But this is only my way of doing things; we could do it differently.

Finally, to limit the values; I already have my limit functions that can be used to control such parameters; but you can use your own, or perhaps the Styx or Matrix1 Min/Max functions



if tile( limit( player.x + rightkey() , 1, mapWidth ), limit( player.y + upkey() , 1, mapDepth ).obstacle etc....

And that is basic tile collision; Chris style.

So is this the kind of info you wanted? Do we need to explain this further? And do you think a situation will arise where the player will get stuck, due to coded position overrides? or should we move on to displaying the actual sprites?

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 20th Oct 2011 10:28
Some really good follow up posts there guys. Very interesting stuff. When i get back from work i think im going to have a little play about with some of the things you both mentioned (chris and 29) as they look pretty damn interesting. Maybe ill pick up my 2d rpg again if i can get past a few obstacles that were in the way before.
Thank you for the input, all pages like this are getting bookmarked for furture reference as well.
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 20th Oct 2011 12:17 Edited at: 20th Oct 2011 12:19
Quote: "@zenassem - that is good advice thinking outside the box a little and not just worrying about DB pro but also thinking how other programming languages work. However I have tried C++ in the past and it is an awful language for a beginner, very ugly and painful. Many of the principles for just pasting an image are just too far beyond my capacity so I cant seem to learn anything from it. Shame really as I paid over £40 for the massive fat heavy programming principles and practice using c++, its just all garbage to me after the first 150 pages, when I compare it to the first 150 pages of Hands on I seemed to achieve a lot more and in better time."


Pasting an image has very little to do about C/C++ and more to the API one is using; Direct X, openGL, SDML, etc. What you were finding ugly can probably be attributed to Charles Simonyi (inventor of Hungarian Notation [a variable naming convention]) who introduced object-oriented programming and his convention for naming variables to his employer (Microsoft) in 1981. The WinAPI and Direct X were designed using this convention. While I fully understand the need for a structured naming convention for a company like MS, and it's products... I'll admit it's hard to visualize, and adopt into your programs.

The thing is,, unless you want or need to write your own graphics engine,, your not stuck dealing with the API at such a low level. There are plenty of wrappers & game libraries that can hide the details. That's the idea of Dark GDK.

I used Allegro w/ DJGPP compiler.
http://www.talula.demon.co.uk/allegro/readme.html

Your signature has been erased by a mod please reduce it to 600 x 120.
nonZero
12
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 20th Oct 2011 15:37
@dbrekelmans:

Quote: "At first I wanted to do this with a matrix, but I didn't quite understand it and I thought using sprites and creating tiles was easier so that's what I did.
I also want to learn more about arrays (since I don't completely understand them yet).

What other ways are you talking about? "


1. If you want to learn more about arrays, make a really simple data manipulation program. Store data, play with it, twist it, warp it, bend it, (don't) break it, etc...though there isn't a whole lot you can learn about arrays. It's more a case of learning to implement them correctly.

2. What other ways am I talking about? (Not sure if you mean re making the type of game you're making, but I'll assume so).
2.i.Well, basically (abridged version), you could create a single large sprite (or textured 3D plain) for a backdrop and then place entities (Units, rocks, etc) over it.
2.ii. Create an entire image containing tiles of the same dimensions. These can be different terrain types, terrain animation frames, etc. Then use CREATE ANIMATED SPRITE combined with SET SPRITE FRAME and PLAY SPRITE to tile (and animate) your background.
2.iii. Mix and match ideas, bring some of your own in. Imagination's the limit.

Login to post a reply

Server time is: 2024-05-20 06:14:17
Your offset time is: 2024-05-20 06:14:17