Page 1 of 2

Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 3:21 pm
by VeryVeryWell
Please help me to create games in PB. Does anybody have manuals for PB 4.41?
I want to create a real-time strategy in network.

And another question: what will happen if many users connect to the standart Pure Server?

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Network (Server) example file
;
;    (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;

If InitNetwork() = 0
  MessageRequester("Error", "Can't initialize the network !", 0)
  End
EndIf

Port = 6832
*Buffer = AllocateMemory(1000)

If CreateNetworkServer(0, Port)

  MessageRequester("PureBasic - Server", "Server created (Port "+Str(Port)+").", 0)
  
  Repeat
      
    SEvent = NetworkServerEvent()
  
    If SEvent
    
      ClientID = EventClient()
  
      Select SEvent
      
        Case 1
          MessageRequester("PureBasic - Server", "A new client has connected !", 0)
  
        Case 2
          MessageRequester("PureBasic - Server", "Client "+Str(ClientID)+" has send a packet !", 0)
          ReceiveNetworkData(ClientID, *Buffer, 1000)
          MessageRequester("Info", "String: "+PeekS(*Buffer), 0)
  
        Case 3
          MessageRequester("PureBasic - Server", "Client "+Str(ClientID)+" has send a file via the network !", 0)
          ReceiveNetworkFile(ClientID, "C:\TEST_Network.ftp3")
  
        Case 4
          MessageRequester("PureBasic - Server", "Client "+Str(ClientID)+" has closed the connection...", 0)
          Quit = 1
    
      EndSelect
    EndIf
    
  Until Quit = 1 
  
  MessageRequester("PureBasic - Server", "Click to quit the server.", 0)
  
  CloseNetworkServer(0)
Else
  MessageRequester("Error", "Can't create the server (port in use ?).", 0)
EndIf

  
End
Must I use many threads for every user?

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 4:01 pm
by Rook Zimbabwe
So what other programming languages are you familiar with?
What games have you coded already?
Don't you think it would be better if you tried to write the game first THEN integrated C/S accessability?

To answer your questions outright... Yes, you can also create a MAP or copnnections as well.

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 4:06 pm
by VeryVeryWell
Rook Zimbabwe wrote:So what other programming languages are you familiar with?
I don't know other languages...
Rook Zimbabwe wrote:What games have you coded already?
I have not coded games yet... Simply, I want learn: how it works.
I need free manuals.
Rook Zimbabwe wrote:Don't you think it would be better if you tried to write the game first THEN integrated C/S accessability?
OK. I will code simle game in first.

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 5:28 pm
by c4s
VeryVeryWell wrote:I have not coded games yet...[...]OK. I will code simle game in first.
So I think your question is solved then because if you really want to make games you have to start simple and even more important: You have to understnad the language you are programming with! My first game for example was "guess the number"...

By the way: The latest version of PureBasic is 4.50 with 4.51 as a release candidate. :?
(where is the *roll* smiley?)

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 5:42 pm
by VeryVeryWell
c4s wrote:
VeryVeryWell wrote:I have not coded games yet...[...]OK. I will code simle game in first.
So I think your question is solved then because if you really want to make games you have to start simple and even more important: You have to understnad the language you are programming with! My first game for example was "guess the number"...
I can't imagine how I can begin... I was learn all PB help. I try do something. I have read German manual for PB 3.xx (!). I need manuals in English.

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 5:44 pm
by KJ67
You could get the latest manual from PureBasic's homepage, http://www.purebasic.com/documentation/PureBasic.pdf

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 10:00 pm
by PureLeo
4.41? :roll:

The mighty 4.51 is out, get its demo.

Re: Please teach me to creare games in PB!

Posted: Mon Aug 30, 2010 11:18 pm
by LuCiFeR[SD]
VeryVeryWell wrote:I can't imagine how I can begin... I was learn all PB help. I try do something. I have read German manual for PB 3.xx (!). I need manuals in English.
If you are a registered (as in paid money for purebasic) you can download the latest version from your purebasic user account... The documentation comes with it.

If you Downloaded it via a torrent or any other nefarious means, then sorry, you are out of luck as you will receive no help here... from myself, obviously I can't talk for others.

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 12:06 am
by blueznl
Unregistered users in the Netherlands can call the helpline 0909-7472837.

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 4:19 am
by Rook Zimbabwe
OK I may break a rule... (hey the eye roll is MISSING!!!)

Look here: http://www.purearea.net

Try not to get distarcted by the DLL and libs... start withthe source code section... there are a couple of games there that you can see HOW they were coded (it is all source code)

READ the code... (RTFM as well!) as you don't actually know HOW to program you probably don't have any BAD habits to break... consider yourself lucky!

There are different approaches to applications and windowed code and full screen games... almost 3 different programming styles... (OK maybe 2-99)

BASIC allows you maximum flexibility in HOW you code. Follow the KISS rule and your PB programs will be fine! :mrgreen:

You might also read the Purebasic Survival Guide... Some boring old duffer put it together... I forget who... real long winded poster and know all busybody... :roll:

Dang I wish I could remember who wrote that up???

:wink:

(I am kidding Blueznl!!!)

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 7:03 am
by blueznl
The number of honorific tiles bestowed upon me is beyond comprehension.

(Duh! 8) )

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 7:28 am
by VeryVeryWell
LuCiFeR[SD] wrote:If you Downloaded it via a torrent or any other nefarious means, then sorry, you are out of luck as you will receive no help here.
When I will get 79 euro, I will buy full PureBasic. Unfortunately, I study at school. I have not money.
blueznl wrote:Unregistered users in the Netherlands can call the helpline 0909-7472837.
Thanks, but I am not from Netherlands.
Rook Zimbabwe wrote:OK I may break a rule... (hey the eye roll is MISSING!!!)

Look here: http://www.purearea.net
Oh! Thanks. I can't find it.

For PB admin:
Please add here http://purebasic.com/onlineordering.php PayPal, LibertyReserve and Russian system WebMoney (http://webmoney.ru/).

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 12:50 pm
by luis
LuCiFeR[SD] wrote: you will receive no help here ...
missing text wrote: ... from myself, obviously I can't talk for others.

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 6:44 pm
by LuCiFeR[SD]
luis wrote:
LuCiFeR[SD] wrote: you will receive no help here ...
missing text wrote: ... from myself, obviously I can't talk for others.
You are correct luis. I humbly apologise. I have edited my post above with the amended text.

Re: Please teach me to creare games in PB!

Posted: Tue Aug 31, 2010 7:35 pm
by blueznl
My favorite smiley must still be this one:

Image