The island - An RTS game
Re: The island - An RTS game
Oh, big thanks for you, SARG!
I corrected these values and now the game starts well. I hope, not so many errors still remains, and in this case I will find these with help of -exx command, as you advised.
I corrected these values and now the game starts well. I hope, not so many errors still remains, and in this case I will find these with help of -exx command, as you advised.
Re: The island - An RTS game
Okay, I think, this is my last question before I build in the sounds and musics, and publish the finished game (because it seems work well already):
How can I check whether a button released? Because I would like use the <Esc> button to exit from the setup screen to title screen and from there exit from the game. But when I press the <Esc> button on the setup screen, the title screen just flash and the game exit immediately. Now I use the Multikey function on both of that two screens to detect whether <Esc> is pressed and I tried to use with this the "While Inkey <> "": Wend" trick, but the result is the same. Therefore I would like check released state of <Esc> on one of that screens and the pressed state on the other screen. But how can I realize it in FB? Or can you advise me a better solution?
How can I check whether a button released? Because I would like use the <Esc> button to exit from the setup screen to title screen and from there exit from the game. But when I press the <Esc> button on the setup screen, the title screen just flash and the game exit immediately. Now I use the Multikey function on both of that two screens to detect whether <Esc> is pressed and I tried to use with this the "While Inkey <> "": Wend" trick, but the result is the same. Therefore I would like check released state of <Esc> on one of that screens and the pressed state on the other screen. But how can I realize it in FB? Or can you advise me a better solution?
Re: The island - An RTS game
Hi ITomi,
Try by adding a sleep statement inside the inkey loop like this :
Obviously if ESC key is pressed a long time it doesn't work. In this case more code is needed to check if the program is returned in the main menu and so on.
I tried with the example code given in the help file, changed a bit to handle 2 followed esc keys and it works.
Try by adding a sleep statement inside the inkey loop like this :
Code: Select all
While Inkey <> "":Sleep 100: Wend
I tried with the example code given in the help file, changed a bit to handle 2 followed esc keys and it works.
Code: Select all
#Include "fbgfx.bi"
#if __FB_LANG__ = "fb"
Using FB '' Scan code constants are stored in the FB namespace in lang FB
#endif
Dim As Integer x, y
ScreenRes 640, 480
Color 2, 15
x = 320: y = 240
Do
' Check arrow keys and update the (x, y) position accordingly
If MultiKey(SC_LEFT ) And x > 0 Then x = x - 1
If MultiKey(SC_RIGHT) And x < 639 Then x = x + 1
If MultiKey(SC_UP ) And y > 0 Then y = y - 1
If MultiKey(SC_DOWN ) And y < 479 Then y = y + 1
' Lock the page while we work on it
ScreenLock
' Clear the screen and draw a circle at the position (x, y)
Cls
Circle(x, y), 30, , , , ,F
ScreenUnlock
Sleep 15, 1
' Run loop until user presses Escape
Loop Until MultiKey(SC_ESCAPE)
' Clear Inkey buffer
While Inkey <> "":Sleep 100: Wend <----------------
Print "Press ESC exit..."
Do
Sleep 25
'' Stay in loop until user holds down CTRL and H at the same time
If MultiKey(SC_ESCAPE) Then Exit Do
Loop
Re: The island - An RTS game
I did a working solution. I publish it; maybe useful for somebody:
Well, only sounds and musics are still left, then I can publish here my little RTS in FB!
Code: Select all
dim as ubyte escpressed=0
if multikey(sc_escape) then escpressed=1
if escpressed=1 then
while multikey(sc_escape)<>0
wend
...do something here, e.g. jump to an other game state...
end if
Re: The island - An RTS game
Hey there. I love writing music for games, if you're interested.ITomi wrote:Well, only sounds and musics are still left, then I can publish here my little RTS in FB!
Here's one of the songs I've been working on. See if you like it. :)
Re: The island - An RTS game
Hello!Dr_D wrote:Hey there. I love writing music for games, if you're interested.
Here's one of the songs I've been working on. See if you like it. :)
I listened it just now; quite good melody! I already built musics in the game, but I develop an other game too in Game Maker Studio, and I will show your music the person to whom I make that game, because we still looking for musics.
Re: The island - An RTS game
Well, ladies and gentlemen, here is the game, my first little RTS in FB:
http://www.programozzunk.ucoz.hu/fbjatekok/sziget.zip
Once I gave up that I ever finish it, but I got down to work again. Unfortunately the game sometimes exits, and I don't know whether is it error of the game, the FB or the Windows 10, because all three of these does strange things on my computer.
And unfortunately again, some things aren't to be found in the game, because I still don't know how I realize these: the fog of war and game save possibility. Ah, and I still can't change the volume of musics. But maybe in the future, when I will be a skilled FB programmer...
Meanwhile I wait your critiques, comments about the game.
http://www.programozzunk.ucoz.hu/fbjatekok/sziget.zip
Once I gave up that I ever finish it, but I got down to work again. Unfortunately the game sometimes exits, and I don't know whether is it error of the game, the FB or the Windows 10, because all three of these does strange things on my computer.
And unfortunately again, some things aren't to be found in the game, because I still don't know how I realize these: the fog of war and game save possibility. Ah, and I still can't change the volume of musics. But maybe in the future, when I will be a skilled FB programmer...
Meanwhile I wait your critiques, comments about the game.
Re: The island - An RTS game
Ok. Cool. :)ITomi wrote:Hello!Dr_D wrote:Hey there. I love writing music for games, if you're interested.
Here's one of the songs I've been working on. See if you like it. :)
I listened it just now; quite good melody! I already built musics in the game, but I develop an other game too in Game Maker Studio, and I will show your music the person to whom I make that game, because we still looking for musics.
Re: The island - An RTS game
I'm not sure if I made a mistake somewhere, but I picked English language... and the names of the constructs were still in another language. I probably could have fought through the language barrier... but I gave up. You may think about printing the names of the buildings and such in another way... not imprinted on the sprite itself. Maybe choose the language and print in real time. A lot of work... or another DLL. lol... I know. ;)
Re: The island - An RTS game
Yes, because the names are parts of the building sprites, and not separated printouts. I was foolish enough to do so at the beginning of developing, I'm sorry. But in FreeBasic I still can't use hungarian diacritic letters, therefore I thought, write these names onto the sprites. Then I forgot make these english versions.
But here is the list in english and hungarian: Kőfejtő - Quarry, Favágó - Tree cutter, Laktanya - Barracks, Halász - Fisher, Lakóház - House, Őrtorony - Watch tower, Tanya - Farm.
Ah, and press Alt+Enter to switch fullscreen mode.
But here is the list in english and hungarian: Kőfejtő - Quarry, Favágó - Tree cutter, Laktanya - Barracks, Halász - Fisher, Lakóház - House, Őrtorony - Watch tower, Tanya - Farm.
Ah, and press Alt+Enter to switch fullscreen mode.
-
- Posts: 3906
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: The island - An RTS game
Maybe use draw string and your own fonts?ITomi wrote:But in FreeBasic I still can't use Hungarian diacritic letters, therefore I thought, write these names onto the sprites.
Not sure exactly what your game does. It seems to involve making paths and placing buildings near them. There is a delay while a settler does some "building" animation and then along comes some little blue guy to burn it down and dispose of any settler?
There have been some other started attempts at such "settler" games but the programmers seem to burn out before they can finish anything.
At the moment your game seems to have a glitch. It just suddenly closes during play.
Re: The island - An RTS game
Hello BasicCoder2!BasicCoder2 wrote:Maybe use draw string and your own fonts?ITomi wrote:But in FreeBasic I still can't use Hungarian diacritic letters, therefore I thought, write these names onto the sprites.
The problem is that I don't know how to use own fonts in FB. I'm still so "green" with this programming language.
In the game, if you build a barrack, then you can train warriors in that, just click on that building and the popup icon. Then you can control your warriors by the mouse, just click on them with left button and select a target with right button.Not sure exactly what your game does. It seems to involve making paths and placing buildings near them. There is a delay while a settler does some "building" animation and then along comes some little blue guy to burn it down and dispose of any settler?
Are these written in FB? And can I find these on the internet? I also almost became grey while I was working on this game :-).There have been some other started attempts at such "settler" games but the programmers seem to burn out before they can finish anything.
Yes, it's true, but interestingly enough, if I use an other IDE than FBide, I could play with it without it produce closing glitch.At the moment your game seems to have a glitch. It just suddenly closes during play.
Re: The island - An RTS game
0.5 MB bas file, that's a lot of code.
A nice open source (not in FreeBASIC) settlers like game is Widelands
A nice open source (not in FreeBASIC) settlers like game is Widelands
-
- Posts: 3906
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: The island - An RTS game
Both Boromir and Leopardpm have worked on the start of Settler like game mechanics.ITomi wrote:BasicCoder2 wrote:Are these written in FB? And can I find these on the internet?There have been some other started attempts at such "settler" games but the programmers seem to burn out before they can finish anything.
viewtopic.php?f=8&t=25457
I have also played with different ideas without actually attempting an actual game or adding user input to control the simulation.
This is just one of the threads covering the subject matter.
viewtopic.php?f=8&t=24615&hilit
I have also worked on isometric examples. Although you are using isometric buildings and characters your actual display layout is like that used in Toad on Fire. My view is you keep the mechanics of the game separate from the display and in the above forum thread I give examples of the top down view along with a simultaneous isometric view.
It is hard to work as a lone programmer on such a project and thus the need for a popular language to involve other people along with people with skills beyond programming. Also you would all have to agree on how it is to be implemented as you can't have conflicting coding techniques. For example I see Widelands uses C++ and OpenGL.
I did not compile your example from FBIDE, which is the one I use, instead I just ran the .exe that came with your download and still got the closing glitch.
Re: The island - An RTS game
badidea:
"0.5 MB bas file, that's a lot of code."
Perhaps. But I can't really compare to other similar FB games, because I don't know so much.
"A nice open source (not in FreeBASIC) settlers like game is Widelands"
Oh, I didn't know this game, but looks like very good! My work isn't to be compared with that, because my game is just a first attempt. It's started a few years ago as a Game Maker project, but the result was unplayable because of its slowness. Then I tried to make it with FreeBasic and the game became much better. Although my FreeBasic games are slow down on an older computer: I tried these on an old laptop (1.6GHz CPU with 1GB RAM) and my games were visibly slower. I don't know, how can I achieve the same fps on different systems. For example, on a slower computer I should use bigger speed value to a unit to move to achieve the same move than on a modern computer - but it's impossible, because I don't know everybody's computer system in advance. Is the Timer function the solving to this question in FreeBasic?
BasicCoder2:
Thanks; I will look over those topics.
The .exe beside the .bas is compiled by FBIDE, therefore would close unexpectedly. Maybe I will upload its compiled version by other IDE.
"0.5 MB bas file, that's a lot of code."
Perhaps. But I can't really compare to other similar FB games, because I don't know so much.
"A nice open source (not in FreeBASIC) settlers like game is Widelands"
Oh, I didn't know this game, but looks like very good! My work isn't to be compared with that, because my game is just a first attempt. It's started a few years ago as a Game Maker project, but the result was unplayable because of its slowness. Then I tried to make it with FreeBasic and the game became much better. Although my FreeBasic games are slow down on an older computer: I tried these on an old laptop (1.6GHz CPU with 1GB RAM) and my games were visibly slower. I don't know, how can I achieve the same fps on different systems. For example, on a slower computer I should use bigger speed value to a unit to move to achieve the same move than on a modern computer - but it's impossible, because I don't know everybody's computer system in advance. Is the Timer function the solving to this question in FreeBasic?
BasicCoder2:
Thanks; I will look over those topics.
The .exe beside the .bas is compiled by FBIDE, therefore would close unexpectedly. Maybe I will upload its compiled version by other IDE.