10.03.2019 - Round 1 results of our "A Love Letter For FreeBASIC" game dev competition have been published. Please be sure to check the results thread: http://games.freebasic.net/forum/index.php?topic=629.0. Don't forget that the competition is continuing with a round 2, lasting till 29th of April, 300 USD first prize. Stay tuned!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - rolliebollocks

Pages: [1]
1
Work In Progress / Blast The Roids [ Now Here! ]
« on: September 11, 2010, 12:45:53 PM »
Ok, so this is the stupidest thing ever, but it isn't exactly done.

Download:

www.imakegames.com/~rolliebollocks/_RB_LIB_roids_beta.zip

Screenie:



Lemme know what you guys think of the mouse controls... I tried a different spin on an old game, and this is really only three hours worth of setting up a working engine, so you won't hurt my feelings no matter what you say.


2
Work In Progress / Flatland RPG - With World Builder & Map Editor
« on: February 27, 2009, 02:00:48 PM »
Sneak peek at FlatLand RPG and RPG maker. Today the editor finally reached a critical mass, it is now developing the game.

http://freefile.kristopherw.us/uploads/rolliebollocks/flatland6.zip

Features
~~~~~

Editor: WYSIWYG

Enemies:

Place an enemy anywhere on the map, save the world and reload the game engine. Enemies will attack human player on sight.

NPC's:

NPC's can be either characters who drive the plot, or bosses, powerful enemies. The NPC's feature a scripting engine with basic-like syntax and a LISP style data type and parser.

NPC's feature a dialog engine which can link into the scripting engine, so that certain responses will provoke certain actions. User types in say "mutagenic cancer" and as response will be given. More versatility will be forth coming.

Map Objects:

Map objects pop up a narration box which you can enter commands into, like takebottle, gazebottle etc... Type help for a detailed explanation of how the dialog box interacts with the user. It is very similar to a text adventure. You can use objects and they can work with multiple commands from the dialog box.

Inventory:

A basic inventory has been added, but functionality is low.

~~~

I think I'll add some kind of bartering system to this map object thing too.

If you get a chance and take a look let me know if you have any ideas on ways to make it better.

Figure it being like a puzzle type game that you have to sort of figure out.

rb



3
Programming / Memory Management and Tilemaps
« on: February 23, 2009, 08:27:39 AM »
I have a slight issue with larger maps crashing my app and I'm assuming the problem is memory related. Even without the overhead of the NPC's I can really only manage 250 tiles at the most and with them I'm down to 100.

This is not a major problem at 100x100 is a rather large map, but I still want the possibility of larger maps.

The upshot of the system I am currently working under ( the system which stores a curbuff fb.image for every single tile ) is that tiles can mutilated and manipulated by the NPC's. But I'm wondering if a larger size with static graphics wouldn't be a better choice.

The new addition to the gaming engine features a world builder which links multiple maps together. Theoretically I can load millions of maps in the same 2d grid used for the map itself, but if I'm capped at 100 tiles anyway, then I can probably get away with making a much nicer tile class with GUI elements.

Any suggestions/ideas?

rb

4
Game Dev / Dialog Engine
« on: February 23, 2009, 05:22:11 AM »
What is it?

Simple response getter that allows interactive communication with your NPC's. I made this for my RPG engine which is now almost game ready! Yay!

Based on keyword-association.

Simple to understand file format:

# + <KEYWORD>
<RESPONSE>
[/END]

Please note that /end is mandatory... The price of multi-variable line responses. No /END will crash the prog before it loads.

Yeah, I know she's nothing to look at, but you should see her in action. She works like a charm, everything returns a string. And it was built to be jacked into a pre-existing GUI.

Up Next: NPC's asks human questions and remembers response and acts in accordance...



<EDIT>

You can load a textfile instead of raw text like so:

#SOMEKEYWORD
@whatever.txt
/end

dialog.txt
Code: [Select]
#HELLO
Hello to you, good sir.
/end
#FLAB
Flub
Flob
Flib
#NAPPY
nappy is my favorite word
/end


Code: [Select]
enum hm_TOKENS
    _TK_NULL        = asc("")
    _TK_CRLF        = 13
    _TK_ENDOFLINE   = asc(!"\n")
    _TK_SPACE       = asc(" ")
    _TK_AMPERSAND   = asc("&")
    _TK_COMMA       = asc(",")
    _TK_STRING      = asc("$")
    _TK_INTEGER     = asc("%")
    _TK_DOT         = asc(".")
    _TK_RPAREN      = asc(")")
    _TK_LPAREN      = asc("(")   
    _TK_PLUS        = asc("+")
    _TK_MINUS       = asc("-")
    _TK_MULT        = asc("*")
    _TK_DIVIDE      = asc("/")
    _TK_EQUAL       = asc("=")
    _TK_COMMENT     = asc("'")
    _TK_GREATERTHAN = asc(">")
    _TK_LESSTHAN    = asc("<")
    _TK_DBLQUOTE    = 34
    '_TK_PLUSEQUAL   = (asc("+") & asc("="))
