Results 1 to 10 of 17

Thread: Online torpedo game

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    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
    Co-Founder





  2. #2
    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:
    Code:
    Procedure TAI.RandomShot;
    
    var c1,c2,i:integer;
        neednewshot:longint;
    begin
           Repeat
                 neednewshot:=0;
                 c1:=random(10);
                  c2:=random(10)+1;
                  for i:=1 to n do {n is a global integer variable it stores how many squares have the ai shot at.}
    
                          begin
               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;
           alreadyshot[n]:=c1*10+c2;
           n:=n+1;
    
           if fleet[c1+1][c2]=3 then
           begin
                 hits:=true;
         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}
         playershipcount:=playershipcount-1;
                 ReDrawBoard_Playerships('hit',c1+1,c2);
                 if playershipcount=0 then defeated;
       end
           else
           begin
                 hits:=false;
         misses:=true;
                 fleet[c1+1][c2]:=2;
                 ReDrawBoard_Playerships('nothit',c1+1,c2);
           end;
    end;
    {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!

Tags for this Thread

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
  •