FreeBASIC Community produced game

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

RockTheSchock wrote:Whenever I see a new ai programming contest framework thread, i remember RealTimeBattle.
Interesting. I'll study it and see what I can come up with.
RockTheSchock wrote:Lets borrow some ideas from realtimebattle. It has a simple interface with bidirectional pipes. So you can programm your bot in any language.
Mmm, looks interesting, and entirely within the realm of possibility. But, if Jeff's intention is to showcase/attract/encourage people to use FreeBasic (as I think it is), this is out of the question, no? =D
RockTheSchock wrote:Adding a network socket interface would allow more flexibility.
Indeed. I was planning to implement a model-view-controller architecture, so we can add this easily if we wanted.
RockTheSchock wrote:If you are paranoid, you could even run the guest robot in a virtual machine enviroment.
It's not that I'm being paranoid, but this is something that you simply can't left unchecked. That's why I suggested coderJeff to use virtualization (see a few posts above).
RockTheSchock wrote:Separating of GUI and Core is another good point.
Yes, of course. That's already contemplated in the design (which, so far, only exists in my head =D)
Last edited by paul doe on Aug 27, 2018 10:35, edited 1 time in total.
RockTheSchock
Posts: 252
Joined: Mar 12, 2006 16:25

Re: FreeBASIC Community produced game

Post by RockTheSchock »

Instead of using bidirectional pipes for the exchange of messages between the simultation server and the virtual agents ( ai bots) it would be more flexible to use udp or tcp/ip. So you could easily setup an enviroment with even thousands of bots running on different machines. Or you can run each bot in a seperate virtual machine, communicating over a network connection. On windows bidirectional pipes are much slower than network communication over localhost. On the other hand i like bidirectional pipes because most compilers/programming languages support it out of the box. By the way FB lacks that feature, so you have to use custom implementations for different plattforms.
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: FreeBASIC Community produced game

Post by badidea »

RockTheSchock wrote:Instead of using bidirectional pipes for the exchange of messages between the simultation server and the virtual agents ( ai bots) it would be more flexible to use udp or tcp/ip. So you could easily setup an enviroment with even thousands of bots running on different machines.
If those battles are (close to) real-time, udp or tcp/ip over long distance, high latency, unreliable connections (internet) adds some complications.
Some articles on this subject by Glenn Fiedler: https://gafferongames.com/
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC Community produced game

Post by BasicCoder2 »

Clearly this project is way beyond my abilities to contribute with all the complexity you are all talking about and a game has not even been written to use any of it yet so I will just have to be a spectator on the coding side. So have you all decided what kind of game it will be? The vector graphics space game doesn't seem to be a tile game.
RockTheSchock
Posts: 252
Joined: Mar 12, 2006 16:25

Re: FreeBASIC Community produced game

Post by RockTheSchock »

BasicCoder2 wrote:Clearly this project is way beyond my abilities to contribute with all the complexity you are all talking about
Well, i didn't mean to make things more complex. If realtime is too complex, we just use a turn based approach. If physical correct is to hard, so be it. It's a game with its own rules. Maybe it uses simple crazy physics from another universe, but still somehow predictable? I didn't wanna push you in any direction.

If the project is gonna be about introducing / teaching how to program, you should definitly look at: https://codecombat.com. You wont find a simpler way with so much fun to learn programming.
badidea wrote:If those battles are (close to) real-time, udp or tcp/ip over long distance, high latency, unreliable connections (internet) adds some complications.Some articles on this subject by Glenn Fiedler: https://gafferongames.com/
Do you know Supreme Commander - Forged Alliance? A very cool RTS, after more than 10 years still very active community. You can play it smootly up to a latency of 450 ms.

The idea of realtimebattle is to write bots fighting each other in a tournament which is recorded. So you can watch the tournament also afterwards. I had a very hard time writing a bot doing more than just making random moves and not crashing into walls.

Codecombat instead is exactly for people / kids starting with programming. If we could add a subset of the freebasic language, we would have a really cool tool for beginners. https://github.com/codecombat/codecomba ... #languages
Last edited by RockTheSchock on Aug 27, 2018 21:56, edited 1 time in total.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC Community produced game