end enum

#Define Consout(Msg)   open cons for output as #99: print #99, Msg: close #99

#include once "file.bi"
'#include once "inc/console.bi"
'#include once "agent_scripting.bi"

#define MAX_KEYWORDS 10000

NameSpace HappyMap

type KeyWord
    as string trigger
    as string response
end type

type Conversation
   
    as KeyWord keywords(MAX_KEYWORDS)
    as integer keywordcount = 0
   
    declare sub LoadDialog ( filename as string )
    declare function FindReply ( inWord as string ) as string
    declare function Listen_Reply ( inDialog as string ) as string
    declare function WordLength ( inDialog as string ) as integer
    declare function GetWord ( inDialog as string, index as integer ) as string
    declare function LoadFileAsString( byref filename as string ) as string
   
end type

function Conversation.LoadFileAsString( byref filename as string ) as string
   
dim x as string

if( open( filename for input access read as #13 ) = 0 ) then
close #13
if( open( filename for binary access read as #13 ) = 0 ) then
x = space( lof( 13 ))
get #13,,x
close #13
else
print "Unable to open '" & filename & "'"
end if
else
print "File not found '" & filename & "'"
end if

function = x

end function

sub Conversation.LoadDialog ( filename as string )
   
    dim as integer f = freefile
    dim as string instring
   
    if fileexists ( filename ) then
       
        open filename for input as #f
           
            while not eof(f)
               
                line input #f, instring
                if instring = "" then goto reloop
                               
                if instring[0] = asc("#") then
                   
                    keywordcount += 1
                    keywords(keywordcount).trigger = right(instring, len(instring) - 1)
                   
                    do while ucase(instring) <> "/END"
                        line input #f, instring
                                               
                        select case instring[0]
                       
                        case asc("@")
                            keywords(keywordcount).response = this.LoadFileAsString ( right(instring, len(instring) - 1) )
                                                   
                        case asc("/")
                           
                        case asc("#")
                            Consout ("Dialog file is broken at " & instring)
                            Consout ("Be sure to end block with /END.")
                            Consout ("Crash now bye.")
                            sleep:end
                       
                        case else
                             keywords(keywordcount).response &= instring & !"\r\n\r\n"
                       
                        end select
                       
                       
                    loop
               
                 else
                   
                            Consout ("Dialog file is broken at " & instring)
                            Consout ("Be sure to end block with /END.")
                            Consout ("Crash now bye.")
                            sleep:end
                 
                 endif
reloop:
            wend
            close #f
                   
    else
       
        Consout ( filename & " not found.")
        sleep:end
   
    endif
       

end sub

function Conversation.Listen_Reply ( inDialog as string ) as string

    dim as integer wordcnt = WordLength ( inDialog )
    dim as string inWord = ""
    dim as string outResponse = ""   
   
    for i as integer = 0 to wordcnt
        for ii as integer = 1 to keywordcount
            if ucase( GetWord ( inDialog, i )) = keywords(ii).trigger then
                outResponse &= keywords(ii).response & !"\r\n\r\n"
            endif
        next
    next
   
    if outResponse = "" then outResponse = "<NO REPLY>"
     
    return outResponse   

end function

function Conversation.WordLength ( inDialog as string ) as integer

    dim as integer wordcount
   
    inDialog &= !"\n"

    for i as integer = 0 to len(inDialog) - 1
        if inDialog[i] = _TK_NULL   _
        or inDialog[i] = _TK_CRLF  _
        or inDialog[i] = _TK_ENDOFLINE  _
        or inDialog[i] = _TK_DOT    _
        or inDialog[i] = _TK_COMMA  _
        or inDialog[i] = _TK_SPACE then
            wordcount += 1
        endif
    next
   
    return wordcount
   
end function

function Conversation.FindReply ( inWord as string ) as string
   
    for i as integer = 1 to keywordcount
        if inWord = keywords(i).trigger then
            return keywords(i).response
        endif
    next

    return "<NO REPLY>"

end function

function Conversation.GetWord ( inDialog as string, index as integer ) as string

    dim as integer wordcount = 0
    dim as string word
   
    if index = 0 then

        for i as integer = 0 to len(inDialog) - 1
            if inDialog[i] = _TK_NULL   _
            or inDialog[i] = _TK_CRLF  _
            or inDialog[i] = _TK_ENDOFLINE  _
            or inDialog[i] = _TK_DOT    _
            or inDialog[i] = _TK_COMMA  _
            or inDialog[i] = _TK_SPACE then
                return word
                exit function
            else
                word &= chr(inDialog[i])
            endif
        next
       
    endif
   
    for i as integer = 0 to len(inDialog) - 1
       
        if inDialog[i] = _TK_NULL   _
        or inDialog[i] = _TK_CRLF  _
        or inDialog[i] = _TK_ENDOFLINE  _
        or inDialog[i] = _TK_DOT    _
        or inDialog[i] = _TK_COMMA  _
        or inDialog[i] = _TK_SPACE then
           
            wordcount += 1
            if wordcount = index then
                for ii as integer = i+1 to len(inDialog) - 1
                    if inDialog[ii] = _TK_NULL   _
                    or inDialog[ii] = _TK_CRLF  _
                    or inDialog[ii] = _TK_ENDOFLINE  _
                    or inDialog[ii] = _TK_DOT    _
                    or inDialog[ii] = _TK_COMMA  _
                    or inDialog[ii] = _TK_SPACE then
                        return word
                    else
                                       
                        word &= chr(inDialog[ii])
                    endif
                next
            endif
           
        endif
    next
   
                   
end function


end NameSpace

'Using HappyMap
'
'dim as Conversation inconv
'
'inconv.LoadDialog "dialog.txt"
'? inconv.listen_reply ( "is nappy happy" )
'? inconv.listen_reply ( "hello" )
'
'sleep

5
General Discussion / Hmmm...
« on: February 22, 2009, 10:11:40 AM »
I wonder if the fact that some 16 year old took down our main page will be inspiration enough for massive changes. Starting with our passwords.

rb

6
Work In Progress / HappyMap MegaPack version 1.00
« on: February 07, 2009, 06:26:39 AM »
It came to pass, back when I was a noob I wanted to make my own map type scrolling engine and I ran across Lachie's pixel and screen scrolling engine and Kristopher Windsor's map walking demo. KW's demo was really minimalist and Lachie's demo was written under and earlier release of FreeBASIC so I set about to create something with the scope of Lachie's engine using KW's map walking demo as a basis. This is the result. It's not completed but it is realized. With this engine/editor as a foundation the end user can create a solid game with a lot of the more mundane aspects of the programming taken care of natively. So please take a look and let me know what you think.
   
http://freefile.kristopherw.us/uploads/rolliebollocks/happymap_megapack_v1.00.zip

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This effort by no means warrants a 1.00 release unless you consider it in terms of an evolving project hitting an impasse. None the less the groundwork has been laid for a decent 2d game engine and I will continue developing the editor alongside any game I might be about to make.

Map Editor
~~~~~~~

-Supports multiple instances of editor. For future editing of multiple maps linked together by portals.

-Supports load/save/editing of map files only, no game scripts so AI data will not be saved to the map, but separately. It must be then loaded into the game via your game constructor.

-Supports multiple tile sets of any size. Currently only rectangles are supported no rhombi.

-Easy to text edit file data structure for animation data files, tile data files, and NPC character files. Only NPC's are completely editable within the editor and must be saved extraneous to the map.

-Map Editor supports scripting but you cannot yet save scripts from within the editor and running an individual script is only possible by calling the routine in the code. ... there's a lot to do.

-Game Engine:

-Supports radial collision and rectangle collision with pixel overlap techniques to be added via mysoft's PP giving the coder the ability to choose the speed and precision of the technique by neccessity.

-Supports projectiles and projectile collision again, radial or rectangular, no PP yet.


"Observers"

-Base NPC data type is called observer. "Agents" = observres + scripting engine.

-Has support for native chase and flee routines for the AI's, and supports SIGHTRANGE. AI's will focus their attention on the nearest other entity in their visual range and either chase/flee do whatever you program it to do in accord with iseeyou ( other as observer ptr ) routine. This is also codable by caniseeyou ( other as observer ptr ) as BOOL. Dig it? You can either hard code the responses into the Type's routine set or code it from the Game Type's routine set, or if you please, code it from the GUI's message handler if you please. Yes, it is supple and beautiful if poorly executed and underdeveloped.

"Agents"

-Observers + scripting engine = Agents which can more or less be outcoded from a fileset or receive instructions on the fly. For a demo, fire up the mapeditor and double click on the blue dude. It will bring up the script editor which you can use to give commands to your bot. To edit these commands check out agent_scripting.* and agent.*.

All of the coded functions are handled by a subroutine native to the Agent. Pretty simple and small design strategy. More optimization is required.

Sound with FMOD. Thanks to Lachie and random others for graphics. I used thecutter.bas to separate his sprite sheets which I do not like working with. It may be useful to someone.

~~~~~~~~~~

Let me know what you think. I'm aware of the bugs and glitches, but ideas for further development will keep this project in motion. Requests.

Oh yes, zooming... You cannot zoom and click. It is not worth the effort. The proportion of the screenx to y is different from map_x to map_y probably always. It requires more effort on my part to get it right, with a little more overhead than I had hoped. And now I wonder if its worth it?

Comments/criticism are welcome.

rb

7
Game Dev / Flicker Animation Class
« on: January 25, 2009, 10:23:25 AM »
A class to produce a flicker animation based on the modulus to counter. Quick and dirty with a couple of goodies.

Lemme know if it sucks. It was a board request.

RLUD arrows move animation around

R to rotate
+,- Zoom in/out

Code: [Select]
#include "fbgfx.bi"
#include "file.bi"

#DEFINE SCREEN_X 800
#DEFINE SCREEN_Y 600

screenres 800, 600, 32

type sprite
    img as fb.image ptr
    delay as double
   
    declare sub Init ( Filename as string, dly as double )
    declare sub MultiPut(Byval lpTarget As Any Ptr= 0, _
                        Byval xMidPos  As Integer= 0, _
                        Byval yMidPos  As Integer= 0, _
                        Byval lpSource As Any Ptr   , _
                        Byval xScale   As Single = 1, _
                        Byval yScale   As Single = 1, _
                        Byval Rotate   As Single = 0, _
                        Byval Trans    As Integer= 0)
    declare function LoadBitmap (ByVal filename As String) As any Ptr
                       
end type
   
sub Sprite.Init ( filename as string, dly as double )
   
    img = Loadbitmap ( filename )
    delay = dly
   
end sub

Sub sprite.MultiPut(Byval lpTarget As Any Ptr= 0, _
             Byval xMidPos  As Integer= 0, _
             Byval yMidPos  As Integer= 0, _
             Byval lpSource As Any Ptr   , _
             Byval xScale   As Single = 1, _
             Byval yScale   As Single = 1, _
             Byval Rotate   As Single = 0, _
             Byval Trans    As Integer= 0)

  If (screenptr=0) Or (lpSource=0) Then Exit Sub

  If xScale < 0.001 Then xScale=0.001
  If yScale < 0.001 Then yScale=0.001

  Dim As Integer MustLock,MustRotate

  If lpTarget= 0 Then MustLock  =1
  If Rotate  <>0 Then MustRotate=1

  Dim As Integer  TargetWidth,TargetHeight,TargetBytes,TargetPitch
  If MustLock Then
    ScreenInfo    _
    TargetWidth , _
    TargetHeight, _
    TargetBytes ,,_
    TargetPitch
    TargetBytes Shr=3

    lpTarget=ScreenPtr
  Else
    TargetBytes  = cptr(Uinteger Ptr,lpTarget)[1]
    TargetWidth  = cptr(Uinteger Ptr,lpTarget)[2]
    TargetHeight = cptr(Uinteger Ptr,lpTarget)[3]
    TargetPitch  = cptr(Uinteger Ptr,lpTarget)[4]
    lpTarget    += 32
  End If
  If (TargetWidth<4) Or (TargetHeight<4) Then Exit Sub

  Dim As Integer   SourceWidth,SourceHeight,SourceBytes,SourcePitch
  If cptr(Integer Ptr,lpSource)[0] = 7 Then
    SourceBytes  = cptr(Uinteger Ptr,lpSource)[1]
    SourceWidth  = cptr(Uinteger Ptr,lpSource)[2]
    SourceHeight = cptr(Uinteger Ptr,lpSource)[3]
    SourcePitch  = cptr(Uinteger Ptr,lpSource)[4]
    lpSource    += 32
  Else
    SourceBytes  = 1
    SourceWidth  = cptr(Ushort Ptr,lpSource)[0] Shr 3
    SourceHeight = cptr(Ushort Ptr,lpSource)[1]
    SourcePitch  = SourceWidth
    lpSource    += 4
  End If
#if 0
  ? TargetWidth & "x" & TargetHeight & "x" & TargetBytes,TargetPitch
  ? SourceWidth & "x" & SourceHeight & "x" & SourceBytes,SourcePitch
  ? MustLock,Trans
  Sleep:End
#endif

  If (SourceWidth<2) Or (SourceHeight<2) Then Exit Sub
  If (TargetBytes<>SourceBytes) Then Exit Sub

#define xs 0 'screen
#define ys 1
#define xt 2 'texture
#define yt 3
  Dim As Single Points(3,3)
  points(0,xs)=-SourceWidth/2 * xScale
  points(1,xs)= SourceWidth/2 * xScale
  points(2,xs)= points(1,xs)
  points(3,xs)= points(0,xs)

  points(0,ys)=-SourceHeight/2 * yScale
  points(1,ys)= points(0,ys)
  points(2,ys)= SourceHeight/2 * yScale
  points(3,ys)= points(2,ys)

  points(1,xt)= SourceWidth-1
  points(2,xt)= points(1,xt)
  points(2,yt)= SourceHeight-1
  points(3,yt)= points(2,yt)

  Dim As Uinteger i
  Dim As Single x,y
  If MustRotate Then
    #ifndef UseRad
    Rotate*=0.017453292 'degre 2 rad
    #endif
    While Rotate< 0        :rotate+=6.2831853:Wend
    While Rotate>=6.2831853:rotate-=6.2831853:Wend
    For i=0 To 3
      x=points(i,xs)*Cos(Rotate) - points(i,ys)*Sin(Rotate)
      y=points(i,xs)*Sin(Rotate) + points(i,ys)*Cos(Rotate)
      points(i,xs)=x:points(i,ys)=y
    Next
  End If

  Dim As Integer yStart,yEnd,xStart,xEnd
  yStart=100000:yEnd=-yStart:xStart=yStart:xEnd=yEnd

#define LI 0   'LeftIndex
#define RI 1   'RightIndex
#define  IND 0 'Index
#define NIND 1 'NextIndex
  Dim As Integer CNS(1,1) 'Counters

  For i=0 To 3
    points(i,xs)=Int(points(i,xs)+xMidPos)
    points(i,ys)=Int(points(i,ys)+yMidPos)
    If points(i,ys)<yStart Then yStart=points(i,ys):CNS(LI,IND)=i
    If points(i,ys)>yEnd   Then yEnd  =points(i,ys)
    If points(i,xs)<xStart Then xStart=points(i,xs)
    If points(i,xs)>xEnd   Then xEnd  =points(i,xs)
  Next
  If yStart =yEnd         Then Exit Sub
  If yStart>=TargetHeight Then Exit Sub
  If yEnd   <0            Then Exit Sub
  If xStart = xEnd        Then Exit Sub
  If xStart>=TargetWidth  Then Exit Sub
  If xEnd   <0            Then Exit Sub

  Dim As Ubyte    Ptr t1,s1
  Dim As Ushort   Ptr t2,s2
  Dim As Uinteger Ptr t4,s4


#define ADD 0
#define CMP 1
#define SET 2
  Dim As Integer ACS(1,2) 'add compare and set
  ACS(LI,ADD)=-1:ACS(LI,CMP)=-1:ACS(LI,SET)=3
  ACS(RI,ADD)= 1:ACS(RI,CMP)= 4:ACS(RI,SET)=0

#define EX  0
#define EU  1
#define EV  2
#define EXS 3
#define EUS 4
#define EVS 5
  Dim As Single E(2,6),S(6),Length,uSlope,vSlope
  Dim As Integer U,UV,UA,UN,V,VV,VA,VN

  ' share the same highest point
  CNS(RI,IND)=CNS(LI,IND)
  If MustLock Then ScreenLock
  ' loop from Top to Bottom
  While yStart<yEnd
    'Scan Left and Right sides together
    For i=LI To RI
      ' bad to read but fast and short ;-)
      If yStart=points(CNS(i,IND),ys) Then
        CNS(i,NIND)=CNS(i,IND)+ACS(i,Add)
        If CNS(i,NIND)=ACS(i,CMP) Then CNS(i,NIND)=ACS(i,SET)
        While points(CNS(i,IND),ys) = points(CNS(i,NIND),ys)
          CNS(i, IND)=CNS(i,NIND)
          CNS(i,NIND)=CNS(i, IND)+ACS(i,Add)
          If CNS(i,NIND)=ACS(i,CMP) Then CNS(i,NIND)=ACS(i,SET)
        Wend
        E(i,EX) = points(CNS(i, IND),xs)
        E(i,EU) = points(CNS(i, IND),xt)
        E(i,EV) = points(CNS(i, IND),yt)
        Length  = points(CNS(i,NIND),ys)
        Length -= points(CNS(i, IND),ys)
        If Length <> 0.0 Then
          E(i,EXS) = points(CNS(i, NIND),xs)-E(i,EX):E(i,EXS)/=Length
          E(i,EUS) = points(CNS(i, NIND),xt)-E(i,EU):E(i,EUS)/=Length
          E(i,EVS) = points(CNS(i, NIND),yt)-E(i,EV):E(i,EVS)/=Length
        End If
        CNS(i,IND)=CNS(i,NIND)
      End If
    Next

    If (yStart<0)                              Then Goto SkipScanLine
    xStart=E(LI,EX)+0.5:If xStart>=TargetWidth Then Goto SkipScanLine
    xEnd  =E(RI,EX)-0.5:If xEnd  < 0           Then Goto SkipScanLine
    If (xStart=xEnd)                           Then Goto SkipScanLine
    'if xEnd  <xStart                           then goto SkipScanLine
    Length=xEnd-xStart
    uSlope=E(RI,EU)-E(LI,EU):uSlope/=Length
    vSlope=E(RI,EV)-E(LI,EV):vSlope/=Length
    If xstart<0 Then
      Length=Abs(xStart)
      U=Int(E(LI,EU)+uSlope*Length)
      V=Int(E(LI,EV)+vSlope*Length)
      xStart = 0
    Else
      U=Int(E(LI,EU)):V=Int(E(LI,EV))
    End If
    If xEnd>=TargetWidth Then xEnd=TargetWidth-1
    UV=Int(uSlope):UA=(uSlope-UV)*100000:UN=0
    VV=Int(vSlope):VA=(vSlope-VV)*100000:VN=0
    xEnd-=xStart
    Select Case TargetBytes
      Case 1
        t1=cptr(Ubyte Ptr,lpTarget)
        t1+=yStart*TargetPitch+xStart:xStart=0
        If Trans=0 Then
          While xStart<xEnd
            s1=lpSource+V*SourcePitch+U
            *t1=*s1
            U+=UV:UN+=UA:If UN>=100000 Then U+=1:UN-=100000
            V+=VV:VN+=VA:If VN>=100000 Then V+=1:VN-=100000
            If u<0 Then u=0
            If v<0 Then v=0
            xStart+=1:t1+=1
          Wend
        Else
          While xStart<xEnd
            s1=lpSource+V*SourcePitch+U
            If *s1 Then *t1=*s1
            U+=UV:UN+=UA:If UN>=100000 Then U+=1:UN-=100000
            V+=VV:VN+=VA:If VN>=100000 Then V+=1:VN-=100000
            If u<0 Then u=0
            If v<0 Then v=0
            xStart+=1:t1+=1
          Wend
        End If
      Case 2
        t2=cptr(Short Ptr,lpTarget)
        t2+=yStart*(TargetPitch Shr 1)+xStart:xStart=0
        If Trans=0 Then
          While xStart<xEnd
            s2=cptr(Short Ptr,lpSource)+V*(SourcePitch Shr 1)+U
            *t2=*s2
            U+=UV:UN+=UA:If UN>=100000 Then U+=1:UN-=100000
            V+=VV:VN+=VA:If VN>=100000 Then V+=1:VN-=100000
            If u<0 Then u=0
            If v<0 Then v=0
            xStart+=1:t2+=1
          Wend
        Else
          While xStart<xEnd
            s2=cptr(Short Ptr,lpSource)+V*(SourcePitch Shr 1)+U
            If *s2<>&HF81F Then *t2=*s2
            U+=UV:UN+=UA:If UN>=100000 Then U+=1:UN-=100000
            V+=VV:VN+=VA:If VN>=100000 Then V+=1:VN-=100000
            If u<0 Then u=0
            If v<0 Then v=0
            xStart+=1:t2+=1
          Wend
        End If
      Case 4
        t4=cptr(Integer Ptr,lpTarget)+yStart*(TargetPitch Shr 2)+xStart:xStart=0
        If Trans=0 Then
          While xStart<xEnd
            s4=cptr(Integer Ptr,lpSource)+V*(SourcePitch Shr 2)+U
            *t4=*s4
            U+=UV:UN+=UA:If UN>=100000 Then U+=1:UN-=100000
            V+=VV:VN+=VA:If VN>=100000 Then V+=1:VN-=100000
            If u<0 Then u=0
            If v<0 Then v=0
            xStart+=1:t4+=1
          Wend
        Else
          While xStart<xEnd
            's4=cptr(Integer Ptr,lpSource):s4+=V*(SourcePitch shr 2):s4+=U
            s4=cptr(Integer Ptr,lpSource)+V*(SourcePitch Shr 2)+U
            If *s4<>&HFFFF00FF Then *t4=*s4
            U+=UV:UN+=UA:If UN>=100000 Then U+=1:UN-=100000
            V+=VV:VN+=VA:If VN>=100000 Then V+=1:VN-=100000
            If u<0 Then u=0
            If v<0 Then v=0
            xStart+=1:t4+=1
          Wend
        End If
    End Select

SkipScanLine:
    E(LI,EX)+=E(LI,EXS):E(LI,EU)+=E(LI,EUS):E(LI,EV)+=E(LI,EVS)
    E(RI,EX)+=E(RI,EXS):E(RI,EU)+=E(RI,EUS):E(RI,EV)+=E(RI,EVS)
    yStart+=1:If yStart=TargetHeight Then yStart=yEnd 'exit loop
  Wend
If MustLock Then ScreenUnlock
End Sub


Function Sprite.LoadBitmap (ByVal filename As String) As any Ptr
Dim As Integer h,w,hf
Dim As Byte    head(1)
Dim As Any Ptr img

   Do
      If FileExists(filename) Then
         hf=FreeFile
         Open filename For Binary As #hf
            Get #hf,,head()
            If head(0)=&h42 And head(1)=&h4d Then 'BM header
               Seek #hf,&h13
               Get  #hf,,w   'get width
               
               Seek #hf,&h17
               Get  #hf,,h   'get height
            Else
               Close #hf
               Exit Do
            End If           
         Close #hf
         img = ImageCreate(w,h)
         BLoad filename,img
         Return img           
      EndIf
   Loop   
     
End Function


#DEFINE SPRITE_MAX 10

type Animation
   
    as integer numpics
    as integer counter
   
    as double posX, posY
   
    rotangle as single
    zX as single
    zY as single
   
   
    as sprite  sprites(SPRITE_MAX)
   
    declare sub Init ( numpix as integer )
   
    declare sub Display ( num as integer )
    declare sub Process ()
   
end type

sub Animation.Init ( numpix as integer )

    numpics = numpix
   
    sprites(1).Init ( "Human/FF01.bmp", 10 )
    sprites(2).Init ( "Human/FF02.bmp", 50 )
   
    posX = SCREEN_X / 2
    posY = SCREEN_Y / 2
   
    zX = 1
    zY = 1
    rotangle = 0
   
end sub

sub Animation.Process ()
   
    counter += 1
   
    for i as integer = 1 to this.numpics
        if counter mod sprites(i).delay = 0 then Display ( i )
    next
   
    if counter > 5000 then counter = 0

end sub

sub Animation.Display ( num as integer )
   
        screenlock
        cls
            sprites(num).Multiput ( , posX, posY, sprites ( num ).img, zX, zY, Rotangle, 1)
           
        screenunlock
   
end sub
'///////////////////////////////////////////////////////////////////////////////

dim as Animation myAnim

myAnim.Init ( 2 )

do
    sleep 3
    myAnim.Process

    if multikey ( fb.sc_right ) then myAnim.posX += 1 : myAnim.Display ( 1 )
    if multikey ( fb.sc_left ) then myAnim.posX -= 1 : myAnim.Display ( 1 )
    if multikey ( fb.sc_up ) then myAnim.posY -= 1 : myAnim.Display ( 1 )
    if multikey ( fb.sc_down ) then myAnim.posY += 1 : myAnim.Display ( 1 )
   
    if multikey ( fb.sc_R ) then myAnim.Rotangle += 1
    if multikey ( fb.sc_plus ) then myAnim.zX += 1: myanim.zY += 1
    if multikey ( fb.sc_minus ) then myAnim.zX -= 1: myanim.zY -= 1
   
   
   
loop until multikey(fb.sc_escape)
       

8
Work In Progress / Move The Robot Demo 2
« on: January 25, 2009, 10:18:04 AM »
http://freefile.kristopherw.us/uploads/rolliebollocks/move_the_robot.zip

!!!!!!!NPC type with inline Scripting!!!!!!!!!!!

*Supports ingame switches, integers, floats, strings.

x = 5
y = 9.1
z = "fudge"

*Supports conditionals.

x = 9
if x = 9 then beep
if z = "fudge" then x = 1

*Set NPC switches using commands from the Scripting engine

headnorth
headsouth
headwest
headeast
halt
flee
chase
hunt
focus
hungry
twitch

Just click on the NPC to activate the script!

Right click moves human NPC, Left click fires projectile.

<Lemme know if you run into glitches/crashes etc...>


9
General Discussion / What the hell happened to freebasic.net ?
« on: January 20, 2009, 07:56:22 AM »
Is the site down? Are they re-constructing it? Freebasic is habit forming. I'm tweaking.

rb

10
Work In Progress / Darwin's Widgets [Almost playable Beta]
« on: January 15, 2009, 08:44:07 AM »
http://freefile.kristopherw.us/uploads/rolliebollocks/darwins_widgets.zip

This is semi-playable demo, sort of a concept-BETA where all the basic functionality minus scripting is now implemented, there is really no scoring or incentive for playing other than to give me feedback, which I would very much appreciate.

Added...

Projectiles w/ Collision

GUI controls for the human (Right click will fire projectile at mouse pointer, which I still need to replace with a sprite). Arrow keys move around.

The observers now "Eat" each other like Wendigo and absorb the soul of the other observer, literally consuming his power. This system is a bit glitchy and results in observers which are extremely powerful.

Observers can now chew through the meat tiles on the map restoring lost health.

Pay attention to the console screen. It will tell you who is eating who.

Observers are now savable/loadable... They can now be searched and returned by their .nam_ datum.

All cannibal observers are saved automatically in the Obs/ directory...

Please take a moment to check it out, I think some neat things can be done with this system, particularly when I implement scripting AI, which is the next thing on the agenda.

rb

11
Work In Progress / Happy Map .8 Final Version
« on: November 21, 2008, 09:46:42 AM »
Happy Map!

Happy Map is a minimalistic scrolling engine which is extremely simple to use. It features the bare minimum of implementation for the features which can be coded into it.

It uses fmod for sound, the windows SAPI voice for other sounds (try running into a wall ... :) ), fbgfx for graphics, and igui, and the spriteengine are both supplied by Kristopher Windsor. If you hit the spacebar, you will notice Lachie's magnifier routine, which serves no purpose whatsoever other than to look cool.

To paint tiles check the check box and either right or left click will do the trick.

The NPC's have a minimalist scripting language. They can chase each other and whatnot. To run their script click on them with one of the mouse buttons (the one you did not use to set them down with).

I stopped this project here because there are better ways to go about such a venture graphically and otherwise. It's buggy, but its fast and simple.

The link: http://freefile.kristopherw.us/uploads/rolliebollocks/happy_map.zip



There are no significant upgrades to this version of Happy Map

12
Work In Progress / HappyMap! v0.45
« on: October 24, 2008, 08:16:45 AM »
HappyMap! v0.45

http://freefile.kristopherw.us/uploads/rolliebollocks/happymapv0_45.zip

I am in the very early stages of creating a simple scrolling RPG type map engine/editor. I'm not sure exactly what I want to do with it, but I've created enough data types to take it pretty much anywhere.

I thought I'd share at this stage for a couple of reasons...

The program can now:

1. Load/Save/Create new maps with a few minor glitches. Massive maps will crash the game, excessively elongated maps - 20x600 or something - will screw with the mouse's ability to locate tiles. I'm not entirely certain how to error trap this...

2. Set Tiles / Agents onto the map.

Tiles and agents can be added to the editor by editing the text files:

data/agents.dat
data/tiles.dat

Most of the variables set aside in agents.dat has not yet been implemented.

3. You can interact with the world you are creating...

The scrolling engine is fully functional minus glitches in the tile/player1 collision, and no agent/agent or agent/player1 collision has yet been implemented.

Props:

Most of the dirty work is thanks to Kristopher Windsor. iGUI drives the menus, and he wrote the basic scrolling engine and also the sprite engine that is used. This would have taken me much longer if not for the tools Kristopher wrote. Most of the concept is modeled on Lachie's map editor, and the player1 graphic is also modeled on Lachie's map editor :).

To do...

Next up is making the agents code-able and interactive within the game. The concept of an "Agent" as opposed to an "Entity" is that the "Agent" is tied to a specific tile until he/she/it runs into contact with player1, at which time it does what it does, and then becomes an "Entity" which can move around on the map and interact with the world...

Please be advised, this is in the beta stages, and any advice would be greatly appreciated.

13
Work In Progress / Smiley Godbots 2.0 Beta
« on: September 28, 2008, 09:41:55 AM »
Alright guys. Please take a look at my new controversial ASCII fighting game in which you fight the gods and other undesirables on your way to godhood or whatever. It is a bot programming / human vs. ai game ... with full character creation. Let me know if you like it... if you think its stupid... if you want me to die... if you find a bug... general thoughts and opinions are all welcome.

I'm finishing this one up...

http://freefile.kristopherw.us/uploads/rolliebollocks/smileygodbot.zip

Pages: [1]