QuickRogueFB (Beta)

User projects written in or related to FreeBASIC.
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

QuickRogueFB (Beta)

Postby rdc » Apr 04, 2006 16:42

QuickRogueFB Beta

http://rdc.ascii-world.com/myprograms/qroguefb.zip

QuickRogueFB is a speed rogue-like game. There is one level, 50 monsters and a set amount of time to find the Amulet of Nikktu and escape. The game play is very streamlined so there is no inventory or stats management and a very small set of commands to make gameplay quick and easy.


Any bug reports are welcomed.
mambazo
Posts: 650
Joined: Jul 17, 2005 13:02
Location: Ireland
Contact:

Postby mambazo » Apr 04, 2006 17:01

Looks good, but i can't seem to kill anything.
redcrab
Posts: 618
Joined: Feb 07, 2006 15:29
Location: France / Luxemburg
Contact:

Postby redcrab » Apr 04, 2006 17:07

WAooh , Great ! I love it.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Apr 04, 2006 17:20

hehe yeah, eveything pwns too hard (been trying 15 min mode). but playing it really brings back the memories.. i used to like a game called 'castle of the winds'.... i never knew thats what 'rogue-like' meant :o
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Postby rdc » Apr 04, 2006 17:54

I adjusted the monster values to make it a little bit easier, but it probably still needs some tweaking.

See first post for link.
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Postby rdc » Apr 04, 2006 18:16

Image
mambazo
Posts: 650
Joined: Jul 17, 2005 13:02
Location: Ireland
Contact:

Postby mambazo » Apr 04, 2006 18:48

Thats way better now :)

I really like the choice of colours too. NetHack would look sweet like this.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Apr 04, 2006 19:16

yeah, this is really a cool litle quick game. and there was still achance to get gangbanged if too many monsters came, hehe

Image


did it on level 3 (15 mins) had 3 mins left =)
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Postby rdc » Apr 04, 2006 19:32

Thanks guys.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Apr 04, 2006 19:49

how did you create the text pictures?
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Postby rdc » Apr 04, 2006 21:53

cha0s wrote:how did you create the text pictures?


I found some graphic images on the net, and conveted them into text using Text-Image.com. I then changed some of the characters to match my coloring scheme. It was a bit of work, but I think it turned out well.
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Postby rdc » Apr 04, 2006 21:59

I tweaked the monster code a bit more, changed the scoring so you get the value of monsters killed instead of a flat 10 points, same for traps, and added a high score table. See first post for updated link.
blahboybang
Posts: 385
Joined: Oct 16, 2005 0:15
Location: USA
Contact:

Postby blahboybang » Apr 04, 2006 23:27

hey, they give you the source! :

Code: Select all

#!/usr/local/bin/pike

// pic2html v0.4 - converts images into HTML text
// Author: Patrik Roos ( patrik@text-image.com )
// Language: Pike 7.6 ( http://pike.ida.liu.se/ )


// VARIABLES

// Initialize variables

int timestart = time();                 // Check when script started

int textType_count = -1;                // Start at the beginning
string textType = "sequence";           // Default to sequence
array HTMLcharacter = ({ "0", "1" });   // Default to 0's and 1's
string bgColor = "black";               // Default to black background
int|string fontSize = -3;               // Default to font size -3
int grayscale = 0;                      // Default to colour
string browser = "ie";         // Default to Internet Explorer

// Some more strings that will be used

string imageURL;
string HTMLheader, beginHTML, endHTML, fontHTMLstart, fontHTMLend;


// FUNCTIONS

// Function to decide what the HTML page should look like

void setHTMLvars() {
        HTMLheader = "<!-- Generated on " + __DATE__ + " using pic2html.cgi, by Patrik Roos -->\n\n";

   beginHTML = "<HTML><HEAD><TITLE>Text image</TITLE></HEAD><BODY>\n";
        endHTML = "</td></tr></table>\n</BODY></HTML>";
        fontHTMLstart = "<font color=";
        fontHTMLend = "</font>";
}


// Function to write an HTML error page

void werr(string errorMessage) {
        setHTMLvars();
        write(HTMLheader + "\n" + beginHTML + "\n");
        write("<table align=center><tr bgcolor=black><td><font color=lightblue size=4>Error: " + errorMessage + "</font></td></tr></table>\n");
        write(endHTML + "\n");
        return;
}


// Function to choose next character for output

string nextCharacter() {
        if (sizeof(HTMLcharacter) == 1) { return HTMLcharacter[0]; }
        if (textType == "random") { return HTMLcharacter[random(sizeof(HTMLcharacter))]; }
        else if (textType == "sequence") {
                textType_count++;
                if (textType_count >= sizeof(HTMLcharacter)) {
                        textType_count = 0;
                        return  HTMLcharacter[0];
                }
                return HTMLcharacter[textType_count];
        }
}


// Main program

