PDA

View Full Version : New Start



Demonkid43
28-08-2007, 07:17 PM
Hey guys i would just like to inform you that i will be starting my first actual game creation now i know what i want to do would seem a little ..errm big of a job for alot of people but i feel up to it and i feel i either have or can get the knowladge i will need to do it

i was thinking of a 2d game for now kinda much like the original zelda for snes but with more of an advanced battle system like summon night for gamboy advanced or legend of mana for ps1 or even a simpler non 3d version of the tales of symphpnia battle system for GC

now making people move is one thing but making them duck,jump , and atack with a few diffrent moves along with making the ai semi smart will be my chalange...

so if anyone has any suggestions im all ears and i hope you all wish me good luck...i may need it :?

Traveler
28-08-2007, 10:12 PM
so if anyone has any suggestions im all ears and i hope you all wish me good luck...i may need it :?

Well for starters put some dots and comma's and capital letters in your messages so we can actually read what your are typing because now i have to read your message at least twice to understand properly what it is that you are asking us


but i feel up to it and i feel i either have or can get the knowladge i will need to do it


was thinking of a 2d game for now kinda much like the original zelda for snes but with more of an advanced battle system

Funny thing, I had an entire reply written, and then it suddenly hit me. Do a search for this guy. See what else has he been been asking. So I did and then I decided to delete my message and then proceeded to write out my reply (the short version), your future replies as well as the replies to those questions.

Disclaimer
Now mind you, I've seen posts just like the one you wrote here, more times than I can count. So instead of writing the obvious, I decided to put up something else instead. Mind you, it is not meant to discourage you in any way.
This is meant to be humerous, please try to see the fun of it. And try look for the message, because really there is one.

==================== start ==================



so if anyone has any suggestions im all ears and i hope you all wish me good luck...i may need it

-) That's simple, dont do it! You do not have the knowledge to create a zelda clone. Try a pong clone instead, then do arkanoid, then pacman, and then, only then begin to think about zelda.

Your next question:
Huh?

Our answer:
Tell us, what library are you using.

You:
What is that? I'm using Lazarus.

Our answer:
Well a library is a like a wrapper for opengl or directx, so you can more easily use images and sounds in your projects. It may also have functions and procedures to calculate, for instance, the collision detection. Samples for wrappers are Phoenix, Delphi, Asphyre or SDL.

You:
Wow, cool. So what do I use?

Our answer:
Well, since you're uzing lazarus. Phoenix might work there.

You:
Okay,.. now about Zelda.

We:
Now what did we just say a couple posts up. Really, do pong instead.

You:
Sigh, okay. So I gave it a try earlier today and I have these paddles now, but I dont know how to make them collide with the ball. How do I do that?

We:
See, that's exactly why we said you shouldn't do Zelda. You don't have the basics covered.

skipping a few posts now

You:
Guys, guys. I have it finished! I made pong! Here it is, please would you test it for me?

We:
Sure,.. whats the url

You:
oh, duh.. :D:D:D Pong (http://www.mysuperwebsite/pong.zip)
But, now that I made this, I think I want to do pacman next.

We:
Ah okay,.. well if you think you're up to it.

You:
Yeah you bet I am :)
Anyway, I found this site where I took all those sprites from. I'm not that good at graphics you know. ;)

We:
Yeah, graphics tend to be the hardest to do :)

You:
Okay so eh, I want to make the level where pacman is eating the dots. How do I know when he hits a wall? I tried to use collision detection but my sprites wont move anymore after I run the game.

We:
Yeah, you can't use collision detection with the tiles. A better way would be to write your own detection system. For example you could check if the x and y values of pacman are going to hit a tile marked as an obstacle, right before you do the actual movement.

You:
Ehh, tiles as obstacles?

We:
Yeah, (still think Zelda was a good idea ;)) ?
So tell us,.. how did you create your tilemap?

