Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DarkBasicPro + DarkSnake = (Python+MultiThreading)

Author
Message
Dreq934
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 12th Feb 2004 09:01


Check it out.. DarkBasic running a python script in its own thread! You know what that means right? It means you can have multiple scripts running in the background while your DB code marches on!

TODO: I need to add a "Thread Priority" option to DarkSnake_ExecuteFileThread.

I know I split my old post.. but this is WAY cool

"I LIKE MARSHMELLOWS!" - Homestar Runner
nrasool
20
Years of Service
User Offline
Joined: 22nd Sep 2003
Location: Surrey Area
Posted: 12th Feb 2004 11:12
Very cool indeed.

Just a newbie scripting question

Quote: "It means you can have multiple scripts running in the background while your DB code marches on"


In real game terms, what could be easiest possible to do with python scripting. I know some lucasart games use LUA scripts with their games

A Good Programmer never blames his tools
Dreq934
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 12th Feb 2004 11:22 Edited at: 12th Feb 2004 11:55
Heres a few examples:

-- Window Stuff --
You can threadexecute, say, a toolbar or window (using the wxWindows python lib) to compliment your new map editor.


-- AI Stuff --
You can have enemy AI running as a python thread in the background doing all the AI logic and such. That will allow your main darkbasic code to just concentrate on drawing everything.



-- Extream Example --
You could have a game that, when it starts it:
- Calls the AI script as a thread
- Calls the net connection handler as a thread
Then does nothing but draw the graphics, handle the camera, and write needed values to the variable memblock. The scripts will do their parts, which will come together. That will make it so, even if your FPS is dragging at 20fps, your AI and network code are still running at decent speeds.


I could go on forever



*Edit
Python's standeard library has support for winsock, file i/o, threading (although my threading is pure win32, you can sub-thread in python).. And python has extention modules you get get elsewhere; like http://www.wxpython.org/, http://www.pygame.org/, etc.. Python is really verisitile!

"I LIKE MARSHMELLOWS!" - Homestar Runner
Dreq934
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 12th Feb 2004 11:28
Oh, and heres the .CHM (Windows help file) of DarkSnake so far. Its not much right now, but you can tell i'm working hard on this

http://www.digitalneo.net/DarkSnake.chm

"I LIKE MARSHMELLOWS!" - Homestar Runner
nrasool
20
Years of Service
User Offline
Joined: 22nd Sep 2003
Location: Surrey Area
Posted: 12th Feb 2004 12:29 Edited at: 12th Feb 2004 12:29
Quote: "-- AI Stuff --
You can have enemy AI running as a python thread in the background doing all the AI logic and such. That will allow your main darkbasic code to just concentrate on drawing everything."


This sounds good, a good way of freeing up resources for darkbasic

Quote: "Its not much right now, but you can tell i'm working hard on this"


Hey... each project was small in the beginning, but lets hope this grows, and become a part of the darkbasic coding

Keep up the good work

A Good Programmer never blames his tools
walaber
20
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 12th Feb 2004 12:35
this sounds really exciting!! what will you need to use this plugin? obviously DBPro and your plugin, anything else?

I'll take a look at the python site tonight, that will probably answer my question.

sounds like this could be a GREAT way to make reliable multiplayer games!!

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia Ti4200 AGP 8x 128MB
flibX0r
21
Years of Service
User Offline
Joined: 14th Feb 2003
Location: Western Australia
Posted: 12th Feb 2004 12:48
Need any help? I'm loving to look of this. Can i beta test? can i help in anyway?

This so cool. Yay! i can do multithreaded AI! yay!

0100100100100000011000010110110100100000011001110110111101100100
No, really, its true. Honest
http://www.w3th.tk
Dreq934
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 12th Feb 2004 12:54 Edited at: 12th Feb 2004 13:08
Well I'm certainly happy that people are excited about this. I would be too if i wasn't comming down with that nasty stomach virus tahts going around ..

As far as testing, It would be nice to have some testers, only a few though. I would prefer people who already have a basic understanding of python and have worked with it some.

Anyone interested can contact me via a messenger (see my profile).

Thanks guys!

*Edit
Quote: "what will you need to use this plugin? obviously DBPro and your plugin, anything else? "

You'll need to distribute Python23.dll with your appliaction, along with any libraries you use. If you make use of enough standard python libs, you may have to install python itself alongside your program (if they don't have it already). This is especially true with Python/wxPython window lib.

Of course if your making a very pro app, you can always self-contain it. The way I test is I copied the python install dir, uninstalled python, then moved files to my project dir until it stopped bugging out All of these thigns will be covered in the help file eventuially.

"I LIKE MARSHMELLOWS!" - Homestar Runner
Bulleyes
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 12th Feb 2004 17:15 Edited at: 12th Feb 2004 17:18
But is it possible that DBpro code can communicate with the Python code, and vice versa in some way? i.e. passing values from DBpro's variables to Python, and getting the value of some variables in Python to DBpro. If this is possible, then it might make game scripting a lot easier. Otherwise, I am not convinced that it is gonna be VERY useful, as they (DBpro and Python script) will be running as two independent processes, without any relationship between them.

Quote: "Calls the net connection handler as a thread."

How is this possible? I presumed that you are using some Python's socket library and not the DBpro's net connection?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Icebreaker
20
Years of Service
User Offline
Joined: 31st Oct 2003
Location: New York
Posted: 12th Feb 2004 17:44
If I'm following this right, and python is as close to perl as I have been told (my experience is with perl), then the inherant(sp?) IPC in both languages should be able to accomplish this communication. Correct me if I'm wrong, but is this a simple IPC plugin for DBPro? If so, I'd like to see it, if ya don't mind. I rely a lot more on Perl, I might be able to jockey an adaptation.
Dreq934
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 13th Feb 2004 01:21
Quote: "But is it possible that DBpro code can communicate with the Python code, and vice versa in some way? i.e. passing values from DBpro's variables to Python, and getting the value of some variables in Python to DBpro."

http://www.digitalneo.net/darksnake4.jpg

Quote: "How is this possible? I presumed that you are using some Python's socket library and not the DBpro's net connection?"

Yeah, right now anyway. I'll look into interfacing DBPro's DirectPlay system. I'm sure if the DBPro C++ class has a pointer to the DirectPlay class that DBPro created, I could definatly interface it

Quote: "If I'm following this right, and python is as close to perl as I have been told (my experience is with perl), then the inherant(sp?) IPC in both languages should be able to accomplish this communication."


The problem is not on the python side, its DBPro side. DarkBasic doesn't pass the handles of the variables. So I must make a wrapper that uses MemBlocks (which does allow the return of pointers) to write and read variables to. I'll make this as painless as possible.

"I LIKE MARSHMELLOWS!" - Homestar Runner

Login to post a reply

Server time is: 2024-04-27 05:40:08
Your offset time is: 2024-04-27 05:40:08