Jump to content

  • Log In with Google      Sign In   
  • Create Account

Herwin P

Member Since 09 Apr 2013
Offline Last Active Aug 04 2015 06:57 AM

Topics I've Started

Python for data-driven design?

29 March 2015 - 08:58 PM

Hi, everyone. I'm working on a game project with C++ using SFML for studying purpose. A while ago I read about data-driven design (or is it called data-driven programming?) in this forum, and I think it's a really neat idea, so I gave it a try using jsoncpp. I've got it working, but I'm curious about using Python for the data side. I've also heard that Python is often used alongside other programming languages like C++. I couldn't find any satisfying article about data-driven design, so I hope I can get some advice from this forum.


I've seen it done in a video game series called Mount&Blade, where the modules (mods) are written with Python, but the game itself is made with C++. What are the advantages of using Python files over JSON? And what are the risks? Since Python is a scripting language, I figure it would be more dangerous to use.


Also, if you don't want your data files to be open to the users, how do you pack or encrypt them? Any advice on optimizing data-driven design would be very welcome too. Thanks in advance.

Need Help With Twisted Deferred

16 July 2013 - 01:07 AM

Terribly sorry. It was just a small mistake. I've fixed it. I forgot that I should have returned the deferred object. Sorry everyone.



Question About Game State

21 June 2013 - 11:11 PM


How can I avoid circular dependency?

28 May 2013 - 08:06 PM

I often meet a condition in programming where I have a class which takes an instance of another class and makes use of some functions in that imported class, while that class also needs some functions in the first class.


Like class A has function x() and y(), and class B has function i() and j(). Class A needs to use function i() in class B, and function j() in class B needs to use function y() in class A.


How can I reduce this to minimum? Is there any better way to do this? For some reasons, function y is only available in class A.


Oh, almost forgot this question. How can I do this the right way?


Thank you everyone.

Python Twisted: need help on deferred

24 May 2013 - 12:00 AM

Hi everyone. I'm writing a Twisted based daemon for a simple text-based multiplayer game. The game logic goes like this. The client sends a string in a particular format (command.arguments (also separated by period)) to the server. The server receives that string, split it, and run the command along with the arguments. I already made it working.


Some of the commands called (login for example) has to get data from database. I'm using Twistar to make things fancy.  Here's where I found some difficulties. The function which calls the available commands returns the result of the called command. The problem is that I don't know how to make my login function to return the result of the query.


Simply, what I want : send strings (or list, or number, or whatever) gained from the database to the client.

What I get now : the server sends a deferred object or an empty string or list (I've tried some ways to send things to the client).


I know it sounds so newbie, but this is my first Twisted program, and I'm still learning, so please spare me.


Well, I think the scripts will make things clearer:


The server.py.



The protocols.py



The services.py




There's no complicated logic yet. I started writing this thing just three days ago.


The deferred does fire. It prints the "bla bla bla logged in" properly.


The client is just a simple client which sends 'login.Sky Warden.123'. The arguments will be separated by the '.' as well.


I think that's all. Maybe it's just me who don't fully understand deferreds, or it's just a logic hole. Or maybe both. XD


Thank you everyone. smile.png