int main(int argc, array(string) argv) {
        write("Content-Type: text/html\r\n\r\n");       // Start outputting HTML

        int imageWidth = 130;                           // Default to 130 characters wide

   // Make sure user posted data and that it's not too large
        int temp = (int)getenv("CONTENT_LENGTH");
   if (!temp) {
      werr("No image specified.");
      return 0;
   }

   if (temp > 10485760) {
      werr("Image too large (10MB limit).");
      return 0;
   }

        // Read posted data from user
        string info = Stdio.stdin.read(temp);

   if (strlen(info) < temp) {
      werr("Insufficient data uploaded.");
      return 0;
   }


   // Record the headers used
   mapping(string:string) headies = ([ ]);

   headies["content-type"] = getenv("CONTENT_TYPE");
   headies["content-length"] = getenv("CONTENT_LENGTH");


        string imageData;

        // Put the data into strings to see what settings the user chose
   object msg = MIME.Message( info, headies );

        foreach(msg->body_parts, object food) {


                switch (food->disp_params->name) {

                        case "image":
                                imageURL = food->get_filename();
                                imageData = food->getdata();
                                break;
                        case "textType":
                                textType = food->getdata();
                                break;
                        case "width":
                                imageWidth = (int)(food->getdata());
                                break;
                        case "characters":
                                HTMLcharacter = food->getdata() / "";
                                break;
                        case "bgcolor":
                                bgColor = food->getdata();
                                break;
                        case "fontsize":
                                fontSize = food->getdata();
                                break;
                        case "grayscale":
                                grayscale = (int)(food->getdata());
                                break;
         case "browser":
            browser = food->getdata();
            break;
                        default:
                                break;
                }

        }

        // Now set the HTML layout
        setHTMLvars();


        // Check if there's been an image submitted, and exit if there hasn't
        if (!imageURL) {
                imageURL = "Error";
                werr("Must specify image.");
                return 0;
        }

        // Check if width is within limits, and force to 100 if not
        if (imageWidth < 1 || imageWidth > 500) { imageWidth = 100; }

        // Create image from data
        Image.Image image;
        mixed imageerror = catch { image = Image.ANY.decode(imageData); };

        // Check if there's been an error creating the image, exit if there has
        if (!image || imageerror) {
                werr("Failed to get image.");
                return 0;
        }

        if (grayscale)
                image = image->grey();

        image = image->scale(imageWidth,0);             // Resize to fit chosen width

   if (browser == "ie")
           image = image->scale(1.0,0.65);         // Fix aspect ratio (Internet Explorer)
   else
           image = image->scale(1.0,0.43);         // Fix aspect ratio (Firefox)

        int width = image->xsize();
        int height = image->ysize();

   if (width > 2000 || height > 2000) {
      werror("Image size too large.");
      return 0;
   }

        // Start outputting the HTML page
        if (HTMLheader) { write(HTMLheader); }
        write(beginHTML);

   write("<table align=\"center\" cellpadding=\"10\">\n<tr bgcolor=\"" + bgColor + "\"><td>\n\n<!-- IMAGE BEGINS HERE -->\n<font size=\"" + fontSize + "\">\n<pre>");

        array(int) colours;

        array(int) oldcolours = ({ -1 });               // Set impossible value for previous colours

        // Now for the fun stuff:
        // First we make some loops that will go through each line, one by one.
        // The inner loop will read each pixel's colour and then output the corresponding HTML coloured character
        // It also checks if the last character had the same colour, and if so doesn't output the same colour codes
        //  again, thus saving a few bytes.
        // The outer loop should explain itself.
        for (int y = 0; y < height; y++) {

                for (int x = 0; x < width; x++) {
                        colours = image->getpixel(x,y);
                        if (!equal(colours,oldcolours)) {
                                Image.Color.Color colour = Image.Color.rgb(colours[0],colours[1],colours[2]);
                                if (x == 0)
                                        write(fontHTMLstart + colour->html() + ">" + nextCharacter());
                                else
                                        write(fontHTMLend + fontHTMLstart + colour->html() + ">" + nextCharacter());
                        }
                        else {
                                write(nextCharacter());
                        }

                        oldcolours = colours;
                }

                oldcolours = ({ -1 });
                write(fontHTMLend + "<br>");
        }

        // We're done! Finish up the HTML page, and tell the user how long it took
        write("\n</pre></font>");
        write("\n<!-- IMAGE ENDS HERE -->\n");
        write("\n<P><FONT COLOR=LIGHTBLUE SIZE=2>Rendering time: " + (int)round(time(timestart)) + " seconds.</FONT><BR>\n");

        write(endHTML);

}


Let's convert it to fb!
Ryan
Posts: 695
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Postby Ryan » Apr 04, 2006 23:35

Pretty cool man. Good job. ^_^
rdc
Posts: 1713
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Postby rdc » Apr 05, 2006 0:18

Ryan wrote:Pretty cool man. Good job. ^_^


Thanks!

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest