I've been learning some batch programming, and decided to make a roguelike, as it's one of my favorite types of games. I have researched any information on making a roguelike in batch, but haven't found much. From the little bit I've gathered, this is the code I have so far:
@echo off
rem init starting position
set pos=6
:level
set c1=#
set c2=#
set c3=#
set c4=#
set c5=#
set c6=.
set c7=.
set c8=#
set c9=#
set c10=.
set c11=.
set c12=#
set c13=#
set c14=#
set c15=#
set c16=#
echo %c1%%c2%%c3%%c4%
echo %c5%%c6%%c7%%c8%
echo %c9%%c10%%c11%%c12%
echo %c13%%c14%%c15%%c16%
This works so far, and draws the simple 4x4 room.I made the room only 4x4 for testing purposes, so it would be simple.
Now I'm at a point where I'm not sure how to write the rest. I know I'll need to call subroutines, and get the input (WASD), but I don't know how to structure those subroutines in the file. I'd appreciate anyone's help on how to structure a batch roguelike, get input to move the player, or even just ideas about what could work.
Thanks.
I give you here a technic without
CHOICE
and without an External command. It useXcopy
to get the INPUT (W,A,S,D). IN this Exemple i don't make any test of position (where is your object on the screen), So to test it go first right (D). It's just an exemple to help you.This code may be useful.
The main loop simply repeats showmap, getmove, makemove.
makemove
is the critical routine that needs to be expanded to build your game. The principle is to see which moves are valid for the next input, place those inmoveoptions
and generate an appropriateuserprompt
Otherwise, your mapcells are in
c_x_y
and objects inobj_level_x_y
I simply chose the object-description to bedisplaysymbolDESCRIPTION
inobjdescX
where theX
is stored inobj_level_x_y
. In this way, you can set up extra object characteristics simply by setting variables likeobjhitbonusX
orobjdosesX
.You could extend the scheme to
opponenthealthX
opponentweaponX
etc.You'd not that GOTOs are minimised to avoid spaghetti-code.