Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Online torpedo game

  1. #11
    okay I finally solved this now the program actually runs without an error message. which is a good thing Now I just have to finish those functions and procedures and check if everything works fine(since running w/o error message doesn't mean it works well too) And correct a major bug with the SDL because now it freezes for some reason, it should not be a big problem. I think my beta version will be ready latest by the end of the week. I finally start to get the syntax and basic concepts of OOP too. And during I'm learning OOP I'm also learning the usage of pointers. Since my older programs were not big and the most complicated method was searching/modifying something in a binary file I didn't have memory issues and didn't need pointers at all, but now I want my game to run fluently.

  2. #12
    No offence, but I'd suggest learning the syntax first before you start writing a game so you won't bite off more than you can chew. If I may suggest, I'd start by reading thoroughly the Delphi Basics website.

  3. #13
    I have never learned like that. I can not just learn the syntaxes I am physically unable to do that. I learn the syntaxes by writing programs.
    Now I got the most interesting error ever. So the main program looks like this:
        {parts not written yet}
    Now the error is a simple runtime error #201 it should be a range check error. But if I place a Breakpoint ANYWHERE in the program and by this I mean the subprocedures, a function, or the main program, even just before the last END, the program does not return this error. I'm wondering why is it doing that since in the main program there isn't any loop that should overload a variable or anything like that and the procedures should be okay as the program runs just until the last Readln; line if I put the breakpoint there. However if I do that, the program seems to skip some procedures(especially the ReadShot procedure) and just freezes. It might be a wrong code(with the ReadShot procedure) but since I couldn't solve inputing strings with SDL I had to read the coordinates with mouse and it creates a whole bunch of complications. Besides. I've been having an error with SDL ever since I got it: The SDL screen simply freezes irreversibly if I change to another window. This is a big problem as I can not use F7 to find the exact source of errors and I have to restart the whole IDE after every breakpoint check and inputing things becomes very complicated too.

  4. #14

    Its first version is almost finished =)

    Okay I have got rid of all of the major bugs. The game is now theoritically playable. What is left to be done:
    1) The ships are yet just random squares they don't form a ship this should really not be a problem I just write an organising procedure and there it is.
    2) Graphics. Now I always use simple sprites for testing(red square, gray square etc...) but a game should really not have graphs like that
    3) Sounds. Should not be a problem either.
    4) A menu system with some kind of in-game menu with nice functions. Any good games have these why won't I put them in mine? I think it won't be hard altough it could be a bit tricky. Especially the in-game part.
    5) This is the most interesting part: make it work online. I think I will save this for later... I'm just not skilled enough for that yet.

    Now as you can see most of the remaining parts of the game takes more time than skill to get them done. And that's what I hate in designing games(I have like a dozens of game maker games all done with complicated calculations, AI and stuff like that but I was way too lazy to do the health-life counts, animations, spirtes, musics, backgrounds, level-designs and all the easy stuff...). Someone said I could lose interest if I made the game too hard to design for my skills. Well actually I usually lose interest at these parts of the game. When the hard parts are done and just time-work is what's left. Anyways I will finish this I've decided it. I just messed up too many hours and nerves on it not to do so However this is my very first game written in Pascal and still I got many help from you guys here(for which I am very grateful) I think I could be proud of myself. I really also solved things by myself I wouldn't have imagined I could a few weeks ago. Also this one simple game at least doubled my programming skills. It gave me some insight into OOP and SDL too. It's been a useful week.

  5. #15
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Blog Entries
    Sounds great, I expect a screenshot and a link/attachment copy of your finished first version for us to try.

    It makes a huge difference when you take smaller steps to learn the basics at the beginning. By posting your projects you can also let others see how it's coming along as well. Some errors or bugs can get pointed out and we can give tips on optimizing and polishing up any glitches or bugs we run into. Plus it helps to show activity in the area of programming here too.

    If you need further help with graphics (I recommend starting with the BMP bitmap graphics format before you go off and try getting PNG and all kinds of other formats involved) sound or anything else, just ask, we like helping others. (Just try to post in the related forum categories ) As for the 'time consuming stuff', we all go through that too. I personally get some joy out of looking at the project running where you don't see much of anything in my game window/screen, but after plugging away at it for a couple of hours I give it a run and wow what a difference you see after. That's what has always kept me going making games for all these years.

    Though lately I mostly write about game development and manage sites and edit magazines.

    Nice job! Keep up the good work and it'll be completed in no time.
    Jason McMillen
    Pascal Game Development

  6. #16
    I will load it up somewhere and give links As soon as it is finished. I will then accept opinions, suggestions and bug reports. I realised however I will also need a better AI. Since the squares where ships are located is totally random shooting at random places is yet okay but after the organisation, shipparts will be adjecent to each other so the AI will take that into concideration and count differently if it made a hit. For now the shooting procedure is like this:
    Procedure TAI.RandomShot;
    var c1,c2,i:integer;
                  for i:=1 to n do {n is a global integer variable it stores how many squares have the ai shot at.}
               if alreadyshot[i]=c1*10+c2 then neednewshot:=neednewshot+1; {alreadyshot is an array of bytes of the object type TAI which stores at what squares tha ai has already shot at to make sure it won't shoot there again}
          end; //This is in begin-end because I might add some additional factors later.
           Until neednewshot=0;
           if fleet[c1+1][c2]=3 then
         misses:=false; //These two are variables of the object type TAI
                 fleet[c1+1][c2]:=1; {global 10x10 matrix variable it stores the shipplaces of the player}
                 if playershipcount=0 then defeated;
    {ReDrawBoard_Playerships(hit:string,x,y:byte) is a procedure to draw either a red(hit) or gray(miss) square at the shot coordinates.}
    Now my plans are to make a procedure TAI.AccurateShot(x,y:byte); so inside the TAI.AITurn procedure there will be a check. Until a hit is made the TAI.RandomShot will be called. If the AI hits it will shoot at adjecent squares to that coordinate(x,y) until there aren't any adjecent squares left to be shot near any hit squares. Then the TAI.RandomShot will be called again etc. This isn't as easy as I thought I think however I will be able to do it. But for now I'm packing because I'm going home. Have a nice weekend everyone!

  7. #17
    I do not know what you are using a compiler, but you can say you are using Delphi, you can create a class from TPersistent descendants. You want to transfer the data can be stored in this class of property released ... then you can use in the Delphi streaming mechanism, and said, Indy components and simply flow through the socket connection class.

Page 2 of 2 FirstFirst 12

Tags for this Thread


Posting Permissions

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