RETROTrek - Early Development Thread

All aspects of programming on the Commander X16.
Post Reply
Starsickle
Posts: 81
Joined: Mon Aug 31, 2020 12:00 am

RETROTrek - Early Development Thread

Post by Starsickle »


]Introduction - Welcome to RETROTrek

Hello, everyone! Having gotten the itch to program something AND do some community contributing, I've decided to try my hand at a small game. One of my memories from elementary school was playing games on the C64 and the PET. One of them was a Trek-Clone. There were many, many Star Trek games on old computers, and that trend went way into the DOS-era systems. So, I thought it would be interesting to try my hand at one, myself. Welcome to "RETROTrek". Inspired by years and years of Trek-clone games, some as far back as 1967 and 1972 - RETROTrek follows in the vain of old trek games for the C64 and PET, but with the aim to evolve and improve on the design and experience.

You can check out progress at my GitHub - RETROTrek Github Project Tracker

THE BIG THREE THINGS OF RETROTrek

    1. A tribute to early EGA and VGA trek-clone games - for the Commander X16 first, and hopefully compatible with the Commodore 64

    2. Simple design - Text and Grid based for the platform CharSet. Has to be a FINISHABLE game project.

    3. Easy to play - everything displayed on same screen.

You are a freshly minted Starship captain of an alliance of peace-loving explorers that has been tasked with exploring an unexplored and contested region of space. Your ship and crew are ready for your commands. The game takes place on a 20x10 grid representing this uncharted region of space, with each grid location being a sector that is a 10x10 grid. In this area, you must Explore, Survive, and fight the evil KLORG - the alliance's foremost enemy.

Knowing that this might be something I may not absolutely ever finish, I've decided to develop the game's features in distinct phases.

PHASE 1 - ONE OF EVERYTHING AND REPEATED SECTORS

    

This phase will be completing a game that has only the absolute minimum loop. WARP will simply move you to a new area to explore before you continue on. Perform tasks to gain points. Do this 10 times, and you win. Very simple.

Phase 1 will be about getting all the the core systems and programming structure in place, and setting the state for expansion. Because I am not familiar or particularly experienced with this version of BASIC, It'll be a struggle, but I am no stranger to new things, and I am mostly working on engine parts. Aim Low, Deliver High.

PHASE 2 - SPACE, THE FINAL FRONTIER

This phase will introduce a navigable 20x10 map of space. The WARP command will now take you to a destination of your choosing. As well, what appears on the two maps will be Masked and requiring scanning to reveal. I expect to add most of the more fun bits that will create the game part of the game in this phase. For Phase 2, there's tons of things I'd like, but given the idiosyncrasies of BASIC, I might be limited.

PHASE 3 - SPACE WITHIN SPACE

This phase will extend the components created in Phase 2 by extending them to the sector map. Here, we will introduce a space within space in the 10x10 Sector map; drawing us closer to the old EGA trek-clones. As well, the movement commands should work as originally intended, and the player will be able to freely navigate the stars, orbit planets, and perhaps other space functions like hailing, bartering, and of course - being stranded and needing aid.



By the end of this, I will have a game that will have three game modes:


  1. Explore - Your primary mission is to explore/make contact with a sufficient amount of objectives in the region. Be careful, though!


  2. Secure - Your primary mission is to survive the spacial region long enough to eliminate the objective number of Klorg ships.


  3. Contact - Your primary mission is to make contact with an objective number of populated alien planets.


PLANNED FEATURES (Not a complete or final list)


  • Turn Mechanics (Passive and Active uses of resources and crew each turn)


  • Combat mechanics (Phase Cannons, Torpedos, and Particle Streams)


  • Game Over Conditions (Crew Dead/Mutiny, Ship dead in space, Turn Limit)


  • Self-Destruct (Simple, Animated, Fancy)


  • Randomly Generated Maps


  • Regional Discovery Mask (Fog of War)


  • Region and Sector Simulation per X turns (The REALLY hard part.)


  • Random Generated Alien Species and Planetary Systems (Tough, but doable!)


THIS THREAD AND EARLY DEVELOPMENT