Post by BasicCoder2 »

RockTheSchock wrote:If physical correct is to hard, so be it. It's a game with its own rules. Maybe it uses simple crazy physics from another universe, but still somehow predictable?
Mario doesn't use real physics for good reason.
I didn't wanna push you in any direction.
It isn't my project. I think it was to make something to show off FreeBASIC from the "FreeBASIC Community" which I assume means anyone capable of making some kind of contribution. So I don't think it would be about teaching programming on the contrary it would probably more about showing what programmers can do with FreeBASIC?
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: FreeBASIC Community produced game

Post by badidea »

RockTheSchock wrote:
badidea wrote:If those battles are (close to) real-time, udp or tcp/ip over long distance, high latency, unreliable connections (internet) adds some complications.Some articles on this subject by Glenn Fiedler: https://gafferongames.com/
Do you know Supreme Commander - Forged Alliance? A very cool RTS, after more than 10 years still very active community. You can play it smootly up to a latency of 450 ms.
I don't know that game (but I did play several other networked games in the past). Latency is less of a problem for RTS games than for 'First Person Shooters' where ~300 ms or higher gets annoying. In this 'Community produced game', the AI will be the 'first person' (if I understand correctly), but the problems are similar. If my AI shoots at your AI, do I aim where you are now on my 'screen' or where you will be 300 ms later? Or where I think you will be according to the server? With local network (or localhost) with delays similar to the physics (or screen) update time, this isn't much of a problem.
That said, maybe Paul Doe will say: I'll apply this or that design pattern, create some smart methods, and it will be no problem? :-)
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

BasicCoder2 wrote:Clearly this project is way beyond my abilities to contribute with all the complexity you are all talking about and a game has not even been written to use any of it yet so I will just have to be a spectator on the coding side.
True, it hasn't been written entirely in FreeBasic. The snippets that I've been posting all over the place were meant to spark interest and steer the attention of people to explore some features of FreeBasic that, so far, hadn't been fully explored (like OOP). This project is a wonderful opportunity to write a complete architecture from the ground up. Let this not deter you from contributing anything you wish. Ideas, code snippets, questions, anything goes. Questions, in particular, bring forth explanations that are useful not only for you, but for other folks that are reading =D
BasicCoder2 wrote:So have you all decided what kind of game it will be?
I think that the original space fight is a neat idea. We only need to 'tweak' it a little ;)
BasicCoder2 wrote:The vector graphics space game doesn't seem to be a tile game.
I will make it a tile game, AND a vector game. Eventually, you'll see what I mean =D
Last edited by paul doe on Aug 27, 2018 23:08, edited 1 time in total.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

RockTheSchock wrote:Well, i didn't mean to make things more complex. If realtime is too complex, we just use a turn based approach. If physical correct is to hard, so be it. It's a game with its own rules. Maybe it uses simple crazy physics from another universe, but still somehow predictable? I didn't wanna push you in any direction.
The overall gameplay will be realtime, but not 100% physically accurate. The thing is, accuracy is not what makes a game fun. For me, it's precisely the unpredictability and the quirks that make a game interesting, fun and with 'personality'. In the case of this AI battle, the better bot will not necessarily be the one that better 'predicts' or calculates projectile trajectories or orbital physics. Where's the fun in that? =D
RockTheSchock wrote:If the project is gonna be about introducing / teaching how to program, you should definitly look at: https://codecombat.com. You wont find a simpler way with so much fun to learn programming.
Unfortunately, no. The architecture I have in mind is far from introductory. It's easy to use and extend, but it's not trivial to implement. Mainly, for the reasons you already stated (FreeBasic's lack of features), which basically means that I'll have to implement mostly everything from scratch. If I were to code the architecture, that is. The OP of this thread (coderJeff) hadn't pronounced in this respect yet ;)
RockTheSchock wrote:
badidea wrote:If those battles are (close to) real-time, udp or tcp/ip over long distance, high latency, unreliable connections (internet) adds some complications.Some articles on this subject by Glenn Fiedler: https://gafferongames.com/
Do you know Supreme Commander - Forged Alliance? A very cool RTS, after more than 10 years still very active community. You can play it smootly up to a latency of 450 ms.

The idea of realtimebattle is to write bots fighting each other in a tournament which is recorded. So you can watch the tournament also afterwards. I had a very hard time writing a bot doing more than just making random moves and not crashing into walls.
The problem is not the realtime nature of the game. Who would host the server? Who would maintain and update it? I can't do it, I already have too many responsibilities (besides coding this cute little game, that is =D). So, who's up for it?
RockTheSchock wrote:Codecombat instead is exactly for people / kids starting with programming. If we could add a subset of the freebasic language, we would have a really cool tool for beginners. https://github.com/codecombat/codecomba ... #languages
I don't think that's coderJeff's intention, but I may be mistaken. Let's see what he has to say about it. For me, it would be more about introducing really cool features of FreeBasic (OOP, polymorphism, interfaces and such). There are many "Hello, world!" BASIC tutorials around here already =D
Last edited by paul doe on Aug 28, 2018 4:09, edited 2 times in total.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

badidea wrote:If those battles are (close to) real-time, udp or tcp/ip over long distance, high latency, unreliable connections (internet) adds some complications.
Indeed. For now, let's not focus too much on this, as it can be added later.
badidea wrote:I don't know that game (but I did play several other networked games in the past). Latency is less of a problem for RTS games than for 'First Person Shooters' where ~300 ms or higher gets annoying. In this 'Community produced game', the AI will be the 'first person' (if I understand correctly), but the problems are similar. If my AI shoots at your AI, do I aim where you are now on my 'screen' or where you will be 300 ms later? Or where I think you will be according to the server? With local network (or localhost) with delays similar to the physics (or screen) update time, this isn't much of a problem.
I'm toying with a concept that addresses this very issue. I'll have to prototype it, of course, to see if the idea is of any value (or even works =D
badidea wrote:That said, maybe Paul Doe will say: I'll apply this or that design pattern, create some smart methods, and it will be no problem? :-)
Ha ha ha! Sorry if I come as a little pedantic, that's just the way I am. By the way, I'll finish what I promised (a Streams API), which will come in very handy also for this project, and then dedicate my full efforts to this, as it can potentially be very interesting. We shall see ;)

I'm almost finished with a first draft of an idea, if the concept is still a space fight, of course =D
Last edited by paul doe on Aug 28, 2018 4:11, edited 2 times in total.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC Community produced game

Post by coderJeff »

It's nice to see the interest, some anticipation. That's cool.

Original spaceship AI challenge was fun and I think we'd like to that again. But the implementation, while simple, was also fragile. I think what we'd like to see now is simple and robust. And featuring FreeBASIC throughout seems the natural choice. And everyone should expect that I would say that I'd like it be mostly if not all FreeBASIC. Anyway, that's the big-picture kind of goals in my head.

What I would caution about is, creating a system that is so complex and general purpose, that while feature rich, is just too steep a learning curve for most to use. I only ever used a model-view-controller architecture once, few years ago, to write a couple applications in java for my mobile phone. The depth of nested classes seemed bottomless. I did eventually write my apps to completion, but it was a grind.

Anyway, there's no hard specification, and it's not a full time job, and really we just want to have fun with it, so for now, let's just see where it all goes. Yeah.

----

And this specific thread doesn't need to be just this AI thing. So I think the other related discussions are welcome here.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

coderJeff wrote:Original spaceship AI challenge was fun and I think we'd like to that again. But the implementation, while simple, was also fragile. I think what we'd like to see now is simple and robust. And featuring FreeBASIC throughout seems the natural choice. And everyone should expect that I would say that I'd like it be mostly if not all FreeBASIC. Anyway, that's the big-picture kind of goals in my head.
That's not a problem. So, FreeBasic all the way. That's settled then =D
coderJeff wrote:What I would caution about is, creating a system that is so complex and general purpose, that while feature rich, is just too steep a learning curve for most to use. I only ever used a model-view-controller architecture once, few years ago, to write a couple applications in java for my mobile phone. The depth of nested classes seemed bottomless. I did eventually write my apps to completion, but it was a grind.
I did not plan to use implementation inheritance, but decoration. That way, we can iterate the design in real time, and keep the inheritance hierarchy under control (3-4 levels deep at most, half of them interfaces). We don't even need to restart the app, just reload the run-time library. In the metaballs demo, I switched the implementations of the game loop and the renderers on the fly. It's true that the renderer wasn't especially ground-breaking (it only switched from a pure FB renderer to an OpenGL one, using the patch that angros47 implemented for fbc 1.06), but still =D
coderJeff wrote:Anyway, there's no hard specification, and it's not a full time job, and really we just want to have fun with it, so for now, let's just see where it all goes. Yeah.
You stated that you wanted to improve on the design of the game, and allow for customization of ships (besides the graphical representation). I don't know how much is 'too complex' yet, but the model that I'm about to propose will allow us to do battle from the smallest interceptors to the largest battleships. Another interesting thing is that it has something to offer for everyone: if you don't particularly enjoy (or are unable to) code AIs, perhaps you'll enjoy creating spaceship components -hulls, weapons, gadgets, and so on- that others can use to customize their ships. Just a little bit longer, I'm almost done.
coderJeff wrote:And this specific thread doesn't need to be just this AI thing. So I think the other related discussions are welcome here.
Indeed. However, may I suggest something? I think that the discussion should be segregated a little (since the thread will quickly grow to unmanageable proportions). If you don't mind, I'll publish an initial draft in another thread, where we'll discuss gameplay ideas. Agree?
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC Community produced game

Post by dafhi »

For the record, I'm with paul doe's original idea. An interpreter capable of anything would not only be cool, it would showcase fb's teeth :D
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:You stated that you wanted to improve on the design of the game, and allow for customization of ships (besides the graphical representation).
I'm sorry, I didn't explain that well; my thoughts were spread out across separate posts, and I did not communicate well. Actually, the improvements were Eric C's (1000101) inspirations. They all sound great; I was just think should avoid over reaching on the first try. Hopefully,that makes sense now; me talking about a basic starting point, and what kinds of things I personally am most interested in.
If you don't mind, I'll publish an initial draft in another thread, where we'll discuss gameplay ideas. Agree?
Sounds perfect!
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC Community produced game

Post by paul doe »

coderJeff wrote:They all sound great; I was just think should avoid over reaching on the first try.
Totally agree. I think a functional design should be implemented first, then we'll iterate over it.
coderJeff wrote:Sounds perfect!
Very well. The name's 'NanoShips', still? Or do you wish to change it? Or we can 'decorate' it a little:

Code: Select all

/'
  Very simple random game title generator
  
  Useful for brainstorming =D  
'/
dim as string prefixStrings( ... ) = { _
  "Perfect", "Infinite", "Armed", "Omega", "Zero", "Astro", _
  "Stellar", "Last", "Final", "Red", "Blue", "Dangerous", _
  "Sol", "Shattered", "Mega", "Forgotten", "Alpha", "Giga", _
  "Fighting", "Black", "Hyper", "Star", "G", "Super", "Luna", _
  "Galaxy", "Sun", "Universal" _
}

dim as string nounStrings( ... ) = { _
  "Lancer", "Planet", "Justice", "Battle", "Weapon", _
  "Thunder", "Infinity", "Chaos", "Zone", "Breaker", _
  "Titanium", "Steel", "Vapor", "Hell", "Heaven", "Seeker", _
  "Gun", "Gemini", "Divide", "Fire", "Sol", "Luna", "Galaxy", _
  "Sun", "Moon", "Universe" _
}

dim as string suffixStrings( ... ) = { _
  "Gaiden", "Z", "X", "R", "EX", "Again", "Redux", "Plus", "Duel", _
  "Special", "Trail", "Turbo", "War", "Blaze", "Stream", "Blade", _
  "Unlimited", "Metal", "Divide", "Light", "Storm", "Laser", "Spirit", _
  "Extra", "Super", "Nova", "Taisen", "Warrior" _
}

? ubound( prefixStrings ) * ubound( nounStrings ) * ubound( suffixStrings )

type ListOfStrings
  public:
    declare constructor( _
      aStringArray() as string )
    declare destructor()
    
    declare function at( _
      byval as integer ) as string
    declare function atRandom() as string
    
  private:
    declare constructor()
    m_stringArray( any ) as string
end type

constructor ListOfStrings()
end constructor

constructor ListOfStrings( _
  aStringArray() as string )
  
  redim m_stringArray( _
    0 to ubound( aStringArray ) - lbound( aStringArray ) )
  
  for i as integer = 0 to ubound( m_stringArray )
    m_stringArray( i ) = aStringArray( lbound( aStringArray ) + i )
  next
end constructor

destructor ListOfStrings()
end destructor

function ListOfStrings.at( _
  byval anIndex as integer ) as string
  
  return( m_stringArray( anIndex ) )
end function

function ListOfStrings.atRandom() as string
  return( m_stringArray( cint( _
    rnd() * ubound( m_stringArray ) ) ) )
end function

type RandomName
  public:
    declare constructor( _
      byref as ListOfStrings, _
      byref as ListOfStrings, _
      byref as ListOfStrings )
    declare destructor()
    
    declare function make() as string
  
  private:
    declare constructor()
    
    m_prefixes as ListOfStrings ptr
    m_nouns as ListOfStrings ptr
    m_suffixes as ListOfStrings ptr
end type

constructor RandomName()
end constructor

constructor RandomName( _
  byref aPrefixList as ListOfStrings, _
  byref aNounList as ListOfStrings, _
  byref aSuffixList as ListOfStrings )
  
  m_prefixes = @aPrefixList
  m_nouns = @aNounList
  m_suffixes = @aSuffixList
end constructor

destructor RandomName()
end destructor

function RandomName.make() as string
  dim as string theName
  
  theName = m_prefixes->atRandom() & " " & _
    m_nouns->atRandom() & " " & _
    m_suffixes->atRandom()
    
  return( theName )
end function

randomize()

var prefixes = ListOfStrings( prefixStrings() )
var nouns = ListOfStrings( nounStrings() )
var suffixes = ListOfStrings( suffixStrings() )

var names = RandomName( prefixes, nouns, suffixes )

for i as integer = 1 to 100
  ? "NanoShips " & names.make()
next

sleep()
This generates a random game title in the over-the-top, kind of nonsensical japanese-style games and animes. Some cool names I've come across:

NanoShips Star Battle Trail
NanoShips Armed Breaker Divide
NanoShips Star Chaos Taisen ('taisen' is japanese for 'war')
NanoShips Mega Infinity Special
NanoShips Last Hell Unlimited
NanoShips Blue Gemini Z
NanoShips Star Chaos Divide
NanoShips Black Heaven Duel
NanoShips Giga Gemini Light
NanoShips Infinite Battle Again
NanoShips Shattered Heaven Blaze
NanoShips Last Divide X
NanoShips Fighting Zone X
NanoShips Omega Battle Z
NanoShips Sol Breaker Taisen ('sol' is spanish for 'sun', 'taisen' see above)
NanoShips Infinite Battle Unlimited
NanoShips Giga Chaos Plus
NanoShips Last Galaxy Taisen
NanoShips Infinite Titanium Unlimited
NanoShips Stellar Divide EX
NanoShips Universal Divide Unlimited
NanoShips Stellar Chaos Redux
NanoShips Forgotten Galaxy Taisen
NanoShips Galaxy Hell Nova
NanoShips Star Gun Blaze
NanoShips Star Weapon Storm
NanoShips Last Universe Nova
NanoShips Galaxy Battle Gaiden
NanoShips Final Heaven Blaze
NanoShips Final Sol Storm
NanoShips Infinite Infinity X (LOL!)
NanoShips Hyper Battle Unlimited
NanoShips Fighting Universe R
NanoShips G Chaos Nova

You can change the strings used for generating names to create other styles. Crude but effective brainstorming =D
Post Reply