Sure! Here's a simple example of a sci-fi RPG game implemented as a single HTML file, using JavaScript and enclosed in script tags. Please note that this is a basic implementation and can be expanded upon according to your requirements:
In this basic implementation, we define two character objects - the player and the NPC. The player starts with initial stats, and the NPC has fixed stats representing the enemy. We also have an array of possible dialogues for the NPC.
Three functions are implemented to handle the player's actions: `attackEnemy()`, `findSecret()`, and `talkToNPC()`. Each function simulates the corresponding action, updates the player's stats, and provides level up feedback through the console.
Finally, to test the functionality, we call the three game functions. You can expand upon this implementation by adding graphics, more interactions, battles, and a storyline according to your requirements.