FreeBASIC Community produced game

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC Community produced game

Post by dafhi »

Well, I'm starting to glimpse the benefits. Perhaps because Mr. doe's style is more readable than my own. Most importantly, I find myself gravitating towards what i'm seeing as a generalist oop approach. It's not about writing efficient code for size or speed. It's about thinking differently. Maybe not for you guys :P
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC Community produced game

Post by BasicCoder2 »

To be a "FreeBASIC Community produced game" all those involved have to come to some agreement on how to code together as I assume the original people involved in nano45 must have worked together.
Paul doe wrote: Let's focus on the design aspect of the game for now, shall we? Things such as ideas, concept art, gameplay aspects, that sort of thing. Implementation details will come at a later stage. Agree?
I thought the idea was to enhance the original nano45 idea? The vector nanoShip art is simple enough and wasn't the gameplay to shoot more bullets into the other ship then were being shot into your ship?
One tactic might be for two or more ships cooperate to concentrate all their fire power onto one ship to quickly deplete its "force field" or some other measure of ship viability. Life is about competing. Team members compete for positions within the team but cooperate to compete against other teams. In designing your ship I would say you would need to choose a limited set off features from a set of choices available to all ship designers? Fast but weak. Slow but strong. Weight issues like fuel vs. ammunition. A few powerful missiles vs. a lot of weaker missiles. And so on ...
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC Community produced game

Post by coderJeff »

This is about where I last saw this thread:
paul doe wrote:My favorite would be "XXX Forgotten Universe Gaiden". The 'Forgotten Universe' part comes from the fact that I missed that thread back in the day, and was a very cool project that was eventually forgotten. And the japanese term 'Gaiden' means literally 'a history within a history' and can be translated as 'alternate universe', much like this project is =D
coderJeff wrote: And if not NanoShips, I have no ideas.
I like your description "XXX Forgotten Universe Gaiden". I feel a connection with "Forgotten". Should nail down a name, it may help the direction. I had thought NanoShips would be a tip of the hat to the original, but this sounds like it's going to become something different, so, OK to let go.

"Bot" stood out to me, as something generically autonomous, and since I would pretty much watch any anime with a robot in it, I like it. I thought "Exo" would be good prefix to "bots" meaning outside of, the bot gets it's AI externally. Turns out it's a terrible name when I search the net if it was in use.)

Anyway, with the japanese motif, "enemy" translates to "Teki", and in english would be a homonym (homophone?) for "Techie" meaning a person who is expert in or enthusiastic about technology, especially computing.

So, how about "Tekibots Forgotten Universe Gaiden"?
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: FreeBASIC Community produced game

Post by h4tt3n »

I don't know if this would be of any help, but I have spent quite a bit of time developing a physics engine specially for 2D space type games. It has commands for creating planets, asteroid belts and entire solar systems with complex orbits, deriving orbit data from state vectors, drawing orbits on screen, realistic rocket physics and those sort of things. It also has a very robust spring-type constraint for simulating rope, girders, and other rigid structures. I intended to make several different space games with it, but I simply lack the time and - increasingly - the motivation for doing it, since it is a very slow process. I am also developing a game engine that utilizes the physics engine, but it's not as matured. If you are interested I suppose I don't mind posting the source code with a number of test scenarios. Also, being part of a game developing group might be exactly what I need to find my lost enthusiasm :-) Cheers, Mike
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: FreeBASIC Community produced game

Post by badidea »

I liked the "NanoDrones XXX" suggestion. A drone can be lots of things, e.g. a tank for a future version :-)
h4tt3n wrote:I don't know if this would be of any help, but ...
Sounds interesting. No battle tanks in your code I suppose?
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: FreeBASIC Community produced game

Post by h4tt3n »

badidea wrote:
h4tt3n wrote:I don't know if this would be of any help, but ...
Sounds interesting. No battle tanks in your code I suppose?
No, as mentioned this wold probably only be useful if we stick to the space battle type game.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC Community produced game

Post by dodicat »

Eine kliene nacht BLITZER

For fun only.
A tiny annoying WINDOWS shooter.
Procedural and inline.
The star flares light up the enemy (a little)

Code: Select all

 

Dim As Integer xres,yres
Screen 19,32,,64
Color rgb(200,200,200),Rgb(0,0,20)
Screeninfo xres,yres
Declare Function sound Alias"Beep"(Byval f As long,Byval d As long) As long 'windows only
Const k=1              'drag coefficient
Const g=9.81           'gravity
Const m=3              'initial mass of thing
Const v=200            'initial velocity of thing
Const d =.05           'density coefficient
windowtitle "Gunner Asch"

Type v2
    As Single x,y
End Type

Function r(f As Single,l As Single) As Single
    Return Rnd * ((l) - (f)) + (f)
End Function

Function AllFlaresOut(a() As v2) As Long
    Dim As Long acc
    For n As Long=Lbound(a) To Ubound(a)
        acc+=a(n).y
    Next
    Return acc
End Function

Function map(aa As Double,bb As Double,xx As Double,cc As Double,dd As Double) As Double
    Return ((dd)-(cc))*((xx)-(aa))/((bb)-(aa))+(cc)
End Function

Function Regulate(Byval MyFps As Long,Byref fps As Long) As long
    Static As Double timervalue,lastsleeptime,t3,frames
    Var t=Timer
    frames+=1
    If (t-t3)>=1 Then t3=t:fps=frames:frames=0
    Var sleeptime=lastsleeptime+((1/myfps)-T+timervalue)*1000
    If sleeptime<1 Then sleeptime=1
    lastsleeptime=sleeptime
    timervalue=T
    Return sleeptime
End Function

Sub star(starx As Long,stary As Long,size As Long,col As Ulong,rot As Single=0)
    Var count=0,rad=0.0,_px=0.0,_py=0.0,pi=4*Atn(1),prime=Rgb(255,254,253)
    For x As long=1 To 2
        For z As Single=0+.28 +rot To 2*pi+.1+.28 +rot Step 2*pi/10
            count=count+1
            If count Mod 2=0 Then rad=size Else rad=.5*size
            _px=starx+rad*Cos(z)
            _py=stary+rad*Sin(z)
            If count=1 Then Pset (_px,_py)Else Line -(_px,_py),prime
        Next z
        Paint (starx,stary),prime,prime
        count=0:prime=col
    Next x
End Sub

Sub graticule(mx As Long,my As Long)
    Line(mx+5,my)-(mx+10,my)
    Line(mx-5,my)-(mx-10,my)
    Line(mx,my+5)-(mx,my+10)
    Line(mx,my-5)-(mx,my-10)
End Sub

Function lineto(x1 As Single,y1 As Single,x2 As Single,y2 As Single,f As Single) As v2
    Var dx=x2-x1,dy=y2-y1
    Return Type(x1+f*dx,y1+f*dy)
End Function

Function distance(p1 As v2,p2 As v2) As Single
    Return Sqr((p1.x-p2.x)^2 + (p1.y-p2.y)^2)
End Function

Sub arraydelete(a() As v2,index As Long)
    If index>=Lbound(a) And index<=Ubound(a) Then
        For x As long=index To Ubound(a)-1
            a(x)=a(x+1)
        Next x
        Redim Preserve a(Lbound(a) To Ubound(a)-1)
    End If 
End Sub

Function average(b() As v2) As Long
    Dim As Long t
    For n As Long=Lbound(b) To Ubound(b)
        t+=b(n).y
    Next
    Return t/Ubound(b)
End Function

Sub PrintText(s() As v2,fps As Long,h As Single,w As Long)
    Locate 3
    Print "Enemy guns intact ";Ubound(s)
    Print "Shooter Health     ";iif(h>0,str(Int(h)),"Death")
    If Ubound(s)=0 Then Print "Shooter wins"
    Locate 8
    Print "Framerate "; fps
    Draw String(500,20),"Wind " & Abs(w)
    If w<0 Then 
        Draw String(500,60),"<------"
    Else
        Draw String(500,60),"------>" 
    End If
End Sub

Sub SetUpGuns(s() As v2)
    Redim  s(1 To 20)
    For z As Long=1 To 20
        Var n=map(1,20,z,50,750)
        Var x =n
        Var y=  map(-1,1,Sin(n/90),595,555)-70
        s(z)=Type<v2>(x,y+Rnd*30)
    Next z
End Sub

Sub SetupArrays(mm() As Single,b() As v2,rad() As Single,vel() As Single,ang() As Single,n As Long)
    Redim mm(1 To n)
    Redim b(1 To n)
    Redim rad(1 To n)
    Redim vel(1 To n)
    Redim ang(1 To n)
    For z As long=1 To n
        rad(z)=map(1,n,z,5,9)'(z in [1 to n] rad in [5 to 9], flare radii
        ang(z)=r(0,180)      'angle of each particle in explosion
        ang(z)=ang(z)*(4*Atn(1))/180'radians
        vel(z)=r(10,50)      'velocity of each particle in explosion
        mm(z)=d*rad(z)^3     'mass of each particle
    Next z 
End Sub


Randomize
'===============  most variables  =====================(v)
Dim As Long n =5          'number of stars (first run)
Dim As Long w             'windspeed
Dim As v2 startpos,position,lastposition
Redim  As v2 b(),s()
Redim  As Single ang(),vel(),rad(),mm()
SetUpGuns(s()) 'once only
SetUpArrays(mm(),b(),rad(),vel(),ang(),n)
Dim As Any Pointer im=Imagecreate(xres,yres,0)
' ====== First Run ============
startpos=Type(100,0)
w=r(-30,30)
Dim As Single theta=60  'initial angle
theta=theta*(4*Atn(1))/180 'radians
Dim As Single t,y
Dim As Long fps,mx,my,flag,btn,ct,rd
Dim As Single health=100
Dim As v2 p
'==================================================(v)
Do
    Do
        rd=0
        '================ inline launch flares ========================(1)
        t=t+.02  
        position.x=startpos.x+(m/k)*(1-Exp(-(k/m)*t))*(V*Cos(theta)-w)+w*t
        position.y=startpos.y+(m/k)*(1-Exp(-(k/m)*t))*(V*Sin(theta)+g*m/k)-(g*m/k)*t
        Screenlock
        Put(0,0),im,Pset
        PrintText(s(),fps,health,w)
        If position.y > 100 Then Pset im,(position.x,yres-position.y),Rgba(200,200,200,50)
        Circle (position.x,yres-position.y),1,Rgb(100,100,100),,,,f 'upward trace
        If position.y<lastposition.y Then  'at the trajectory top
            Screenunlock
            startpos=Type(position.x,position.y)
            t=0
        '==============================================================(1) 
            Do
                Setmouse,,1
                t=t+.01  'advance system time
                flag=0
                Getmouse(mx,my,,btn)
                Screenlock
                PrintText(s(),fps,health,w)
                Line(0,0)-(799,599),Rgba(0,0,0,2),bf 'shade out
                
                If health<0 Then Screenunlock:Imagedestroy im:im=0:Exit Do,Do,Do    'lose
                
                '==============  inline terrain ============(2)
                Dim As Long y
                For n As Long=0 To 800
                    Var x =n
                    y= map(-1,1,Sin(n/90),595,555)-100
                     rd=map(0,600,average(b()),50,0)
                    Line(x,600)-(x,y),Rgb(rd,10,10)
                Next n
                '===========================================(2)
                
                '=========  inline advance flares ======(3)
                For z As long=1 To n
                    With b(z)
                        .x=startpos.x+(mm(z)/k)*(1-Exp(-(k/mm(z))*t))*(vel(z)*Cos(ang(z))-w)+w*t
                        .y=startpos.y+(mm(z)/k)*(1-Exp(-(k/mm(z))*t))*(vel(z)*Sin(ang(z))+g*mm(z)/k)-(g*mm(z)/k)*t
                    End With
                    If (600 -b(z).y) < map(-1,1,Sin(b(z).x/90),595,555)-100 Then
                        star( b(z).x,yres-b(z).y,rad(z),Rgb(200,50,20),t)
                    End If
                Next z
                '========================================(3)
                
                '=======  inline loop through targets ==============(4)
                For n As Long=1 To Ubound(s)
                    Line(s(n).x-5,s(n).y-2)-(s(n).x+5,s(n).y+2),Rgb(0,20,0),bf  'targets
                    y= map(-1,1,Sin(mx/90),595,555)-100 +6
                    If my>y Then
                        flag=1
                       ' Setmouse,,0
                        Dim As Double ff=map(20,0,Ubound(s),.999,.997)
                        If Rnd>ff  Then
                            p=s(n)
                            For z2 As Single=0 To 1 Step .001
                                Screenunlock
                                p= lineto(p.x,p.y,mx+Rnd*15-Rnd*15,my+Rnd*15-Rnd*15,z2)
                                Pset(p.x,p.y),rgb(200,200,200)
                                If distance(p,Type(mx,my))<.5 Then sound(1000,5):health-=.5
                                Screenlock
                            Next z2
                        End If
                    Else
                         health-=.0005 'penalty for being outside the firing zone
                    End If
                Next n
                '================================================(4)

                If flag Then Setmouse ,,0:graticule(mx,my) 'show sights
                
                ' ======== inline fire back and destroy targets =========(5)
                ct=0
                Do
                    ct+=1 
                    If ct>Ubound(s) Then Exit Do
                    Dim As v2 tmp=Type(s(ct).x-w/4,s(ct).y)
                    If distance(tmp,Type(mx,my))<5 Andalso btn=1 Then
                        For n As Long=5 To 20
                            star(s(ct).x,s(ct).y,n,Rgb(255,100,255),Rnd*360)
                        Next n
                        sound(500,30)
                        health+=12
                        If Ubound(s)>1 Then
                            arraydelete(s(),ct)
                        Else
                            Redim s(0)
                        End If
                        Exit Do
                    End If
                Loop
                '==========================================================(5)
                Screenunlock
                Sleep regulate(60,fps)
                If Inkey=Chr(27) Then Exit Do,Do,Do 'fed up?
                If AllFlaresOut(b())<-150 Then Exit Do,Do
            Loop 
        End If
        lastposition=position
        Screenunlock
        Sleep regulate(60,fps)
    Loop
    'new set of flares
    startpos=Type(r(.4*xres,.6*xres))
    theta=r(70,110)
    theta=theta*(4*Atn(1))/180 'degrees to radians
    n=r(2,15)
    y=0
    w=r(-30,30)
    SetUpArrays(mm(),b(),rad(),vel(),ang(),n)
    lastposition=startpos
    Imagedestroy(im)
    im=Imagecreate(xres,yres,0)
    t=0
Loop Until Inkey=Chr(27)
If Ubound(s) Then Print "shooter looses"
Sleep
If im Then Imagedestroy(im)


   
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: FreeBASIC Community produced game

Post by grindstone »

Nice! I'm agog which else unexcavated treasures will be brought to light here. :-)
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC Community produced game

Post by BasicCoder2 »

It seems to me that the thread is meandering all over the place but not settling anywhere or any direction?
Looking at the nano45 example it seemed to be the same "physics" as in some Asteroid games with wrap around?
Two steering rockets to rotate the ship and one to increase velocity in direction the ship is pointing and another to decrease the velocity of the ship in the direction it is pointing.
Just the wrap around makes it unrealistic unless the small area of space is curved back on itself somehow.
What would a real space war look like? Not like the dog fights of World War 1 used in the Star Wars films.
Let us say there are two space stations in orbit around a planet. Think about the physics involved if each one could release fighter space ships.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

h4tt3n wrote:No, as mentioned this wold probably only be useful if we stick to the space battle type game.
Post it anyway. The bigger the pool of ideas/inspirations/concepts, the better, since we'll have more to draw from.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

BasicCoder2 wrote:It seems to me that the thread is meandering all over the place but not settling anywhere or any direction?
That's why it's called 'branstorming', buddy =D
BasicCoder2 wrote:Looking at the nano45 example it seemed to be the same "physics" as in some Asteroid games with wrap around?...
...Just the wrap around makes it unrealistic unless the small area of space is curved back on itself somehow.
Let me state this again: it does not need to be 'realistic' to be fun. In fact, quite the contrary.
BasicCoder2 wrote:What would a real space war look like? Not like the dog fights of World War 1 used in the Star Wars films.
Let us say there are two space stations in orbit around a planet. Think about the physics involved if each one could release fighter space ships.
It would look boring. There's no laser known to man that works like the ones you see in the movies. There would be no explosions, since there's no air, and there wouldn't be any sound for the same reason. So, the 'realistic' space war would involve things throwing rock pellets at each other and silently imploding out of existence when their hulls got broken. As much fun as it sounds =D
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC Community produced game

Post by BasicCoder2 »

paul doe wrote:Let me state this again: it does not need to be 'realistic' to be fun. In fact, quite the contrary.
Yes I get that. I was responding to h4tt3n offer of a real physics engine and how it would be used.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

coderJeff wrote:... but this sounds like it's going to become something different, so, OK to let go.
More like a 'spiritual successor' =D
coderJeff wrote:Anyway, with the japanese motif, "enemy" translates to "Teki", and in english would be a homonym (homophone?) for "Techie" meaning a person who is expert in or enthusiastic about technology, especially computing.

So, how about "Tekibots Forgotten Universe Gaiden"?
I also like anime (good mech animes in particular). So, we're going for the japanese anime aestethic? I think 'TekiBots' sounds silly =D but I have been preparing another proposal that pretty much integrates every idea drafted in the thread (so far at least).

I only need to know if we're going for the anime look, so I can prepare some concept art and start evolving from there. I think that the theme is well suited for anything robot-mech-cyberpunk related stuff (especially if it involves massive shooting), but what do you guys think?
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC Community produced game

Post by coderJeff »

paul doe wrote:
coderJeff wrote:I think 'TekiBots' sounds silly =D
Aw, :(, I actually gave that some serious thought, and it's not very common according to google. But no matter.
but what do you guys think?
paul, I think you have direction in mind, and I think you should just go with it. Show us what you've got. I will write an AI or two. :)
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

coderJeff wrote:Aw, :(, I actually gave that some serious thought, and it's not very common according to google. But no matter.
I didn't meant to hurt your feelings, sorry ;) Just kidding. I only tought it's a bit anticlicmatic, no?

"TekiBots Hyper Galaxy Meltdown"

Mmmm... XD
coderJeff wrote:paul, I think you have direction in mind, and I think you should just go with it.
I see. But, it seems that it's not what the other members want, so I think I'll follow your suggestion and just go with it on my own. I was thinking of something worthwhile to do in FreeBasic, and you provided a very interesting project to pursuit, indeed. Thank you!
coderJeff wrote:Show us what you've got. I will write an AI or two. :)
In due time. Looking forward to it! =D
Post Reply