Team needed - ASCII Game Development : Masc! ASCII Maze

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

Team needed - ASCII Game Development : Masc! ASCII Maze

Post by MigrationUser »

06 Apr 2016 05:32
Realskull

Hello Batch Programmers from the world! Today i am making this post because i am in need to make a big
ASCII Game Development : Masc!

Masc is a game that is developed by me only me and i need someone who could suggest and help in the development of the game.

Development latest version: 0.7 [2016 April]

Game Type : Maze

Needed: Programming in batch [Nothing much even medium level programmer can come], Level Designer or suggester.

Give Suggestion in reply . upto this development i added:

4 levels [can be made upto 100 ]
solid walls
ascii character
exit
colour changing option

====================
Engine used : 2D-A and notepad++
====================

Game can be found in youtube , channel- Realskull and Video title : masc updates

----------------------------

#2 06 Apr 2016 08:42
Shadow Thief

Sure, I'll help.

----------------------------
#3 06 Apr 2016 08:50
Shadow Thief

Also worth noting that ckey crashes any time I try to run your game, so I recommend we try to move away from sketchy random third-party exe files.

----------------------------
#4 06 Apr 2016 13:00
Realskull

Ok sure i will change the ckey to choice.

----------------------------
#5 06 Apr 2016 13:24

Realskull

Ok in masc_core.bat :

Code: Select all

@echo off
cls
setlocal enabledelayedexpansion
set "tab=	"
set score=
(
set /p lvl=
set /p score=
)<save.mas
for /l %%a in (1,1,1000) do set "bck=!bck!"
set sym2block=: [ ]
set char=@
if "%~1"=="" exit
if not exist "%~1" exit
:level_load
title Masc By Realskull [Maze 2D Addon]
set readline=1
for /f "delims=" %%i in (%1) do (
if "!readline!"=="2" set rule=%%i&set /a readline+=1
if "!readline!"=="1" if not "%%i"=="#Masc_LevelPackage01CopyrightRealskullteam#" (exit) else (set /a readline+=1)
)
set readline=1
for /f "skip=2 delims=" %%i in (%~1) do (
set line!readline!=%%i
set /a readline+=1)
for /f "delims=, tokens=1" %%i in ("!rule!") do (set oldx=%%i)
for /f "delims=, tokens=2" %%i in ("!rule!") do (set oldy=%%i)
for /f "delims=, tokens=3" %%i in ("!rule!") do (set numline=%%i)

:echo
title  level =%lvl% s=%score%
echo %tab%%bck% 2>nul&set /p=<nul
for /l %%i in (1 1 !numline!) do (
echo !line%%i! )
rem EDITED LINE ::
choice /c:wsad /n>nul
call :checkinput
goto echo

:move_up
set /a newx=!oldx!-1
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%newx%:~%oldy%,1!"=="%%i" exit /b)
if "!line%newx%:~%oldy%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %score%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set line%newx%=!line%newx%:~0,%oldy%!!char!!line%newx%:~%tempy%!
set oldx=!newx!
exit /b

:move_down
set /a newx=!oldx!+1
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%newx%:~%oldy%,1!"=="%%i" exit /b)
if "!line%newx%:~%oldy%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %score%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set line%newx%=!line%newx%:~0,%oldy%!!char!!line%newx%:~%tempy%!
set oldx=!newx!
exit /b

:move_left
set /a tempy=!oldy!+1
set /a tempy2=!oldy!-1
for %%i in (!sym2block!) do (if "!line%oldx%:~%tempy2%,1!"=="%%i" exit /b)
if "!line%oldx%:~%tempy2%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %score%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set /a oldy-=1
set /a newy=!oldy!+1
set line%oldx%=!line%oldx%:~0,%oldy%!!char!!line%oldx%:~%newy%!
exit /b

:move_right
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%oldx%:~%tempy%,1!"=="%%i" exit /b)
if "!line%oldx%:~%tempy%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %score%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set /a oldy+=1
set /a newy=!oldy!+1
set line%oldx%=!line%oldx%:~0,%oldy%!!char!!line%oldx%:~%newy%!
exit /b