You:
Oh ah,.. I found this tutorial about tiles. Too bad the guy who wrote it used delphiX. :(

We:
Okay,.. so what you could do is create a record
something like

TTileInfo = record
tilenr : integer;
obstacle : boolean;
item : byte;
end;

and then a create a two dimensional array using the record, like this:

TileInfo : array [0..25, 0..25] of TTileInfo;


You can then mark each cell in the array as obstacle where want it to be a wall. Like so:

TileInfo[10,10].obstacle := true;


Of course it wouldn't make much sense to do this for each and every cell, so the best way would be to create a utility that easily allows you to create maps and save them to a file, so you can read them in your game later on.

Anway, after you have marked each cell. You can use loops to draw the entire map.

You:
Great, that was a huge help to me! :D

A couple days later

WILL writes (because he's a kind person and likes to let people know that he (we) is still interested).
Hey Demonkid43, how are you coming along with pacman, is it done already?

And your final reply reads:
No it isn't, I couldn't figure out how to make the ghosts go after pacman. So I abandoned the game.


=================== end ===================

Your reasons are understandable. We all want to create that one game.
But really, if you dont yet understand how the jumping and running in a game is done, what do you think involves basic pathfinding, AI, and combat systems typical for pretty much any zelda game?

Go for the simple things first. Get to know the software, the wrappers. Know what's involved before you even start writing. Before you start, be absolutely sure you know that you can do it. If you dont, dont start and take a step backwards.

Demonkid43
29-08-2007, 12:22 AM
First of all i would like to mention that your start of the post made you seem like a coomplete A hole.
now im sure this isnt the case as by the end of the post you lightend up a bit as you may notice i took notice to your grammer problem and what i really wanted to acomplish is a simple battle system like the games i suggested, nothing complicated and nothing with high graphics or anything.
just somthing to get me started on that colision detection, A.I. , and controls like jumping and ducking.
i have read a few tutorials alot from delphigamedev.com so i can atleast make a little character that will run around so i wanted to try somthing a little more complicated.
now instead of making a person feel like a complete idiot you may want to be a little nicer im sure you have seen alot of post like this and by the way, your role playing of me is way wrong.
now under the sercumstances maby i will try pong as it probly has some things in it that would help and being a simple arcade game wouldnt be extreamly hard to make


thank you for the advice and...lighten up a bit

now i would suppose creating a backround for the pong game may be the first thing i should do?
maby you have a better idea...let me know

DarknessX
29-08-2007, 03:37 AM
Just use a solid black background :)

So you got home finally, did you?

Oh and just to help out a bit, he does know a bit more than he shows... He just doesn't know the etiquette to asking questions on a board like this :)

He's using Jedi-SDL, I think.

WILL
29-08-2007, 05:37 AM
Well don't take Alex's (Traveler) sarcastic/satirical reply personally. He has been on this forum community even longer than I have, so he has seen his fair share of 'new people' who always tell the more experienced ones that they "know better" or that they are special and can do what even the most experienced of the community cannot. It's an old old song and you sung it perfectly to be honest. ;)

The thing is that it is not a crime to want to jump ahead, we all have done it, but we all have also eventually learned that there was always a better, more productive path to where we originally wanted to go.


You see my first few 'games', after I got over my own large ambitions, were rather simple. Here is a brief recap of my own wild adventure.

I started with 'Super Amazing Pixel Guy'. It was a really exciting game which I had this pixel --wait for it-- and I moved it around with my arrow keys. Oh yes, quite the event back in those days (you know when I'd walk 5 miles to school in 40 feet of snow up steep steep hills with nothing but 400 page--gasp--books! :lol: )

But the excitement didn't stop there. I pushed on and created a ground breaking sequel. 'Really Super Amazing Pixel Guy' (2 bah! no one knows how to properly name a game these days. :P) This version I had him constantly moving around without stop. But that wasn't enough for me, I wanted a trail behind him. Yup, thats right, I turned it into a tron game. But not only just 'plain jane' Tron, it was much more complex. I added inside blocks as well as the outer wall from which you could crash. I added 3 other players too so that everyone had to huddle over 1 keyboard just to get a multi-player game in. (Hey back then LAN networks were not a dime a dozen as they are nowadays. And 486 was king! :king:) I eventually added a menu and different player modes for single player and multiplayer; time shrink(walls would close in at a set interval), random block placement, plain arena mode, etc, etc... I toyed and toiled until it got more and more feature full.

Back then the games weren't too complex in visual style so we just used colour for collision detection. It served it's purpose, but as I got on I eventually learned how to confine detection of objects colliding using squares and circles. Arkanoid was the first game in which I did this. It actually started with a bouncing ball program.

It's rather simple, you make a 'ball', you make it move, then you make it bounce off the 4 sides of your computer screen. Thats some basics, so now you get really wacky and figure out how to put in some square blocks to bounce off of too. Heck now add 2 balls. Cool, what if you add more now... wait shouldn't the balls bounce off of each other too? Ha... ok so now it's doing that, why not see if you can optimize things a bit, make sure that we are making use of arrays of blocks and balls and use common functions of your own design to just do the collision on it's own without massive chunks of code to keep track of.

See how this kind of evolves? It's about learning how to do the little things that let you combine them to do the larger things down the road. If you are a self study, you just gonna have to break down and mess around and code some 'junk' for a while. Just get curious with simple stuff. Keep the graphics SUPER-crappy. :) In fact don't use any bitmaps when you are playing. Just pixels, lines, circles and squares, etc... You'll learn very quickly to make a function and how to organize everything in such a way that when you use the more complex stuff you have the basics down.


Now I tried to write this up in a funny way so that you and others can at least get a chuckle out of it, but I am quite serious about the kind of method I'm recommending. See I was in your shoes myself so I know what will help and what will slow you down to getting to the point of making that super cool Zelda game you want to make later on. You can do it, but not now, at least if you want to 'do it right'.

Even now I could start on some big epic RPGs akin to the Final Fantasy ones I know and love, but it's beyond my level so it would be a total waste of time. I'd be better off starting to learn the basics of 3D and light mapping, etc and so on...

Hope this gives you some perspective if nothing else.

Demonkid43
29-08-2007, 06:54 AM
thank you for that post see i was planning things a little diffrently than just simply making a ball bounce
and then making the things it can bounce off of you made it simpler for me by saying that
and indeed i do inderstand that starting with smaller things would indeed be a better alternitive as i know see how the simple arcade games have a lot to teach.
At first i thought well yes it does have some essentials and maby pong does have some essentials, but so does every arcade game and when combined makes up all the big things.
So in carfull review pong indeed is going to be fun to make ...

wow went from zelda to pong how...erm couicidential?
haha

(and see i can get the knowledge for the zelda game...just like this haha :P)

Huehnerschaender
29-08-2007, 08:53 AM
....and now you are right in the "discussion" Traveller posted :)

But let me tell you that this is the best way!

And let me tell you something more. Don't do the mistakes I always do. I use to start very simple projects. I have a simple idea and start programming on this. And there is not a single project of mine that did not grow into much bigger projects because I always have new ideas while programming. And so I never ever finished a single game as a complete release :(

I always do this! So if you are new, make yourself a solid RULE: Plan your project and finish it like it was planned. When the release is READY, you can add features if you want. But first finish it.

:)

Greetings,
Dirk

jasonf
29-08-2007, 09:15 AM
One of the guys on here writes Zelda type games. JDarling.

Check out his PGD2007 entry for an example: http://www.eonclash.com/JumpStart/v4/PGD07/index.php

The Jumpstart engine might be the way to go, I've not used it personally. I couldn't tell you if it's easy to pick up or not.. but he's put a lot of work into it so it should be fairly complete.

I don't know where where your skills lie, Art, Coding, AI.. or what level you're at..

The other guys have already given some good advice if you're just starting out and if that's the case, I'd heartily suggest that you start small as they say.

The reason is, we've All done it, started over ambitious projects only to have our hearts broken by seeing them fail. it really is soul destroying.

If you've got some skill though, then I'd pick up an existing engine and make your game if you can.

If you're an advanced programmer who doesn't mind doing everything from scratch in a way which best suits your game's requirements (assuming that they're different from all other 2D games and cannot be accommodated by any of the existing engines), then you should design and build your game engine and your game should work perfectly... after a few months, maybe a year.

Be prepared for a long slog. You'll spend most of your time getting your engine working properly and you may run out of steam for developing your game.

My next game will probably be a 3D, 3rd person adventure, platform, flight sim (I'm really taking this genre mixing to heart :lol:) but I'll be damned if I'm writing my own engine for it.. Nooo sir! I'm using pre-fab all the way. ready made physics, engine and libs.. I'll design it, write the story, make the graphics, sort out the sound and music and script the game, but I'm getting too old and too tired to tackle the entire code base. In the end, I want to write a game, not just another engine.

Best of luck to you, I'm sure we'll see more of you on here and don't be afraid to ask questions. Help is here if you want it.
But it is true, there are lots of people who want to write games and have absolutely no clue how to do it, they think it must be easy because games are easy to play or they look simple and they want to make a MMORPG as their first game.
Absolutely impossible.

My advice:

Write a design document first. Detail all aspects of your game.
Write down all of the concepts you'll need to fully understand before you even start. Don't underestimate the importance of design.
The only way I could complete my PGD game Crashblock on time was because I had a design which I stuck to (mostly) and refrained from adding additional features. (unless the gameplay demanded it)

I can seriously recommend this book:
http://www.amazon.com/Gameplay-design-Kevin-Oxland/dp/0321204670/ref=sr_1_1/104-9814173-4888759?ie=UTF8&s=books&qid=1188378856&sr=8-1

jdarling
29-08-2007, 01:13 PM
Funny to see JumpStart mentioned :). But, I would not recommend it to someone who wanted to learn pascal. Simply reason is that JumpStart doesn't come with the pascal source code and instead relies upon you building your game code and event code out in Lua. Of course JumpStart is built in Pascal and does run on Windows and Linux using SDL.

Instead, if your wanting to learn Pascal with a scripting language my "example engine" is a good place to start http://eonclash.com/ViewProduct.php?ProductID=23.

Basically its a very very minimal version of a "game engine". First thing I'd personally do is integrate the new version of pLua into it http://www.eonclash.com/LUA/pLua.zip and then get used to it. Then decide on the level integration and what support objects/methods your going to need.

As traveler said, we have seen this all before. And we are ALL guilty of the same thing, I remember back when I started I wanted to build a MMORPG (though it wasn't called that back then cuz we were all on BBS's). LOL sure thing here I am many years later and still haven't built the MMORPG :). I have the knowledge but have realized that the funds are a different story.

As for starting point, try documentation out (I'll toot my own horn again). I wrote the 1st article on this http://www.pascalgamedevelopment.com/viewarticle.php?a=67&p=1#article and have been working on the 2nd as I have time. If you can honestly take the time to spend building your documentation out properly you are more likely to complete your game. You will have the goals you need, and have check points to test against. In fact, even if you fail (and be ready to fail) you will at least have a tangeable asset to weigh the failure against and find solutions with.

Well, I've rambled enough... Let us know how it goes as we all love to see others go through the same pain we did (It's kind of like getting married, you think you know it all till its over with, then you realize you didn't know anything).

Demonkid43
29-08-2007, 03:36 PM
can somone explain what a game engin is as you all are talking about it and i dont really know what it is...thank god i demoted to pong

:?

WILL
29-08-2007, 04:05 PM
A game engine is anything from a set of libraries to pre-compiled game code that you can use to make a game out of. The some or most of the basic gameplay is already made up for you, you just have to finish it off. The idea is that it does most of the basic stuff for you to be able to get to the more advanced things in your games.


I'm going to contradict Jason and Jeremy now. :) It's not that they are wrong, but they are speaking from the perspective of someone who has been making games and game tools for a while now. Unfortunately you have to crawl a bit before you can first walk.

At your level you should not be playing with pre-made game engines and design docs just yet. Later on definitely, but not now.

For now learn the BASICS. You need to understand all those basic things that an engine will do for you. Otherwise you'll be so dependent on the engines to do it all for you, you wont know how to do something if it's not in the engine. Plus it not only helps, but it is essential that you know what these things are so you can properly make a game so your not always poking around blindly and wasting your own time.

Documentation would be a waste of your time as well. With what you have to learn it's not worth it. And you are doing this for the pure benefit of learning. You won't be making anything worthy of a polished commercial or shareware/freeware release. Not yet... Docs are meant to help you keep on track of your project's plans and stay on task. A simple pong game to learn the ability of basic collision detection and object movement is hardly the kind of task that needs a design doc. :P


I was pondering if I should write a couple of quick and dirty beginners/entry level tutorials on these things. It helps to have material to learn from at the beginning of course, yet there is so little for Pascal programmers. And the older stuff always seems to disappear over time. Maybe others can chip in too. It would basically involve all the simple things us more novice to advanced guys usually take for granted. ;)

jasonf
29-08-2007, 08:24 PM
I suppose all of this apparently confilcting advice is very confusing and may make you think that we don't know what we're doing...

But it's not like that at all, we've all been coding (not just games) for so long and suffered the torment of learning the small stuff that we want to nurture you along, guiding you through the minefield so you can make progress without making the same mistakes as we did.. (as we do for everyone starting out, irrespective of how it may appear at first) but that on it's own has a problem. Knowledge comes from study and understanding, but wisdom comes from trying and making mistakes through lack of knowledge and wisdom.. You can't do anything without wisdom, study helps to minimise the mistakes, but true wisdom only really sinks in when you make a really big balls up and learn from it.

I think, basically, you have to accept that you're gonna make some real klangers along the way and you have to find your own way through the mine field.. but at least now you know there is amine field there and you're not thinking you're taking a nice stroll through the prairy only to meet with a very unexpected and unpleasant suprise.

I still make mistakes... daily... some are huge.

One day, perhaps, I'll reach the coding nirvana where I know it all and can do anything.. then, they'll bloody go and change everything so I'll just know everything about something no-one uses anymore :lol:

This blurb is sponsored by Grolsch, the beer of champions :D

Huehnerschaender
29-08-2007, 08:45 PM
Jason, please don't drink and surf :)

Traveler
29-08-2007, 10:02 PM
thank you for the advice and...lighten up a bit


You're welcome. :)

See, the thing is, I realized there were two ways I could give you the advice not to start with what you were planning.
I could do A) what we always do and write down why you shouldn't create zelda.
This has however been done time and time again, and people take it for granted, write down their thanks and continue to do it anyway and you often never hear from them again.

So instead, I thought I'd try B)
Make a scene first, maybe get you on your nerves a little, but still enough to keep you interested. Then add a fictional discussion of typical questions asked so often here, and add answers that many of us here write down daily. Mix a whole bunch of these together so they not only relate, but also tell a (familiar) story and maybe it will get the point across. (Which I hope it did)


I realize B is not something I should make a habit of doing more often. It could potentially tick new people off, to never visit PGD again. But then again, sometimes you need to try something else, and see what it does.

I this case, I'd like to think it worked out well.

Demonkid43
29-08-2007, 11:30 PM
bahaha ok i would fist like to start with will
yess indeed a tutorial of all the basic things would be usfull as (now dont hold it against me here).
but there was a time when i was trying to learn the basics of i guess you could say hacking
and all i could find was that there were a whole bunch of information on things i didnt understand and didnt know even words like for instance "game engine" that i had no clue what they were.
it was indeed a new tutorial simpley called the basics yes..."The Basics".

That tutorial told me everything i needed to know about all the other files and what they actually ment and what they did in which progressed my knowladge and got me started however my intrests grew more so off the computer than on and now i have returned to my old friend to learn somthing new...Pascal/Delphi.

The poit is that a basic beginers tutorial is almost an essential thing as it can describe some new things that other tutorials that simply teach coading do not.

now Jasonf baha this part makes me laugh

"I think, basically, you have to accept that you're gonna make some real klangers along the way and you have to find your own way through the mine field.. but at least now you know there is amine field there and you're not thinking you're taking a nice stroll through the prairy only to meet with a very unexpected and unpleasant suprise."

imagin that literaly walking through the plains wistling when...BANG bahaha sorry i know it isnt related to the post but i though it was kinda funny :P.

and for Traveler
well you see being arrogant somtimes does have its advantages and on alot of people your right it would totaly have turned them off this site.

but i have that screw you all attitude if nobody wants to help, i will learn myself as when i was learning to hack all the other hackers i could comunicate with seen me as a noob and aparantly nobody helps noobs in that kind of society, unless you really know how to speak to them....i dont.
haha.
So although a little discouradged that i didnt see any resaults i wanted i was patient enough to wait for the ones that were needed.
thank you.

now i think that about covers it so i know,
i know how to make an object move however,
i dont know how ot make it move in anyspecific direction wihtout having to push a buttion or make it bounce...and i assume that mite be essential for pong.
Ayone know a good pong tutorial haha i meen a programing one cuz if you need one to actually play pong you shouldnt be playing it lol.

WILL
30-08-2007, 02:08 AM
Well I'm glad to have the 'stick with it no matter what' attitude. At times you may need that. ;) There will be times when coding something becomes 'un-fun' or you just get stuck. Happens to everyone at all skill levels.

Though I'm sure that you won't need to tell anyone here to screw anything. Unless you have some joint hardware project in mind. :P) You'll find that we are all generally friendly and helpful. Dom and I didn't tolerate poor behaviors early on so it seems to be sticking. That and we got lucky and most of those that hang out in these forums are generally good people with kind hearts.

That and I think the average age range has something to do with it. Lets face it the older you get, so the nicer you are... generally. Probably having something to do with the fact that we are all that much closer to death. :lol: I'm kidding there of course, but we are of good intentions and do want to help where we can.

So don't be discouraged, just adjust your strategy for the better. It will happen a lot. :)


Now to answer you more specific question; How do I make an object move independent of holding down a key?

Well the best way to do that is to have variables that hold the direction/speed of your object. Then you can have your input controls adjust these two values the way you want.

You will also have a separate block of code that handles movement alone. Generally a game's main game loop will look something like this:

begin
Init_Game;
Reset_Game_Clock;
while(Quit_Flag = False) do
begin
Read_Player_Controls;

Move_Player;
Move_Objects;

{ ...other functions, etc... }

Clear_Screen;
Draw_Background;
Draw_Environment_or_Map;
Draw_Player;
Draw_Objects;

if (Check_for_GameOver_Conditions = true) then
Quit_Flag := True;
end;
Deinit_Game;
end.

Now this is just an example you may have enemies, or your 'player' might be moved using the same function to move other objects too. It all depends on the type of game you are making.

In the way of pong it's a bit more like this...

var
BallCount : Integer = 5;
begin
Init_Game;
while(Quit_Flag = False) do
begin
Read_Player_Controls;

Move_Paddle;
Move_Ball;

Do_Ball_Collision; // involves block/wall/paddle detection, ball reaction, block removal, etc...

Clear_Screen;
Draw_Walls
Draw_Blocks;
Draw_Ball;
Draw_Paddle;

if (Ball_Went_Off_Screen(BallObject) = true) then
begin
dec(BallCount);
if (BallCount <= 0) then
Quit_Flag := True;
end;
end;
Deinit_Game;
end.

Your ball object would have, at least, these variables...

var
BallX, BallY: Integer; // The location of your ball on the screen
BallVelX, BallVelY: Integer; // The Speed of your ball along X and Y axis

Now the ball would move on it's own using random speed/direction. You'll want to have a VelX and VelY for the ball. This is the simple 'Velocity' values for your X and Y axis movement. Each 'frame' of movement your ball will move 1 value of VelX along the X axis and 1 value of VelY along the Y axis. Do this once each time through the loop so that it is done independently.

BallX := BallX + BallVelX;
BallY := BallY + BallVelY;

Now you are probably wondering "well now it just flies off the screen! What good is that?". That my friend is why you need to add wall detection.

To do this is very simple. You check your BallX and BallY values against the sides of your screen. Which would be (0,0) for your top left and (ScreenWidth,ScreenHeight) for the bottom right.

if (BallX <= 0) then // your ball has hit the left wall
BallVelX := BallVelX * -1;// so reverse the direction by switching the sign of it.

See how that works? Now just do it for all 4 walls and you have a bouncing ball program with a simple movement. To turn it into pong all you have to do is add blocks and the paddle and remove the wall which you will add the paddle to. Not very far away at all.

Work with this and see what you can get going. If you have trouble or get stuck just ask and we'll do our best to help. Once you've gotten this working I can elaborate more on how to get it into a pong game. In fact, I might have that tutorial typed up by then. :)

Oh and if you are using JEDI-SDL have a look in the SDL/Pas folder inside sdl_utils.pas for some handy drawing functions. Namely the circle, rect and line functions. Very similar to what I had when I first learned game programming so you're in luck. ;)

NecroDOME
30-08-2007, 05:12 PM
I added my very old pacman project to the tutorials page for beginners to learn from. If you can improve it, do it plz.

anyway here's the link: http://www.pascalgamedevelopment.com/viewtopic.php?p=38130#38130


EDIT: I quickly checked the code and noticed: "while(Quit_Flag = False)". Please use a timer. This way you don't block windows messages. "Application.ProcessMessages" (Delphi) is a bad way to invoke messages. And in the meanwhile you learn how to use a timer in your game!!

WILL
30-08-2007, 08:01 PM
Myself, I don't use timers. ;) Besides when I was first learning I never had any of the Windows features. In fact I think that if he is still learning to make pong, threaded applications are the least of his problems. Too much new ground to cover there, let alone application messages.

Simple stuff first, more complex stuff later. :)

Demonkid43
30-08-2007, 09:14 PM
thanks for my next project maby i will make a packman but for now i still have to find lazarus again haha

Demonkid43
30-08-2007, 11:11 PM
alright got lazarus but my computer freezes and it wont compile i can end the compiler proccesse and lazarus is back to normal but it wont compile...anyone ever had this problem before

:twisted: i finaly got home so i have fast internet not crappy dial up and i cant even start :twisted:

Demonkid43
30-08-2007, 11:39 PM
ok i decided screw it :?

im going to do it in complete pascal i was going to use lazarus but i dont uinderstand were everything is put in the code i need to know format can anyone point me to a tutorial on this

NecroDOME
30-08-2007, 11:40 PM
@will, when you use a timer, you don't interact with threads, just the idle event of your application.
If you have the chance, use a timer :P

WILL
31-08-2007, 05:03 PM
You're right, I had threaded timers in my head at the time. :P Still I warn against them. Not useful knowledge at this time.

Well anyways, the non-use of a timer is my personal preference. I don 't use them because I see no value in them the way I make games, but then I've advanced far enough to find my own ways of doing things, 'right' or 'wrong'. :)

The best way to go about learning the basics is to throw out any of the more modern stuff and just go with basic pascal. I know some might freak out at that idea considering that OOP is 'the way to go' nowadays, but remember that Object Pascal is an extension of the original Pascal.

Just for your own good stay away from pointers, manual memory allocation and the like at this stage and you'll be fine. ;)

As for Lazarus, you don't need to make an 'Application' project. Instead choose 'Program' under File -> New...

This is the most minimalistic template you will start with. And the IDE features of Lazarus will help you a lot! This is how I start most of my new game projects actually.

In fact, if you like I can make a basic template for use with Lazarus if you like?

Demonkid43
31-08-2007, 06:37 PM
yes please and i am switching to pascal simply because i need to learn were to place things in a format and i need to brush up a little on my basics of pascal.
So a template would be help full.

WILL
01-09-2007, 12:44 AM
Ok I'll make up a simple project to get you started. I guess this might lead into a small beginners tutorial on how to get start a games project with Laz/JEDI-SDL. :)

WILL
01-09-2007, 01:43 AM
Just finished making the template project for you.

Here it is... (http://www.pascalgamedevelopment.com/files/188/JEDI-SDL_Game_Template.zip)


Now before you can jump right in and start programming away, you'll need to do a few things first.

1) Make sure that you have Lazarus 0.9.22 installed.

2) Get and unpack the latest JEDI-SDL in a path that you will be able to remember. REMEMBER it's path!

NOTE: I recommend putting it under the same folder that you put all your other project files for easy access.

3) Download and unzip this folder into a folder that you will use to store your projects. The easiest way to organize each of your game projects is to have a separate folder inside your projects folder.

NOTE: You'll notice that there is 3 files inside of this zipped up folder.

Project1.lpi -- This is your Lazarus Project Information file. Instead of code, this file stores all of the settings and configuration specific to your project. You can use it to open your project by double-clicking or selecting it in the Lazarus Open dialog window.

Project1.lpr -- This is the main source file of your project. It is the Delphi equivilent of a .dpr file. You will be editing this the most. You can also use it to open your project through the Lazarus dialog window or double-clicking on it.

sdl.dll -- This is the dynamic SDL library. There needs to be a copy of it in either the folder of the compiled .exe you run or within the system path. Some recommend putting it into your system path, but it then becomes easy to forget that you need to send a copy of it along with your games to allow others to play it or else they need to hunt down a copy themselves. Not too many people like that, so I keep a copy inside each SDL game I make so that it's easy to just package it together. It's not very big at all so this is a non-issue for me. I'd recommend that same for you.

4) Now that you have everything else setup, you can configure your template project. Open it up using one of the 2 above noted ways. Be sure to click on the 'Open Project' option if it asks you!

5) On Lazarus' main menu go to 'Project' -> 'Compiler Options...'. A new window will pop up with a bunch of text fields and '...' buttons beside them. The top text field is where you will type in the path to the sdl.pas unit file. This is in the 'SDL/pas' path within the main folder of your JEDI-SDL installation.

5a. An easy way to find the correct path is to use the '...' button to pop open the 'path finding' tool and simply navigate to the folders you need yourself. This will also be useful as you come to need other new units that are not within the core SDL library.

6) The next one below it is where you will fill in the same path, but for the .inc file required by JEDI-SDL to function properly. You can safely copy and paste your new path from the top field into this one if you made sure the above is correct.

7) Once this is done go to 'File' -> 'Save'. Now you can use this to make a copy and start a new project from scratch from it.

8) To start a new project, do not alter this one. In fact create a copy by going to 'File' -> 'Save As...' and go into you own self-made project folder, create a new folder for the new project, go into it and save it to whatever you want to call the project. Project1.lpr is only the default name, you can call it whatever you want. And REMEMBER to make a copy of your sdl.dll file to the new project so that it will run!

NOTE: Whatever you name the project file to, is what the compiled .exe file name will be after it is compilation.


Thats it! You're done and you can start making that super-cool pong game. ;)

Demonkid43
03-09-2007, 11:59 PM
O.K first of all i got it all set up...i think :P.

So now ,
WILL you said if i should work with that code a bit and talk to you so you can, " elaborate" on some more things.

I think you elaborated a little to much on the first post (page 2).
Although i understand what all that coding means to a sense on what it does. I still don't understand how it works and i assume that chunk of coding would go somewhere in the middle of the source code somewhere well the begining of the whole program is not explained there and i don't know how to make the beginning of a program all that good like

theres the program command

there is a begin

then you define your variables i think

and then im lost i used to know as DarknessX has shown me but that was a wile ago so im a little rusty that and he showed me before he wrote all those neat coding tutorials haha :P

so i need a place to learn the start of a program i have checked a few tutorials but all they do is explain what everything is and i just need to know how it works and were it can go .

thanks!

WILL
05-09-2007, 08:04 AM
From what I just read it sounds to me like you have not done any programming or worked with compilers before. Am I correct?

Nothing to be ashamed of, but it helps to know this so we actually know what to teach you.

For the benefit of being constructive; I'll assume that you are going to give me a 'yes'...

I'll give you the basic program structure and some things to start you out, BUT --and heed this!-- you are going to have to do a fair bit of reading on your own. Get books, download books on (Object) Pascal from a store, library, online whatever. There is no way at all you are going to grasp how to make programs, let along games, unless you study the art of computer science... programming. It's not hard to learn, but it's also not like learning how to use Photoshop where you just point and click, as you can imagine.


You need to understand that you are not even at pong yet, you're at 'Hello World!'. :) I'm not going to tell you how long it will take you to get to pong-level stuff, thats entirely up to you, but without the knowledge of basic programming, your really just going to be poking around in the dark not knowing what you are doing and pretty much next to useless if you want to do something constructive. You can't skip his part, boring or not it's what making games is made of. If you didn't already, now you know. :lol:


Skipping the usual highschool Computer Science 'introduction to' crap, every Pascal program compiled by a pascal compiler follows this core structure:

program ProgramName;

// uses, var, const, type and function declarations....

begin

end.

This is as simple as a Pascal program can get...

:arrow: After 'program' goes the name of the program. You can use any alpha-numeric characters and the underscore, but NO spaces. However, just like all variable, type, constant and function names it cannot start with a numeric character! This is the first thing the compiler looks for so it must always be at the top on the first line.

:arrow: In-between begin and end. goes the main block of code. This is where your program starts after it has initialized. Included units can have their own code blocks, but this where the main part of the program goes. I'll explain more about what a unit is later.... don't worry about them for now.

:arrow: Above the main code block you'll notice that I have put in a comment. Comments are segments of code that are there for the programmers only. It helps them to better understand are either contained within the { and } characters or follow // on the same line.

Some Object Pascal compilers also have the (* and *) brackets. These are kind of like super comments in that everything including the { and } comment brackets are ignored. I'd stay away from using these for now though. At least until you get your Pascal-legs first. You'll appreciate the difference in their usage then.

You will generally want to declare your program's variables at the top of your program, but anywhere above the main code block and below the Program declaration line. This is indicated by my single line comment above.


Here is a really basic example of how to print text to the screen...

program HelloWorld;

begin
writeln('Hello world!');
end.

There she is... that is the infamous Hello World program. All it does is print out a single line of text that says...


Hello world!

If you took this program and an it though a compiler to see for yourself, you probably have a confused look on your face. Yes, the program appears to close right on exit. You might not even see the console window draw anything it would be rather fast, even for a 'slow' computer. This wasn't a problem back in the DOS days, but all this program does is draw a line of text. It doesn't wait, because there is nothing to tell it to.

We can do this by adding another line to tell the program to wait for some user input. Here is Hello World revised...

program HelloWorld;

begin
writeln('Hello world!');
readln();
end.

Now the program will wait until you have entered in a line of text and pressed the enter key.


That is the basic program structure and how to write a simple program. What I recommend from this point is that you learn how to do some reading up to learn a few needed things. I have made up a check-list to help guide you. After you have learned all of these key things and how to code them, you should be able to start making more complex programs. Don't skip any of these as you will DEFINITELY want to know this stuff if you are going to make games.


I recommend tackling these in this order...


How to Program Checklist:

:arrow: Declare a variable and set data types.

:arrow: Assign a value to a variable and do calculations.

:arrow: Check for conditions with if ... then and else.

:arrow: Check for conditions with a case statement.

:arrow: Create and use constants.

:arrow: Repeat code with while loops.

:arrow: Repeat code with for loops.

:arrow: Repeat code with repeat loops.

:arrow: Declare an Array and assign values

:arrow: Work with strings and how to convert a Real or Integer value into a String value.

:arrow: Declare your own commands with procedure.

:arrow: Declare your own commands with function and learn how it returns a value.

:arrow: Creating and using records.

:arrow: Creating and using sets.

:arrow: Write your own unit.

:arrow: Read and write to and from Text files.

:arrow: Read and write to and from Binary files.

At this point you should be in a good place with the language and able to move onto more graphical programs, learn other 3rd party units or (libraries as they are more commonly called)...


Once you have a grasp on these and have made a few things that you have successfully compiled and ran tested. Made mistakes with and found your error and fixed them a few times, you will be able to move onto the more 'powerful' parts of the Pascal language...

Here is a pretty good beginner's tutorial to get started: The Basic of Pascal (http://www.geocities.com/SiliconValley/Park/3230/pas/pasles01.html)

There are some things that are Turbo/Borland Pascal 7 era, luckily Free Pascal is fairly compatible with most of those things.

If you want to make a new program for learning while using Lazarus, just choose 'Project - Custom Program' in the New... dialog window.

WILL
21-09-2007, 10:03 PM
So how are you coming along?

Would be a shame if you gave up, you seemed so determined.

Demonkid43
21-09-2007, 10:45 PM
eh i decided i wasnt going to start on programming just yet as there are a few basic other things i want to learn on the computer first more so on how the internet works a bit better and such but i will come back to show you all i can make a pong game one day :P

arthurprs
21-09-2007, 11:57 PM
Hi WILL i will send you a sample code by PM, if you like you can use it in this topic

WILL
22-09-2007, 03:59 AM
Ok, I guess thats fair.

Just know that even though it may seem a bit overwhelming at the very start, most people that are really interested in game and even just graphics programming find learning to program very rewarding at several stages through the learning process. You just have to 'start right' thats all. :)