UnderwareDESIGN

PlayBASIC => Show Case => Topic started by: esper on February 23, 2015, 01:30:46 PM

Title: Star Captain WIP
Post by: esper on February 23, 2015, 01:30:46 PM
Hey everybody. I've been working on a project for about a month now and I think it's complete enough to release a WIP.

Introducing STAR CAPTAIN! It's a retro space simulation game based on one of my favorite Commodore 64 games, Roadwar 2000.

You take control of a small space ship and travel through the galaxy collecting new weapons, ships, resources, etc.

I'm not the best programmer, so I've hit a bit of a wall, and if anyone likes this demo and would like to help out I would be ridiculously happy for that.

Screenshots:
(http://thewatcherssociety.net/hostedfiles/screenshot%201.png)

(http://thewatcherssociety.net/hostedfiles/screenshot%202.png)

I hope you enjoy it. At the very bottom of the source code is the list of things I feel I have yet to do before the game can really be considered complete and the list of things I'd like to do in a future release. Like I said, I don't know if I can really implement these things, as I'm kind of stuck where I'm at as it is, and if anybody would like to help I would really appreciate it.

EDIT: version 1.2, Starmap added, Text Manual added, plus some code-fresheners suggested by Kevin

Title: Re: Star Captain WIP
Post by: esper on February 23, 2015, 04:47:46 PM
I should probably explain the controls a bit, since I just realized the manual is in a Photoshop file and not everybody may be able to open it. Numpad keys move (8 is up, 6 is right, 2 is down, 4 is left, 7,9,1, and 3 are diagonal). R shows you a ship report. Q opens the game menu (EDIT in the menu you can open a starmap or call a tow if you get stranded). If you obtain an engineering bay, E repairs your ship. You can currently hit P to force combat, but I wouldn't... it makes life difficult since combat isn't necessarily balanced yet.

To interact with a planet, a station, or an asteroid, move toward its center and then follow the prompts as they appear on screen. And, finally, if you want to skip the opening screens and just start with a basic game, comment out line 214.
Title: Re: Star Captain WIP
Post by: kevin on February 24, 2015, 12:00:36 AM
Esper,

    Haven't time to have a look at this today, but from the screen shots it seems you've done a pretty good job so far.. Congrats !


Title: Re: Star Captain WIP
Post by: esper on February 24, 2015, 08:13:47 AM
Thanks, Kevin! I hope you enjoy it once you get a chance to play with it a bit. It's based on old Strategic Simulations, Inc. (SSI) games like the ones I used to play on my Commodore 64 as a kid, and the combat system is based on the Bard's Tale combat system.

I've had an immense amount of fun developing it thus far! Thanks for the tools to do it with.
Title: Re: Star Captain WIP
Post by: BlinkOk on February 24, 2015, 04:07:39 PM
looks awesome esper. i remember an similar (ascii) game i used to play on mini computers named after star trek.
really nice work mate
Title: Re: Star Captain WIP
Post by: esper on February 25, 2015, 08:00:17 AM
I think I remember that one. You could blow up your ship if you got stuck... with the Corbomite Maneuver. Fun times!
Title: Re: Star Captain WIP
Post by: kevin on February 25, 2015, 08:17:14 PM
 Had a (very) quick go this morning, seemed pretty cool so far, although i'm not too sure how to play it..  


a quick glance at the code and there's seems to be some places where you could reduce the footprint without changing the behavior.  One should place is the LOAD Game/SAVE Game functions.


 in LoadGame() there's a block of unrolled code (100 lines) that reads the properties from the file to a 2d array..  

[pbcode]

         weapon(1,1).accuracy=readint(1)
         weapon(1,1).damagemin=readint(1)
         weapon(1,1).damagemax=readint(1)
         weapon(1,1).size$=readstring$(1)
         weapon(1,1).name$=readstring$(1)
         weapon(1,1).shots=readint(1)
         weapon(1,1).recharge=readint(1)
         weapon(1,1).damtype=readint(1)
         weapon(1,1).cost=readint(1)
         weapon(1,1).dist=readint(1)
         weapon(1,1).charge=readint(1)
         
         weapon(1,2).accuracy=readint(1)
         weapon(1,2).damagemin=readint(1)
         weapon(1,2).damagemax=readint(1)
         weapon(1,2).size$=readstring$(1)
         weapon(1,2).name$=readstring$(1)
         weapon(1,2).shots=readint(1)
         weapon(1,2).recharge=readint(1)
         weapon(1,2).damtype=readint(1)
         weapon(1,2).cost=readint(1)
         weapon(1,2).dist=readint(1)
         weapon(1,2).charge=readint(1)

   etc etc etc

[/pbcode]


   It works, but a you can do the same thing within a FOR/NEXT loop


[pbcode]

                  for lp =1 to 9
         weapon(1,lp).accuracy=readint(1)
         weapon(1,lp).damagemin=readint(1)
         weapon(1,lp).damagemax=readint(1)
         weapon(1,lp).size$=readstring$(1)
         weapon(1,lp).name$=readstring$(1)
         weapon(1,lp).shots=readint(1)
         weapon(1,lp).recharge=readint(1)
         weapon(1,lp).damtype=readint(1)
         weapon(1,lp).cost=readint(1)
         weapon(1,lp).dist=readint(1)
         weapon(1,lp).charge=readint(1)
      next   

[/pbcode]



   Same thing for  SaveGame..


[pbcode]

           for lp =1 to 9
         writeint 1,weapon(1,lp).accuracy
         writeint 1,weapon(1,lp).damagemin
         writeint 1,weapon(1,lp).damagemax
         writestring 1,weapon(1,lp).size$
         writestring 1,weapon(1,lp).name$
         writeint 1,weapon(1,lp).shots
         writeint 1,weapon(1,lp).recharge
         writeint 1,weapon(1,lp).damtype
         writeint 1,weapon(1,lp).cost
         writeint 1,weapon(1,lp).dist
         writeint 1,weapon(1,lp).charge
           next

[/pbcode]


   In the globals at the top of the source, the colours should be defined as constants

[pbcode]

   ; this stuff
global GREEN=RGB(64,244,64) : global YELLOW=RGB(255, 255, 64) : global BLACK=rgb(0,0,0) : global WHITE=rgb(255,255,255)
global RED=rgb(224,64,64) : global CYAN=rgb(96,255,255) : global MAGENTA=rgb(224,96,224) : global BLUE=rgb(64,64,224)
global ORANGE=rgb(224,160,64) : global BROWN=rgb(156,116,72) : global PINK=rgb(255,160,160) : global DGREY=rgb(84,84,84)
global GREY=rgb(136,136,136) : global LGREEN=rgb(160,255,160) : global LBLUE=rgb(160,160,255) : global LGREY=rgb(192,192,192)

   ; as this

Constant GREEN=RGB(64,244,64) : Constant YELLOW=RGB(255, 255, 64) : Constant BLACK=rgb(0,0,0) : Constant WHITE=rgb(255,255,255)
Constant RED=rgb(224,64,64) : Constant CYAN=rgb(96,255,255) : Constant MAGENTA=rgb(224,96,224) : Constant BLUE=rgb(64,64,224)
Constant ORANGE=rgb(224,160,64) : Constant BROWN=rgb(156,116,72) : Constant PINK=rgb(255,160,160) : Constant DGREY=rgb(84,84,84)
Constant GREY=rgb(136,136,136) : Constant LGREEN=rgb(160,255,160) : Constant LBLUE=rgb(160,160,255) : Constant LGREY=rgb(192,192,192)



[/pbcode]

     Duno what these are, but assume there's messages rfom the names.  

[pbcode]

   ; this stuff

global m1$="":global m2$="":global m3$="":global m4$="":global m5$="":global m6$=""
global m7$="":global m8$="":global m9$="":global m10$="":global m11$=""

    ; separate variables are fairly awkward and often error prone
    ; an array seems a better fit

    Dim m$(11)

[/pbcode]


    In the setup you've got a real PB no no with potential crash waiting to happen.    You shouldn't be loading media then opening the screen.


   eg.

[pbcode]


;GRAPHICS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GRAPHICS

global title=loadnewimage("img/title.png")
global ship1=loadnewimage ("img/ship1.png") : global sun=loadnewimage ("img/sun.png") : global shipicon=loadnewimage ("img/smallship.png") : global space1=loadnewimage ("img/space1.png")
global space2=loadnewimage ("img/space2.png") : global space3=loadnewimage ("img/space3.png") : global asteroid1=loadnewimage ("img/asteroid1.png") : global asteroid2=loadnewimage ("img/asteroid2.png")
global asteroid3=loadnewimage ("img/asteroid3.png") : global asteroid4=loadnewimage ("img/asteroid4.png") : global planet1=loadnewimage ("img/planet1.png") : global planet2=loadnewimage ("img/planet2.png")
global planet3=loadnewimage ("img/planet3.png") : global planet4=loadnewimage ("img/planet4.png") : global planet5=loadnewimage ("img/planet5.png") : global planet6=loadnewimage ("img/planet6.png")

  clipped loading code

;INITIALIZATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INITIALIZATION

openscreen SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_DEPTH,screenState : centerscreen : setfps fpsrate
titlescreen "Star Captain" : adore64=loadnewfont("Adore64.ttf",14,0) : setfont adore64

[/pbcode]



   Rather you set the screen mode up, then ,load the media.. much safer!

[pbcode]

;INITIALIZATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INITIALIZATION

openscreen SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_DEPTH,screenState : centerscreen : setfps fpsrate
titlescreen "Star Captain" : adore64=loadnewfont("Adore64.ttf",14,0) : setfont adore64


;GRAPHICS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GRAPHICS

global title=loadnewimage("img/title.png")
global ship1=loadnewimage ("img/ship1.png") : global sun=loadnewimage ("img/sun.png") : global shipicon=loadnewimage ("img/smallship.png") : global space1=loadnewimage ("img/space1.png")
global space2=loadnewimage ("img/space2.png") : global space3=loadnewimage ("img/space3.png") : global asteroid1=loadnewimage ("img/asteroid1.png") : global asteroid2=loadnewimage ("img/asteroid2.png")
global asteroid3=loadnewimage ("img/asteroid3.png") : global asteroid4=loadnewimage ("img/asteroid4.png") : global planet1=loadnewimage ("img/planet1.png") : global planet2=loadnewimage ("img/planet2.png")
global planet3=loadnewimage ("img/planet3.png") : global planet4=loadnewimage ("img/planet4.png") : global planet5=loadnewimage ("img/planet5.png") : global planet6=loadnewimage ("img/planet6.png")
global planet7=loadnewimage ("img/planet7.png") : global planet8=loadnewimage ("img/planet8.png") : global

   etc etc


[/pbcode]



  You should also think about disconnecting dialog messages from the program code.   You can do that by looking into simple markup parser like this.

Drawing Messages using custom markup (http://www.underwaredesign.com/forums/index.php?topic=4272.0)



Title: Re: Star Captain WIP
Post by: esper on February 26, 2015, 08:00:29 AM
Thanks! That will be really helpful.

I do have one question though... The Save/Load game features worked for you? Saving crashes the game for me, then when I look into the save game file it's just nonsense. Loading obviously doesn't work after that point.

Also, right now I have it to where you can just save your ship. I've been having a hard time figuring out how I would go about saving the whole galaxy, especially considering you can change from between 4 and 50 sectors in size.
Title: Re: Star Captain WIP
Post by: kevin on February 26, 2015, 08:24:27 AM
Quote
I do have one question though... The Save/Load game features worked for you? Saving crashes the game for me, then when I look into the save game file it's just nonsense

 I didn't play it for all that long, mostly just had a look through the code.

 If you open the saved file it won't be readable TEXT, since your saving a mixed binary..



Title: Re: Star Captain WIP
Post by: esper on February 26, 2015, 09:57:00 AM
Ah, okay. It's still crashing the game, though, so I don't know what's up with that. Anyway, here is a new version with the Starmap functional (as far as I can tell, I haven't tested every single galaxy size, just 5, 10, and 25). I did everything you mentioned except the markup (I'll save that for a future game, because there would be a lot of rewriting involved to get there right now that could be better spent elsewhere) and the messages being arrays instead of global variables (there's too many places I'd have to change that to implement it, but again, I'll keep it in mind for my next game, which will probably be message heavy).

EDIT: Oh, also, text manual included in this version!
Title: Re: Star Captain WIP
Post by: kevin on March 13, 2015, 10:28:01 AM

  Had a quick go, played long enough to die and then restart.  On the second play got a image doesn't exist runtime error.  So there's prolly some broken logic in the restarting/initialization.