:checkinput
if errorlevel 4 (call :move_right) else (
if errorlevel 3 (call :move_left) else (
if errorlevel 2 (call :move_down) else (
if errorlevel 1 (call :move_up))))
exit /b

:game_win
echo YOU WIN
pause>nul
exit
and in masc.bat , [v0.7] :

Code: Select all

@echo off
setlocal enabledelayedexpansion
mode con cols=60 lines=25
:menu
cls
title Masc By Realskull [Maze 2D Addon] 
echo   = Masc = @Realskull Co-orporation =
echo.
echo  [1.] Play Game
echo  [2.] Load Game
echo  [3.] Help
echo  [4.] Change Colour [Beta!]
echo  [5.] Exit
set /p ch=^>
if %ch% == 1 goto new
if %ch% == 2 goto load
if %ch% == 3 goto help
if %ch% == 4 goto chc
if %ch% == 5 exit
echo.
echo  Please choose a valid Command! 
ping localhost -n 2 >nul
goto menu

:chc
cls
for %%a in (
"0 = Black     8 = Gray"
"1 = Blue      9 = Light Blue"
"2 = Green     A = Light Green"
"3 = Aqua      B = Light Aqua"
"4 = Red       C = Light Red"
"5 = Purple    D = Light Purple"
"6 = Yellow    E = Light Yellow"
"7 = White     F = Bright White"
" Type the colour name/letter to set to that colour."
" 17 Sets words to white and sets background to blue. "
) do echo %%a
set /p col= Type the colour :
color %col%
pause >nul
goto menu

:new
cls
if exist == save.mas (
echo  Press a key to start the game and overwrite the save file
pause ) 
set lvl=1
goto display

:load
cls
(
set /p lvl=
)<save.mas
goto display


:display
cls
(
echo %lvl%
)>save.mas
if %lvl% == 4 mode con cols=70 lines=30
if %lvl% == 5 mode con cols=85 lines=30
start /b /wait masc_core level%lvl%.mas
cls
echo  You won the level %lvl%
set /a lvl+=1
pause
goto display

:help
cls
echo        HELP Section for masc
echo.
echo    =====================================================
echo    =This is a maze game and the objective for you      =
echo    =is to navigate through maze and exit. To move      =
echo    =your charactor which is "o" use arrow keys to      =
echo    =move and get out of maze by going to "X"           = 
echo    =The Game is fully realesed!             v[0.6 FULL]=
echo    =needs a lot of fixing and updates. Wanna Send      =
echo    =Question or Suggestions? Send at utkrist@yahoo.com =                         
echo    =====================================================
pause
goto menu
Also the format for level is
== level%levelnumber%.mas ==
#Masc_LevelPackage01CopyrightRealskullteam#
[x] [y] [total line of map]
start drawing the map.

example
== level1.mas ==

Code: Select all

#Masc_LevelPackage01CopyrightRealskullteam#
2,2,3
::::::::::::::::
:[@]   :        :
:              x  :
::::::::::::::::

Editing : to add walls , edit masc_core.bat and in "set sym2block= : []" add the blocks which you want to be
solid . as example you want the wall to be S A # * : [] charactors then type "set sym2block=S A # * : [] "

to change player , set char=@

Download 0.7 editing version here : at the youtube video "masc update"

----------------------------

#6 06 Apr 2016 20:19
Shadow Thief

Okay, was there something you wanted me to do with this?

----------------------------

#7 07 Apr 2016 04:25
Realskull

The level designing is the longest part.
In the next update [v0.8] i need to add enemy ai which i have no idea to code on.

How can i add a enemy ai into the game?? i just need to add that and it will be better.


Game- Masc maze ascii rougelike!

----------------------------

#8 07 Apr 2016 04:41
Realskull

I tried to make enemy AI but the controls don't work!

Code: Select all

@echo off
cls
setlocal enabledelayedexpansion
set ene=O
set "tab=	"
set money=
(
set /p lvl=
set /p money=
)<save.mas
for /l %%a in (1,1,1000) do set "bck=!bck!"
set sym2block=: [ ]
set char=@
if "%~1"=="" exit
if not exist "%~1" exit
:level_load
title Masc By Realskull [Maze 2D Addon] level =%lvl% s=%money%
set readline=1
for /f "delims=" %%i in (%1) do (
if "!readline!"=="2" set rule=%%i&set /a readline+=1
if "!readline!"=="1" if not "%%i"=="#Masc_LevelPackage01CopyrightRealskullteam#" (exit) else (set /a readline+=1)
)
set readline=1
for /f "skip=2 delims=" %%i in (%~1) do (
set line!readline!=%%i
set /a readline+=1)
for /f "delims=, tokens=1" %%i in ("!rule!") do (set oldx=%%i)
for /f "delims=, tokens=2" %%i in ("!rule!") do (set oldy=%%i)
for /f "delims=, tokens=3" %%i in ("!rule!") do (set numline=%%i)

:echo
set /a e1m=%random% %%5
echo %tab%%bck% 2>nul&set /p=<nul
for /l %%i in (1 1 !numline!) do (
echo !line%%i! )
choice /c:wasd /n >nul
call :checkinput
goto echo

:move_up
set /a newx=!oldx!-1
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%newx%:~%oldy%,1!"=="%%i" exit /b)
if "!line%newx%:~%oldy%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set line%newx%=!line%newx%:~0,%oldy%!!char!!line%newx%:~%tempy%!
set oldx=!newx!
exit /b

:move_down
set /a newx=!oldx!+1
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%newx%:~%oldy%,1!"=="%%i" exit /b)
if "!line%newx%:~%oldy%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set line%newx%=!line%newx%:~0,%oldy%!!char!!line%newx%:~%tempy%!
set oldx=!newx!
exit /b

:move_left
set /a tempy=!oldy!+1
set /a tempy2=!oldy!-1
for %%i in (!sym2block!) do (if "!line%oldx%:~%tempy2%,1!"=="%%i" exit /b)
if "!line%oldx%:~%tempy2%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set /a oldy-=1
set /a newy=!oldy!+1
set line%oldx%=!line%oldx%:~0,%oldy%!!char!!line%oldx%:~%newy%!
exit /b

:move_right
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%oldx%:~%tempy%,1!"=="%%i" exit /b)
if "!line%oldx%:~%tempy%,1!"=="x" goto game_win
if "!line%newx%:~%oldy%,1!"=="s" set /a score+=1
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set /a oldy+=1
set /a newy=!oldy!+1
set line%oldx%=!line%oldx%:~0,%oldy%!!char!!line%oldx%:~%newy%!
exit /b

:enemy_up
set /a newx=!oldx!-1
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%newx%:~%oldy%,1!"=="%%i" exit /b)
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set line%newx%=!line%newx%:~0,%oldy%!!ene!!line%newx%:~%tempy%!
set oldx=!newx!
exit /b

:enemy_down
set /a newx=!oldx!+1
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%newx%:~%oldy%,1!"=="%%i" exit /b)
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set line%newx%=!line%newx%:~0,%oldy%!!ene!!line%newx%:~%tempy%!
set oldx=!newx!
exit /b

:enemy_left
set /a tempy=!oldy!+1
set /a tempy2=!oldy!-1
for %%i in (!sym2block!) do (if "!line%oldx%:~%tempy2%,1!"=="%%i" exit /b)

(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set /a oldy-=1
set /a newy=!oldy!+1
set line%oldx%=!line%oldx%:~0,%oldy%!!ene!!line%oldx%:~%newy%!
exit /b

:enemy_right
set /a tempy=!oldy!+1
for %%i in (!sym2block!) do (if "!line%oldx%:~%tempy%,1!"=="%%i" exit /b)
(
echo %lvl%
echo %money%
)>save.mas
set line%oldx%=!line%oldx%:~0,%oldy%! !line%oldx%:~%tempy%!
set /a oldy+=1
set /a newy=!oldy!+1
set line%oldx%=!line%oldx%:~0,%oldy%!!ene!!line%oldx%:~%newy%!
exit /b

:checkinput
if %e1m% == 1 (call :enemy_up ) else (
if %e1m% == 2 (call :enemy_right) else (
if %e1m% == 3 (call :enemy_left) else (
if %e1m% == 4 (call :enemy_down) else (
if errorlevel 4 (call :move_right) else (
if errorlevel 3 (call :move_left) else (
if errorlevel 2 (call :move_down) else (
if errorlevel 1 (call :move_up))))
exit /b

:game_win
echo YOU WIN
pause>nul
exit
What is wrong here??

----------------------------

#9 07 Apr 2016 06:49
Shadow Thief

When you occupy the same space as the enemy, do you want the player to immediately die, or do you want some sort of battle sequence?

----------------------------

#10 07 Apr 2016 10:19
Shadow Thief

Also, I figured you didn't want to almost verbatim copy 2D-A, so I threw together a new engine that doesn't require the level file to have header data.

Code: Select all

::------------------------------------------------------------------------------
::                                  ASCII Maze
::                                    v2.0.0
::
:: ==USAGE ==
:: masc2.bat [level]
::
:: == FEATURES ==
:: - Written completely in batch with no sketchy executables
:: - Comments so that the code can be properly maintained six months from now
:: - Level files no longer require two lines of header data to be loaded
:: - Movement has been condensed from four functions to one
::
:: == VERSION HISTORY ==
:: 2.0.0 (2016-04-06) - Initial Version
::
:: == THANKS ==
:: This game could not be possible without:
:: - masc by Realskull
:: - 2D-A by Raymai97
:: - http://ss64.org/viewtopic.php?id=424 for the line length algorithm
::------------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
title mAsc Core v2
cls

:: If no level file is provided as an argument, but there are levels in the
:: levels directory, assume that the first listed file in dir /b is level 1.
:: If there are no levels in the levels directory, exit.
set "level_dir=%~dp0\levels\"
if "%~1"=="" (
	if exist "%level_dir%\*.dat" (
		for /f "delims=" %%A in ('dir /b "%level_dir%"\*.dat') do set play_level="%level_dir%\%%A"
	) else (
		echo(No suitable starting level found. Exiting...
		pause
		exit /b
	)
) else (
	set play_level="%~1"
)

:: Parse the level file
set line_counter=0
for /f "usebackq delims=" %%A in (!play_level!) do (
	set /a line_counter+=1
	set line[!line_counter!]=%%A
)

:: Get the initial position of the player
echo Loading...
call :getStartingPosition

:displayMaze
cls
echo Player located at %player_x%,%player_y%
echo/
echo/
for /L %%A in (1,1,!line_counter!) do echo(!line[%%A]!
choice /C:WASDq /N >nul
if %errorlevel% equ 1 call :movePlayer  0 -1
if %errorlevel% equ 2 call :movePlayer -1  0
if %errorlevel% equ 3 call :movePlayer  0  1
if %errorlevel% equ 4 call :movePlayer  1  0
if %errorlevel% equ 5 exit /b

if %errorlevel% equ 999 goto :winGame
goto :displayMaze

:winGame
echo/
echo(Congratulations^^! You found the end of the maze^^!
pause
exit /b

::------------------------------------------------------------------------------
:: Move the player in the specified direction
::
:: Arguments: %1 - the number of spaces left or right to move the player
::            %2 - the number of spaces up or down to move the player
::------------------------------------------------------------------------------
:movePlayer
set /a new_x=%player_x%+%~1
set /a new_y=%player_y%+%~2

:: Ensure the player is not running into any walls
set "new_space=!line[%new_y%]:~%new_x%,1!"
for %%A in (: ] [ ) do if "!new_space!"=="%%A" exit /b
if "!new_space!"=="x" exit /b 999

set /a old_line_end=%player_x%+1
set /a new_line_end=%new_x%+1
set "line[%player_y%]=!line[%player_y%]:~0,%player_x%! !line[%player_y%]:~%old_line_end%!"
set "line[%new_y%]=!line[%new_y%]:~0,%new_x%!o!line[%new_y%]:~%new_line_end%!"
set player_x=%new_x%
set player_y=%new_y%
goto :eof

::------------------------------------------------------------------------------
:: Gets the coordinates of the player
::
:: Arguments: %1 - variable to hold the X coordinate of the player
::            %2 - variable to hold the Y coordinate of the player
::------------------------------------------------------------------------------
:getStartingPosition
for /L %%A in (1,1,!line_counter!) do (
	for /f "tokens=1,* delims=:" %%B in ('findstr /N /C:"o" !play_level!') do (
		if %errorlevel% equ 0 (
			set "player_y=%%B"
			set starting_line=!line[%%B]!
		)
	)
)

:: Get the width of the line containing the starting position
echo(!starting_line! >sLine.tmp
for %%F in ("sLine.tmp") do set /a maze_width=%%~zF-2
del sLine.tmp

:: Get the index of the player marker substring from the line
for /L %%A in (1,1,!maze_width!) do (
	if "!starting_line:~%%A,1!" == "o" (
		set /a player_x=%%A
		goto :eof
	)
)

goto :eof
----------------------------

#11 08 Apr 2016 13:58
Realskull

The enemy should not be touched or else the player will die immediately
Yes, Player should die imediately

----------------------------

#12 09 Apr 2016 10:32
Realskull

How to add sounds in it.? I heard that you need to call a simple Visual Basic Script . How to add sounds?

Current Version : v0.8 - DevB [ DevelopmentB]
=============================
2D-A is ok

----------------------------

#13 09 Apr 2016 12:00
Shadow Thief

http://stackoverflow.com/a/22379897/4158862

Note that you can only play one sound at a time.

And you really want to stick with the original engine? You don't even want to throw a note in the source code somewhere leading back to the actual owner of the code so that you don't get sued?

----------------------------

#14 09 Apr 2016 17:02
Shadow Thief

Realskull wrote:

I tried to make enemy AI but the controls don't work!

What is wrong here??

Well, without seeing the level files you're using to test, I'm not positive, but I'm guessing it could be a couple of things.

You never specified the starting location of the enemy so the script doesn't know where to start looking

You didn't properly close the if statements at the bottom of the script where you call the enemy movement (proper indentation would have pointed this out to you immediately)

You're setting elm as %random% %% 5, which returns a number between 0 and 4 and you don't have a case for elm being 0

You're using the same variables to set the positions of the player and the enemy

Last edited by Shadow Thief (09 Apr 2016 17:05)

----------------------------

#15 10 Apr 2016 09:43
Realskull

In alpha testing there was nothing like that but rather in v0.8 i added all Copyrights.

----------------------------

#16 10 Apr 2016 10:04
Realskull

ok enemy movement should be focused here more.

so If statement for enemy's ,movement in all :move_[up,down,left,right] in bottom before exit /b

elm variable to decide the movement = [ 1 up 2 down 3left 4 right]

and instead of player's variable, what can i use?

----------------------------

#17 10 Apr 2016 16:29
Shadow Thief

If there's only going to be one enemy, you can initialize the enemy's position in the same line where you initialize the player's position. If you want multiple enemies, then we need to decide on a maximum number of possible enemies (I'm going to suggest 13 until I can do more testing with for loops) and put their initial positions on a separate line.

Last edited by Shadow Thief (10 Apr 2016 16:29)

----------------------------

#18 11 Apr 2016 03:29
Realskull

Let say 2 max enemies a level. How can i do that::?
Post Reply