Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32

Thread: New Start

  1. #21

    New Start

    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

  2. #22
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    New Start

    @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
    NecroSOFT - End of line -

  3. #23
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    New Start

    You're right, I had threaded timers in my head at the time. 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?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #24

    New Start

    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.

  5. #25
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    New Start

    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.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #26
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    New Start

    Just finished making the template project for you.

    Here it is...


    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!

    [size=9px]NOTE: I recommend putting it under the same folder that you put all your other project files for easy access.[/size]

    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.

    [size=9px]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.[/size]

    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.

    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!

    [size=9px]NOTE: Whatever you name the project file to, is what the compiled .exe file name will be after it is compilation.[/size]


    Thats it! You're done and you can start making that super-cool pong game.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #27

    New Start

    O.K first of all i got it all set up...i think .

    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

    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!

  8. #28
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    New Start

    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:

    [pascal]program ProgramName;

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

    begin

    end.[/pascal]

    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...

    [pascal]program HelloWorld;

    begin
    writeln('Hello world!');
    end.[/pascal]

    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...

    [pascal]program HelloWorld;

    begin
    writeln('Hello world!');
    readln();
    end.[/pascal]

    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

    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.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #29
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    New Start

    So how are you coming along?

    Would be a shame if you gave up, you seemed so determined.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  10. #30

    New Start

    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

Page 3 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •