2015-04-23 05:51:25

Hello everyone,

So when looking at the developer boards here, there are some people that like Python as a language, a lot of people that like BGT for it's available feature set, and language I guess but to be totally honest I'm not one of them, and even fewer people who like PureBasic for the language and huge reffrence available in the help.
However, the language that I've been the most impressed by so far is Python. The usage of indentation for blocks means that I don't have to worry about nesting a single brace and losing track of it. This has been, by far, the most vexing problem with getting my head around in BGT. I've tried with loops to only giving one or two instructions per loop to avoid nesting issues, but I always get a parcer error that indicates the wrong line in the error. Yes, I know how the error reporting works, but I'd like to be able to figure out how to solve these errors myself and 90 percent of the time, even with the error document in the articles room, it falls short. I get mostly unexpected token errors and it gets pretty hard to find the offending line of code, especially if the error reporter can't point me to the right line of code most of the time.
In any case, I've been going through Learning Python the Hard Way and I'm slowly getting it. What I'm tring to figure out is, what are my limits when it comes to audiogames? People say Pygame is good, but oh wait, Pygame has some audio problems, especially panning.
What about Pyglet? Looking at that, I don't know where I'd begin with that since I'm still learning Python.
Do some of you use these two libraries/modules together, or prefer one over the other? I don't care about 3D audio right now, though I would like 2D audio. A few games down the road I'd like to make the first audio rail shooter in a sidescrolling environment.
Besides Dannie and the Reality Software team, has anyone tried PureBasic extensively? I know Robjoy has and very much enjoys working with it, but what about folks that just started programming with BGT? Perhaps maybe someone should attempt a "Learn BGT the Hard Way" book. I doubt that'd ever happen, but there's a thought.
So, in summary: With Python, how can you make a blockbuster game? If Pygame has audio cons and pyglet doesn't do the job 100 percent and you have to use both together, is that worth it?
Has anyone in this community, particularly programming newbies, tried PureBasic and what are you enicial thoughts and ease of use?

2015-04-23 07:53:13 (edited by dhruv 2015-04-23 07:55:10)

Python is fun. For pyglet, you need to install avbin and package it somehow. I believe frastlin was messing with packaging the dll, so if he would post here that'd be great.
Pyglet basically works like this. You have your loop, that runs the game for you. Bgt gives you things like this.
When you press enter, wait 5 seconds then open the game.
Pyglet is like this.
On every repeating of the loop (which you set as 1 second a loop), make a variable that is added to by 1 till it is 5. As you know the loop is 1 ittiration (repeat) one second, and you add 1 to the variable in every ittiration, logically when the counter (variable) is 5, the loop has executed 5 times. So. Check every loop ittiration if the counter is 5, if not, counter+=1. When the counter is 5 (5 seconds have passed), execute the code.
This could be slitely complicated than bgt, but it gives you a lot of flexibility later on.
If you need any more help, just post in here-me, and other python users will be happy to help.

This is not a signature.

2015-04-23 11:03:45 (edited by CAE_Jones 2015-04-23 13:07:22)

I wrote something like a port of BGT's sound_positioning functions to Pygame:

https://www.sendspace.com/file/yja837

The convert function takes pan and volume in the units used by BGT, and returns a toople for the channel volumes as used for pygame sound.
But you don't need to use that unless you're adjusting a sound directly; otherwise, the position_sound_1d and position_sound_2d functions should work exactly as they do in BGT. Just be sure to send a channel instead of a sound.
So, in BGT, you might do:

sound mysound;
mysound.load("c:\\windows\\media\\ding.wav");
position_sound_2d(mysound, 0, 0, 4, 2, 1, 1, 0);
mysound.play();

Whereas the python version would be like:

mysound=pygame.mixer.Sound("c:\\windows\\media\\ding.wav")
position_sound_2d(mysound.play(), 0, 0, 4, 2, 1, 1, 0)

IIRC, there's a way to get the channel before playing, but I don't remember it offhand. That might be better just to avoid buffering issues.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-04-23 12:17:11

Just chimed in to clerrify that you dn't need the ; at the end of python lines. smile

This is not a signature.

2015-04-23 12:48:58

Hi, dm 2 was ment to be a rail shooter, but i'm out of ideas for it. I know gortholon used pure basic for rtr.

Check out the new reality software site. http://realitysoftware.noip.us

2015-04-23 13:06:52

At Dhruv: ah, oops. I copy-edited the code and must have forgotten to remove them. Fixing now.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-04-23 19:19:28

@Orin, by far Python is definitely your best option here as far as I am concerned. As you noticed unlike BGT Python is very light on syntax and does not require all the braces, brackets, and semi-colons of more C-style languages like BGT. It is more simple to learn and use provided you get your spacing and indentation right.

Another reason I have become a fan of Python over the last few years is it is truly a0 cost solution. The majority of tools and documentation for Python is absolutely free of charge where with Purebasic you have to pay for it with little to no benefit in doing so. Even with C++, a language I use a lot in my professional development, usually comes with some financial costs attached somewhere down the line where Python is usually a cost free solution all around.

Another issue to be concerned with is cross-platform development. I'm not sure but it seems to me you are a Mac user. If so Python is far more suited to developing games and apps for Mac OS X than is BGT or Purebasic. Even if not it is something to consider given that today the VI gaming community is spread out over Windows, Mac, and Linux and using Python makes it much more likely to target non-Windows users with minor updates and changes in code.

As for Pygame it is so/so. It is certainly not on par with DirectX, but if you aren't developing a game requiring 3d audio etc you can make do with Pygame. It will give you basic keyboard, joystick, and mouse input, has some basic networking capabilities, and the 2d audio panning works if you know what you are doing. Since Pygame's panning is very simple and rather basic you'll have to use a bit of math to have the roll-off sound smooth and natural, but it can be done.

Sincerely,
Thomas Ward
USA Games Interactive
http://www.usagamesinteractive.com

2015-04-23 21:55:16

Personally, I'd go with Python. As Python is used for, like, literally, everything. I'd probably go with it because I enjoy it and love its syntax. It's just like writing an article or book, accept your writing the book and having a program (Python) - the editor - check it over for errors and tell you what you need to correct. The classes are books, volumes, etc., and the defined functions are chapters. Inside the chapters, the variables, statements, etc. are text that the editor reads when it looks at your book - or books. That's kind of how I analyze a Python program.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-04-23 22:14:36

Goren,
I've actually tried pure basic. As you might know, I'm creating a racing game in it, which I plan to make comercial. Pure basic is quite a good language, albeit it has some limitations that might be major, you decide. First of all, it costs money. So if you could Pithon, I'd say do so. However, pure basic is easy to use, and there are no braces and such. It has numerous features that are, in my opinion, easy to access as opposed to bgt in most cases. The reference manual is definitely a plus. It's useful for one who is in the middle of something and needs to grab a snippet of code.
  There are ways to conduct both 2 and 3d sound manipulation. The Free SL sound library, though it has some known issues, can simulate a real environment. There is also a generate_pan procedure, one such as I have and can distribute if you need it, which was coded by Ghorthalon the dragon, who created the road to rage I: fires of war, Opperation Blacksquare, March Masicur and other such games in pure basic.


  Sorry this post got so long...
tongue

If you have issues with Scramble, please contact support at the link below. I check here at least once a day, so this is the best avenue for submitting your issues and bug reports.
https://stevend.net/scramble/support

2015-04-24 02:05:54 (edited by Ethin 2015-04-24 02:07:37)

@severestormsteve1, yes, PureBASIC is good for games. But its not good for general programming, in my opinion. It has quite the good graphics and sound libs, but Python doesn't have any braces either. A simple GUI hello world in Python is as follows (note that tkinter needs some major accessibility improvements, but otherwise its nice):

import tkinter
from tkinter import ttk

class Application:
    def __init__(self, root):
        self.root = root
        self.root.title('Hello World')
        ttk.Frame(self.root, width=200, height=100).pack()
        ttk.Label(self.root, text='Hello World').place(x=10, y=10)

if __name__ == '__main__':
    root = tkinter.Tk()
    Application(root)
    root.mainloop()

This example shows usage of the Frame and Label widgets, and some basic layout management using pack() and place(). Of course, this is not accessible, as I just found out. Other GUI libraries must be used, but all the same Python would be a better choice as it contains many more features related to its purpose, and many more purposes, with hundreds, if not thousands of libraries downloadable on pypi.org.
We could argue this back and fourth, but I won't. My top recommendation, though, is Python.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-04-24 02:29:42

1. The first poster strongly implies that he is hoping to create audio games.
2. Also note, that pure basic has no braces, or even brackets within its syntax. In fact, you'd be hard pressed to find a period. I noted the following symbols in your code:
the : sign
(
)
period.
_
the signs most common to pure basic.
(
)
;(but this is just for comments which really aren't needed)
\


3. and as you pointed out on many occasions, that is not accessible, at least not the code you demonstrated. Why on earth would you attempt to persuade some one who is seeking advice from a blind community using an inaccessible code excerpt that would be a major waste of their time anyway?
4. If I'm not mistaken, that is a 14 line hello world script. Something like that could be done in pure basic like so:
openConsole()
Print("Hello world!")
Delay(3000)
CloseConsole()
5. I agree with you that pb is not, the best for program development; It seems more geared towards games anyway, which seems to be what the creator of the topic is looking to create. But if he wants to create programs and not games, yeah pure basic would not be the best for this.
6. As for not arguing this back and forth with me, that is fine. But that means no more posts will be published by you regarding this matter, I assume.

If you have issues with Scramble, please contact support at the link below. I check here at least once a day, so this is the best avenue for submitting your issues and bug reports.
https://stevend.net/scramble/support

2015-04-24 02:35:30

Hi,
I don't want to argue in this python/purebasic debate, but I just want to clerrify some points.
the thing that you're doing with print is a commandline interface. I can just do that with
print "hello world!"
As for an accessible gui solution, wx widgets are pretty accessible, and a hello world appplication in wx goes like this (copyed from docs)
import wx

app = wx.App(False)  # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
frame.Show(True)     # Show the frame.
app.MainLoop()
That's all there is to it! smile
Also, you don't need _ in python; it's just a useful sign to separate function names, like my_function_name.

This is not a signature.

2015-04-24 02:42:30

Thankyou for the clarification Druv. If it were you who initiated this discussion I'm sure my post wouldn't have been necessary... you know. But I fully agree that Pithon is better than PB for application development. I was just talking in terms of game development, as far as what I use. It doesn't matter much anyways; my post, post 9, was meerly an opinion. It seemed that post 10 was attempting to suggest a debate. But anyways, that was just my take on the matter.

If you have issues with Scramble, please contact support at the link below. I check here at least once a day, so this is the best avenue for submitting your issues and bug reports.
https://stevend.net/scramble/support

2015-04-24 02:50:40

Yeah. One point also is no one has actually created any kind of good audiogame in python yet. I will be trying to do that, to show it can be definitely done smile.

This is not a signature.

2015-04-24 02:55:36

Yes. Python looks "magic" but no one here made any game with it...it's our work to change that big_smile
I personally find python extremely slow compared to the C language family...but it's just another fact which may not be important for what we did here.

2015-04-24 04:00:20 (edited by Ethin 2015-04-24 04:06:24)

I would like to point out that SoundRTS was written in Python, so post 14's statement is not true.
I even have proof:

# from soundrts/SoundRTS/clientmain.py:
from lib import log
from version import VERSION_FOR_BUG_REPORTS
from paths import CLIENT_LOG_PATH
log.set_version(VERSION_FOR_BUG_REPORTS)
log.add_secure_file_handler(CLIENT_LOG_PATH, "w")
log.add_http_handler("http://jlpo.free.fr/soundrts/metaserver")
log.add_console_handler()

import locale
try:
    locale.setlocale(locale.LC_ALL, '')
except:
    from lib.log import warning
    warning("couldn't set locale")

import os
import pickle
import sys
import time
import urllib

from clientmedia import voice, init_media, close_media
from clientmenu import Menu, input_string, END_LOOP
from clientserver import connect_and_play, start_server_and_connect
from clientversion import revision_checker
import config
from constants import MAIN_METASERVER_URL
from definitions import style
from game import TrainingGame, ReplayGame, reload_all
from lib.log import exception
from multimaps import worlds_multi
from msgs import nb2msg
from package import get_packages, get_all_packages_paths
from paths import REPLAYS_PATH, SAVE_PATH
import res
from singlemaps import campaigns
import stats
from version import compatibility_version


_ds = open("cfg/default_servers.txt").readlines()
_ds = [_x.split() for _x in _ds]
DEFAULT_SERVERS = [" ".join(["0"] + _x[:1] + [compatibility_version()] + _x[1:]) for _x in _ds]
SERVERS_LIST_HEADER = "SERVERS_LIST"
SERVERS_LIST_URL = MAIN_METASERVER_URL + "servers.php?header=%s&include_ports=1" % SERVERS_LIST_HEADER


class Application(object):

    def choose_server_ip_in_a_list(self):
        servers_list = None
        try:
            f = urllib.urlopen(SERVERS_LIST_URL)
            if f.read(len(SERVERS_LIST_HEADER)) == SERVERS_LIST_HEADER:
                servers_list = f.readlines()
        except:
            pass
        if servers_list is None:
            voice.alert([1029]) # hostile sound
            warning("couldn't get the servers list from the metaserver"
                    " => using the default servers list")
            servers_list = DEFAULT_SERVERS
        nb = 0
        menu = Menu()
        for s in servers_list:
            try:
                ip, version, login, port = s.split()[1:]
                # ignore the first parameter (time)
            except:
                warning("line not recognized from the metaserver: %s", s)
                continue
            nb += 1
            if version == compatibility_version():
                menu.append([login, 4073, login], (connect_and_play, ip, port))
        menu.title = nb2msg(len(menu.choices)) + [4078] + nb2msg(nb) + [4079]
        menu.append([4075, 4076], None)
        menu.run()

#...

So there you go. A game written in Python.
@Genroa, the only reason Python is slow is because the people who write the programs that you use don't know how to optimize their code. If they called the right module, and compiled their script into a .pyo file, the interpreter would be much faster. Alternatively, they could use cx_freeze, written in Python, to compile it to a win32 .EXE executable which would make it even faster.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-04-24 04:05:09

Ah heh. Sorry. I forgot about that. But compare that to like the 10 or so games written in pb and stuff.

This is not a signature.

2015-04-24 04:09:40 (edited by Ethin 2015-04-24 04:10:33)

@dhruv, yes, I agree with you on that point. However, while Python doesn't have that many games written in it, it's got its own set of modules that make it a perfect programming language for both game programming and general programming: pathlib --- Object-oriented filesystem paths, os.path --- Common pathname manipulations, csv --- CSV File Reading and Writing,   hashlib --- Secure hashes and message digests, hmac --- Keyed-Hashing for Message Authentication,   os --- Miscellaneous operating system interfaces,   email --- An email and MIME handling package, etc. PB could have all of this, but it would require a lot of C/C++/ASM programming to accomplish.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-04-24 04:11:59 (edited by Ethin 2015-04-24 04:16:39)

Sorry for double posting, but I want to point out one more thing: Python has its own package index. While other programming languages do have this, Python, IMO, has the most packages. It has about 58,526 packages available. PB has hardly 25.
@severestormsteve1, what's wrong with having other symbols in Python that PB doesn't have? Why is that such a complicated issue? C/C++ has way more symbols than Python's got; just go look at the operator list. You focus too much on simplicity, not modularity or flexibility. Python is more flexible than PB because it has more modules, and it can be extended easily. It can even bee embedded into other apps as a scripting language of sorts! Can you say that about PB?
Oh wait, I'm forgetting Lua. Lua can be imbedded and extended too. (Can we please not start a huge war over this? This is just a debate. No flamewars, please? I've seriously had enough of those.)

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-04-24 04:29:29

@Ethin
First of all, you said you weren't going to debate with me about this. another lie... *sigh.
Secondly, is c++ in any way, shape, or form, part of this discussion? No. So don't even bring up that language. That is not the issue.
Thirdly: no, I focus on all three of what you said. While I like simplicity, I also prefer a broad feature set, and something which provides the ability to code games in, something that pure basic does. I also would like to ask you why imbedding into applications is important in this matter? I don't believe such will be necessary in audio game development.
Another thing. When did I say that having symbols in a language made it a complicated issue? I recall comparing symbols in both of the debated languages, as an attempt to validate your "pithon doesn't use braces" clame which, while is indeed true, holds no regard in this discussion unless pure basic does use braces.

If you have issues with Scramble, please contact support at the link below. I check here at least once a day, so this is the best avenue for submitting your issues and bug reports.
https://stevend.net/scramble/support

2015-04-24 11:58:47 (edited by Genroa 2015-04-24 12:01:15)

Sorry, I didn't know SoundRTS was made in python smile

The thing here is : for audiogames programing you can use almost any language, so feel free to use the one you prefer. Python and purebasic are loved because of their syntax and/or community and free tools.

But for real programing, don't dream too much : professional graphic games aren't made with theses languages and most of the programs aren't made with it neither. The basic family is almost dead if we take a look at a global scope, and python is barely used for real big programs (biggest example I know : Blender, which is impressive). Oh, and the Kassie MUD server. Want to crash it? Spawn 1000 items in one room and it's over. CoffeeMUD on the other side is the example of a nearly perfect architecture, for me it's the perfect example of why C/C++/C#/Java languages are still the most used... Correctly used they are on an other level of power than python and pb smile

The syntax change between Python 2 and 3 is for me a terrible mistake, more than half of the packages never made it to the version 3. Don't forget that when choosing.. sad

We could talk about all languages for years, but the important thing for audiogames is : choose the one you feel comfortable with, whatever what other people love. big_smile

2015-04-24 14:11:36 (edited by dhruv 2015-04-24 14:14:22)

As genroa said, use the language you're familiar with; ignore the rest of my post if you don't want highly opinionated things tongue
Python does have a broad feature set. If you don't believe me, go look at the packages in the python cheese shop, which has more than like 50k packages to do diferent things with.
And for game development, pygame, pyglet, etc. Embedding matters for scripting purposes, for example advanced mods and the like, see the entombed2 topic for an explonation of this topic.
So, As I said, use whatever you like. Steve uses purebasic so he's defending purebasic; I use python so i'm defending python. Don't mind me. I get defensive big_smile
Edit: @genroa, look up evennia. I don't think it faces difficulties like that smile

This is not a signature.

2015-04-24 15:51:47

Oh yeah. I completely agree--and just like druv I was defending my language and laying it's feature set out on the table to show both its perks in my opinion and its faults. The people I'm sick of are those who say things like "Yeah, you should use pithon because it has bla bla bla bla bla... " and so on.
  I've already pointed out that pure basic is not good for program development. It is good for audio games, and I say that because I'm using it, danny uses it, and ghorthalon uses it. But the thing is, even bgt and pithon are good, but I don't use them, so I'm not going to say good about them. But by no means will I attempt to get some one to use pure basic; use pithon if you want, it really doesn't matter. I'm just laying out, just like Druv, the perks of the language I feel comfortable with. big_smile. As a result, this is why I will post no more on this... debate, is that what it is? I don't reccon so.

If you have issues with Scramble, please contact support at the link below. I check here at least once a day, so this is the best avenue for submitting your issues and bug reports.
https://stevend.net/scramble/support

2015-04-24 17:46:28

I am too. While I might gotten a little agressive, I was pointing out the perks and faults of it too. I do enjoy other languages like Java/C/C++/C#, however Java really is not a programming language where graphics are concerned, since while it has a lot of libraries, its GUI is not accessible without third-party tools. C/C++ has hundreds of tousands of libraries available, which is more than all three languages we've discussed here - Python, Lua, and PB - so that's probably why its most widely used. C# is .NET CCPPJAVA (C C++ Java), in other words. C# is just a sort of hybrid language between all three. F#, though, is a sort of Java remix, and that's why I don't use it.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-04-25 05:19:25

Orin, the one thing you might have figured out from the responses to this topic is that asking developers "Which language is best for my purposes?" is a lot like asking rabid sports fans "Which team is best?"  My own perspective is that Python, Pure Basic, or BGT should be sufficient for what you want to do.  For you, it seems that the most important consideration is for you to find a language that you feel comfortable working with as well as one that has a good supportive community of other people who are trying to do similar things that will be willing to answer your questions.  Hopefully, the people responding to your question have given you some good ideas who you can reach out to in order to find or build that community.  It also sounds like you are thinking that Python's style is most comfortable for you.  While people have cited some problems with some of the Python game related libraries, I would not worry about that too much as long as you can find a good community to assist you with your questions.  There really isn't a perfect language and most libraries have their problems and part of becoming a real code ninja is understanding what those problems are and knowing how to work with or around them.  And again, a good supportive community will assist you with that.

I wish you good fortune in learning Python and developing games.