I am sure I will need lots of help, but I'm confident that I can at least get phase 1 complete if I try. This is a project I don't expect to finish or devote much of my time to, so I hope I can make big inroads to progress to something interesting and fun. If anyone has any thoughts or advice/tips about this, please post up! I'd be interested in hearing what you think is possible or desirable for this game. I created the thread for the purpose of early development discussion, as I don't think I'm quite ready to put a non-game on the site for download.

When Phase 1 is functionally ready to be played, I will post the initial version and this thread will change or be moved/locked.

 

 

 


RetroTrek-01.png
RetroTrek-02.png
RetroTrek-03s.png
TomXP411
Posts: 1760
Joined: Tue May 19, 2020 8:49 pm

RETROTrek - Early Development Thread

Post by TomXP411 »


Heh, we could probably do a whole thread on just the Star Trek clones people are (re) writing. I've been working on my own version that's more like the original Mayfield version, but with 100% new logic and without some of the awkward things he did to optimize the game (like joining two subroutines halfway through to save code space.) I actually went through and documented all of Mayfield's variables and code blocks, so I could reproduce the program with 100% new code.

In my case, I wanted to make the same program work on several different computers: The Altair 8080, Tandy Model 102, IBM PC with Advanced BASIC, the Commodore 64, Commodore 128, and Commander X16. So while it won't take advantage of the CX16's special features, my program will work as close to the same as possible on a wide array of computers. Obviously, the Tandy 102 with its 40x8 screen will look different than the Commander X16, with its 80x60 display... so I'm making all of the routines modular and re-porting from the Altair version as my baseline. 

Anyway - the text-based Star Trek game is one of my favorites, so I'm glad to see someone else coming at it from a different angle. It looks good - keep it up.

Starsickle
Posts: 81
Joined: Mon Aug 31, 2020 12:00 am

RETROTrek - Early Development Thread

Post by Starsickle »


I wasn't aware! I should probably be learning from the others. I'm sure what I have in mind isn't what others have in mind, and others probably have much higher proficiency in this language and platform than I do.

You're in for quite a task for such wide cross compatibility for a single game. There was a good reason, I think, that so many clones of this game were so different from one to the next. Heck, I remember one game that I still can't find that was 1-4 ships (you could play as Feddy, Klingon, Romulan) on a blank playing field, and you would pause the game to change heading and speed, fire weapons, or even beam over crew to attempt to board other ships. 2-players on that one was a painful experience!

Anyways, some progress since I've posted. I've started separating out code to test individual screens and methods, and it's coming along well. Pic attached.

I also added a 5th color scheme - OLD 286. I'll show all of them off, eventually.

Some work needs to be done on layout and spacing of text, but it's coming along. I'm having trouble with WAIT - as it seems it's incompatible. I don't know what I'd use to do a "PRESS ANY KEY TO CONTINUE" without perhaps STOP, but I could use some examples. I haven't taken time to play many of the other games, yet.

Another problem is the right and bottom edges of the screen - which are giving me trouble to properly fill with colored space characters. I always end up a bit off - you can see how in my previous screens.

As for game mechanics - I'm still very focused on program structure and establishing conventions and codebase for myself.

Finally, I think I may wish to include some simple sounds, but these seem to be written in assembly - I don't know if I could do the same in BASIC and then make some subroutines out of them?

RetroTrek-WIP6.png

Ender
Posts: 220
Joined: Sat May 09, 2020 9:32 pm

RETROTrek - Early Development Thread

Post by Ender »


You can wait for input with just the INPUT command. Unless I'm misunderstanding the question?


Quote




INPUT "PRESS ANY KEY TO CONTINUE"; IN$



You can definitely make some simple sound effects with the PSG register in BASIC (you could do any sound in BASIC, really, but using the YM2151 is more complicated). You mentioned though that you'd like it to be compatible with the C64, and any sound-related stuff wouldn't be.

Starsickle
Posts: 81
Joined: Mon Aug 31, 2020 12:00 am

RETROTrek - Early Development Thread

Post by Starsickle »



3 hours ago, Ender said:




You can wait for input with just the INPUT command. Unless I'm misunderstanding the question?



More like


POKE 198,0: WAIT 198,1


The system waits until any keyboard key is pressed. This would be handy for a number of things, including what will be the message queue.

Which does not work, but is given in documentation. the X16 docs tell that WAIT is incompatible, and that seems to jive well enough with my own tests with that statement.

Starsickle
Posts: 81
Joined: Mon Aug 31, 2020 12:00 am

RETROTrek - Early Development Thread

Post by Starsickle »


Here's a small image of the color schemes, which you can currently set in game.

Once I figure out what problems necessitate a graphics mode change, I'll work on that code and add it to the options. For now, the default configuration is 80x60 characters.

Currently working on making a Queue for the reports area - something I haven't done since Data Structures 215...


RetroTrek-WIP8.png
TomXP411
Posts: 1760
Joined: Tue May 19, 2020 8:49 pm

RETROTrek - Early Development Thread

Post by TomXP411 »



5 hours ago, Starsickle said:




More like



 




POKE 198,0: WAIT 198,1



 



The system waits until any keyboard key is pressed. This would be handy for a number of things, including what will be the message queue.



Which does not work, but is given in documentation. the X16 docs tell that WAIT is incompatible, and that seems to jive well enough with my own tests with that statement.



You don't need WAIT or POKE to just wait for a keypress. You use GET. 

100 GET A$:IF A$="" GOTO 100

This is the correct way to do it in BASIC. 

TomXP411
Posts: 1760
Joined: Tue May 19, 2020 8:49 pm

RETROTrek - Early Development Thread

Post by TomXP411 »



8 hours ago, Starsickle said:




I'm having trouble with WAIT - as it seems it's incompatible. I don't know what I'd use to do a "PRESS ANY KEY TO CONTINUE" without perhaps STOP, but I could use some examples.



WAIT is not meant for keyboard input. That waits for a memory location or port address to be set to a particular value. 

GET is the command to read a key from the keyboard. 

GET is non-blocking, continuing execution if the keyboard buffer is empty. In that case, it returns a null string (""). Otherwise it returns the first key waiting in the keyboard buffer.

This will wait for a keypress:

100 GET A$: IF A$="" THEN 100

Or you can just fall through if you want to keep action going: 



100 GET A$

110 IF A$="T" THEN GOSUB torpedo_subroutine

120 IF A$="P" THEN GOSUB phaser_subroutine

200 animate lights and sounds....

etc.

 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

RETROTrek - Early Development Thread

Post by rje »


And in case you don't know about the Commodore's random number generator, the time to seed it is after that key has been pressed.  And you'll want to do it like this:

R = RND(-TI) :REM SEED PRNG

 

I'm one of the guys doing a space retro clone game thingy.  My target is Traveller, rather than Trek, and I've got a couple of early programs in the repo, but with r38 I can start on the Magnum Opus.

Starsickle
Posts: 81
Joined: Mon Aug 31, 2020 12:00 am

RETROTrek - Early Development Thread

Post by Starsickle »



1 hour ago, TomXP411 said:




GET is non-blocking, continuing execution if the keyboard buffer is empty. In that case, it returns a null string (""). Otherwise it returns the first key waiting in the keyboard buffer.



This will wait for a keypress:



100 GET A$: IF A$="" THEN 100



Or you can just fall through if you want to keep action going: 



100 GET A$

110 IF A$="T" THEN GOSUB torpedo_subroutine

120 IF A$="P" THEN GOSUB phaser_subroutine

200 REM //STUFF



 



 



Ah, thank you. That solves that. That will enable some greater control over things.



Hmm...As a quick aside - would you say this is a good reference?

https://www.c64-wiki.com/wiki/C64-Commands

It seems that I've run into a few hiccups and mistakes having followed it in the last few days. If there is a better reference out there, feel free to throw some my way.


1 hour ago, rje said:




And in case you don't know about the Commodore's random number generator, the time to seed it is after that key has been pressed.  And you'll want to do it like this:




R = RND(-TI) :REM SEED PRNG



I'm one of the guys doing a space retro clone game thingy.  My target is Traveller, rather than Trek, and I've got a couple of early programs in the repo, but with r38 I can start on the Magnum Opus.



Can you expand on that? I've seen RND(), but you're saying there's some seeding based detail surrounding this one? I was just planning on calling it each time I needed a new number.

Traveller, eh? I might have to look that one up. I might have heard of it in passing. Always up for good ideas.

Post Reply