Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


Re: help with networking in python

Ok, thanks a lot for that...

URL: https://forum.audiogames.net/post/481755/#p481755




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: help with networking in python

Of course. I admit that thats a thing every new developer needs to learn. You need to generalize your problem as far as possible. An audio game is actually something much more easy than a usual video game, because it uses the very same concepts that a video game uses, except it doesn't need the graphics and applies a bit more sound effects instead. But the concepts are the same. And video games again use concepts that don't actually don't have something to do with video games, like how Do I read user input, how can I output sounds, establish a connection to the internet, write a client and a server, write an intelligent algorithm to solve my problem... all those things don't actually relate to video games when looking into those, but coming together, those will be helpful when developing one, and same goes for audio games. What you're searching for is not a solution to build an audio game, because you need to think about that yourself, but what you're searching for is just the solution to your part of the audio game, namely the internet part right now.

URL: https://forum.audiogames.net/post/481752/#p481752




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : NicklasMCHD via Audiogames-reflector


  


Re: help with networking in python

@6 yes essentially.When searching always start with a broad, a search term as possible.

URL: https://forum.audiogames.net/post/481751/#p481751




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


Re: help with networking in python

so @5 what you are basicly saying is that i can apply software internet or networking usage with my audiogame, as it is basicly the same consept?

URL: https://forum.audiogames.net/post/481743/#p481743




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: help with networking in python

Relating to your last sentence:ashleygrobler04 wrote:And that networking examples are not related to audio game stuff...I'd recommend to not just you, but all of the newbie developers here, to start generalizing your google search terms and your way of thinking. I know that most of you want to program audio games. But see, audio games are a rather limited topic out there, and you won't find any advice for them in the sighted community at all. The internet and the communication through it is a rather wide topic and you are able to find many examples out there, but as soon as you look out for examples relating to audio games, you won't find any, although its exactly the same, but you're just limiting yourself here.If it comes to googling stuff and teaching yourself by doing so, you need to almost always forget your farthest goal. Its nice that you want to develop an audio game, but thats not actually what you want to google now, the first thing you need to know is: how does server client work in python. Googling this will show you some search results from the very own Python website. As soon as you know that the Twisted library will probably your favourite tool to do this (and i'd recommend this), you can google things like: client server twisted python. That will give you a pretty detailed example page from the Twisted library. And as soon as you say "well, now I know how it theoretically works, although I don't know how I should use it with pygame/pyglet yet", you can file another Google search: twisted pyglet python. That will return you a github project called pigtwist, which combines pyglet and twisted, and also some stackoverflow topics mentioning this topic. And so on. Always move in little steps. But do forget that its all about an audio game, because almost noone in the sighted community cares about those, thus you won't find any search results you think will fit your criteria. And no matter how hard we here at audiogames.net try, there are how many? maybe 10? active developers here who can help you with your questions, thats not nearly enough to achieve the same you could find out just by googling the right buzzwords.Best Regards.Hijacker

URL: https://forum.audiogames.net/post/481741/#p481741




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


Re: help with networking in python

Ok, thanks @2 and 3 for the replies, i will take a look at all of it.

URL: https://forum.audiogames.net/post/481737/#p481737




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: help with networking in python

I have some basic examples available using twisted python, though there are a few things you should know first. On a skill based tier, I would rate network programming as advanced compared to the basics or intermediate library use. This isn't necessarily because the individual elements of network programming are hard, but that making sure it works properly under a variety of conditions, dropped packets, latency, time outs, desyncing, and ensuring data transfer is secure, can be a very complex affair. As a general rule of thumb, its also recommended to plan for networking from the beginning, as it can effect how you structure your program around it and adding it after the fact can involve alot more refactoring. Now, here's an example server/client program, "S" starts the server, "C" connects to it, "Q" quits, and "D" disconnects clients from the server.import pyglet
from pyglet.window import key
from pyglet import clock

from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet.protocol import Protocol
from twisted.internet.protocol import Factory
from twisted.internet.protocol import ClientFactory
from twisted.internet import reactor
from twisted.internet import task

import pickle
import zlib
import random

pyglet.options['debug_gl'] = False

#primary window/game class
class Prototype(pyglet.window.Window):
def __init__(self):
super(Prototype, self).__init__(640, 480, resizable=False, fullscreen=False, caption="Test")
self.clear()

#server side connected user variable, when someone connects the Echo Class will add itself into it.
#then just call self.user.sendData to transmit to the connected user or check self.user.inbox to get data.
self.user = []

self.server = None
self.client = None

#since the Reactor is in control, to properly run the main game loop you have to manually call the clock.
#this variable is to keep track of the last time the clock was ticked.
self.old_dt = clock.tick()
self.fps_display = pyglet.clock.ClockDisplay()


#shutdown program gracefully
def shutdown(self, result):
reactor.stop()

#system error shutdown
def bailout(self, reason):
reason.printTraceback()
reactor.stop()

#main game loop
def update(self):
while not self.has_exit:
#manually dispatch window events (since twisted reactor is in control)
self.dispatch_events()

#Make sure events are timed properly while coiterating with network layer. That and tick clock events like the fps counter and game pacing.
dt = clock.tick()
self.old_dt = self.old_dt + dt

#if enough time has passed, update game state
if self.old_dt >= 0.025:
self.old_dt = 0

self.clear()

for a in self.user:
if len(a.inbox) > 0:
print(a.inbox)
a.inbox = []

self.fps_display.draw()


#draw here and manually flip frame buffers
self.flip()

#return control to twisted Reactor
yield 1


def on_key_release(self,symbol, modifiers):
#start server
if symbol == key.S:
self.server = TCP4ServerEndpoint(reactor, 8007)
self.server.listen(QOTDFactory())
print("server initializing")
#connect to server
if symbol == key.C:
self.client = reactor.connectTCP('localhost', 8007, EchoClientFactory())
print("connecting")
#disconnect client from server side
if symbol == key.D:
for a in range(0,len(self.user),1):
self.user[a].disconnect()

if symbol == key.Q:
if self.client != None:
#disconnect from the client side
print('stopping client')
self.client.disconnect()
self.close()

if symbol == key.SPACE:
for a in self.user:
a.sendData("space pressed")



#this handles two way communication with connected clients
class Echo(Protocol):
#data reciever class
def connectionMade(self):
#add this class to the main program
window.user.append(self)
#stored incoming data
self.inbox = []

def dataReceived(self, data):
data = ""
data = ""
self.inbox.insert(0,data)

def sendData(self,data):
data = ""
data = ""
self.transport.write(data)

def disconnect(self):
self.transport.loseConnection()



#this monitors the port and automatically calls Echo() when someone connects, passing their address to it.
class QOTDFactory(Factory):
def buildProtocol(self, addr):

Re: help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector


  


Re: help with networking in python

hi,consider learning sockets and select modules (available on python's docs).also it depends on your needs on how you want to send data.

URL: https://forum.audiogames.net/post/481722/#p481722




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


help with networking in python

2019-12-01 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


help with networking in python

Hi all, i am busy with a fun little game, and i might release it before i add networking to it. but that is not my point, i just want to know if any one could please help me with networking in python for games?If possible, can any one please give me an example of networking in python please or even just point me in to the right direction as to how to get started with networking in python?I found a couple of examples on google, but that is not as effective as i want it to be, meening i don't actually understand what is going on around there.And that networking examples are not related to audio game stuff...Please help if you can!

URL: https://forum.audiogames.net/post/481707/#p481707




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector