Tag Archives: python

Inside Look – pyjs

Although not directly affiliated with my own personal project, I still want to try making some posts about interesting Python things I run across and use. Today’s Inside Look is about pyjs! I mentioned it in my last post, but I wanted to give a little more insight into it and why I have been using it.

Now that I’ve been working on some web development, I was thinking my only options would be Javascript and some CSS. I started doing some self-learning to review what Javascript I knew, but for what our team wanted to do, it felt so cumbersome and difficult to will the code to my expectations. This spurred me on to look for some alternative, maybe a way that I could stay with Python, but have all power and control that Javascript has. I nearly immediately ran into pyjs, the Python web app developer’s best friend. It quite literally converts your written Python code into Javascript. There is a large support for most of Python’s built-ins and most imported modules seem to work just fine. I’ve had some issues with using time.sleep(), but I may just be doing something wrong. Pyjs also includes its own module which contains a large amount of UI classes to use and expand upon.

I’ve been designing the prototype for the game using Panels. These are simply cells in a table. Eventually, I would like to progress to using the Canvas. This will probably require more art assets (just basics available right now) and some re-organizing of existing code to be more Canvas, less table. I’m having a meeting tonight with the three other team members to go over weekly progress and what we’d like to focus work on. Hopefully we can get a place to host our app (we’re looking at Chrome Web Store) so we can get testing on multiple platforms and make it easily available for people to play!

If pyjs just isn’t flexible enough or proves to much of a hurdle just to use Python, we may eventually switch over to Javascript. At least transferring Python over to Javascript will be easy!

Tagged , ,

A Little Break from The First Fantasy

With v0.1 released, I feel like it’s in a nice, stable place to sit for a little while. In the meantime, I’ve volunteered to join a small group of my friends in our attempt to make a web game. This is something I’ve never really done before. JavaScript is mostly foreign to me, especially CSS and advanced web concepts. However, I’ve found and have been using a handy tool called pyjs (or PyJamas). It literally takes your python code and compiles it into JavaScript. It also provides a number of modules to facilitate a more “web focused” design. This is also my first “real” attempt at running the entire game through GUI elements.

We’re starting off with a simple Blackjack game to make sure we can get through the entire process (brainstorm, design, art, code, web stuff, hosting) without too many problems. If it all works out and we’re mildly impressed, we may try to make some actual attempts at bringing in some money with future games. It should be fun and already is a definite learning opportunity. I’ll post some information about it when I can, but we’d like to be as hush-hush about it until we know what the hell we’re doing!

Tagged , , ,

Release – v0.1

Summary

It’s here! Although lacking in significant map/travel changes, 8 other significant changes have been made. Many of the changes have been to items and inventory usage while in combat. The market (used to be the shop) is now working in towns and only supplies existing consumables. More interesting things will be added here for sure as a way for the player to gather gear that they may have missed while exploring. Saving and loading games now allows any name to be used for the file. There is no overwrite warning for now, but it will be put in soon. Otherwise, enjoy the game! Send in your feedback or even make some contributions!

Changelist

  • Run option in combat
  • Player can now “die” can not fight until healed in some way
  • Rework and cleanup of inventory and item equipping
  • Inventory is now usable in combat, but equipping gear will skip your next turn
  • Clearer inventory messaging
  • Market system added
  • Save system overhaul

Known Issues

Contributors

Download

Windows Only Executable: 0.1

Source: 0.1

Tagged , , ,

Wrapping up v0.1

I haven’t posted in awhile as I’ve been pretty busy this last weekend getting my girlfriend moved in and with the release of Guild Wars 2, but I have done a few updates on our code and we’re getting close to getting v0.1 ready. You can see here that there are only a few issues left. Map readability may not make it into this release unless someone finds a quick, awesome way of going about it, but as of now, I don’t think it’s work throwing too much time into as it is “working” already. This release will definitely feature all functionality in place. There won’t be an option that doesn’t work or an operating system unsupported. The features may not be as polished as I and others would like, but there will always be room for advancement.

After this release, I’m going to be changing the Downloads page to include the following for each release (if applicable):

  • Executable (Windows Only)
  • Source Zipball
  • Changelist Post
  • Contributors: <List of Contributors>

I found that I could actually choose any commit from the repository’s history and download the Zipball at that moment in time. This should allow me to link to the specific releases instead of overriding each time when the “master” get branch will be updated with a new release or patch. Anyway, I’m going to be at PAX this weekend, so unless something amazing happens code-wise, the release should be out early next week.

Tagged , ,

Release – v0.09

Summary

While not radically different visually, I, and a couple contributors (Onionnion and Horst), made some big changes to documentation and making sure we adhere to PEP 8 styling standards. Another major addition would be the support for multi-platforms. Linux should now be able to save/load games and pause/clear the screen. Game wise, I’ve put in some unique items for you guys to find! There’s one for each type of equipment! If you manage to find all at once and equip them, send me a screenshot and I’ll make another unique based on your input! Give this release a run through. v0.1 is going to need to be super stable with all basic functionality (shops/markets!) implemented so send any bugs or suggestions my way or submit an issue on github. Thank you everyone for your support!

Changelist

  • Full adjustment to PEP 8 code style.
  • Added unique equipment.
  • Non-Windows operating system support (Linux confirmed).
  • Updated README.txt to be a little clearer.

Known Issues

  • No change to existing issues. See github in the future.

Download

Windows Only Executable: 0.09

Source

Tagged , ,

Patch – v0.08b

Another quick patch to fix saving/loading for Linux users. Once we fix these and it looks stable, I’ll bring everything in for v0.09.

Source Zipball: v0.08b-zipball

Tagged , ,

Patch – v0.08a

Put together a quick patch for our Unix friends who were having some issues with Windows dependent system commands. If you have future issues you think are OS related, please let me know and include your Python version as well. Thanks to those who submitted your feedback!

Windows Executable: v0.08a

Source Zipball: v0.08a-zipball

Tagged , ,

Inside Look – Eclipse IDE and PyDev

For my IDE of choice when working with my project, I use Eclipse. I was introduced to Eclipse a couple years after I had made the first iteration of The First Fantasy. Now instead of Java, I use it for Python development. To do this, I use PyDev. There’s a ton of features, including the ones you would expect from a proper IDE like code completion, syntax highlighting, code coverage, and a debugger. It feels natural and provides me really everything I need as a Python newbie. In fact, it’s probably got more features than I’d ever use in my lifetime.

Eclipse has literally hundreds of additional software projects that can be installed to enhance productivity. PyDev is just one of these. Another tool that I use is EGit, a git plug-in to allows me to perform version control operations from within the IDE. I’ll go into EGit more in a later, as it can be pretty complex compared to other VCS solutions and deserves its own post.

What IDE do you use? I hear all sorts of methods that people use to work on their code and a surprising number of them use basic text editors such as VIM or Sublime to write code. I couldn’t submit myself to that kind of torture for larger projects, but I’d imagine it would feel good to make something from complete scratch with little assistance.

Tagged , , ,

Source Code Available

After a few requests and me finally succumbing to the beauty of open software, I’ve made a repository on github to host my project and for anyone to view and possibly contribute. You can access that repository here:

https://github.com/Bluedagger21/the-first-fantasy

Transitioning over to git was more complicated than I would have liked, but I can definitely see the advantages of using it over subversion although I will miss its simplicity. Anyway, this will mean a few changes to links on this site and how Downloads will work. I’ll be hosting the distributable versions of The First Fantasy in the downloads section on github, but linking to those from my blog. As the link to the source is always the same, it will have it’s own section in the Downloads page.

I’m hosting the project to the public to share, learn, and help others that are open-source project newbies get on their feet. There’s still a lot of documentation that I’d like to do so viewers/contributors can better understand my thinking, and you can expect additional commenting to be a priority right now. If you have any questions, please feel free to send them over to me. I might even make a post to explain a process I use.

Tagged , , ,

Inside Look – py2exe

Early on in development, I immediately recognized the need for The First Fantasy to be easy distributed and ran without handing over a load of source files and asking the user to build them and also have the Python interpreter on their machine. This is where py2exe came in for me.

py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

The output from using the utility is what I zip and make available in the Downloads page. Nifty huh? All that’s needed is to create a simple setup.py file in your working source directory with the following:

from distutils.core import setup
import py2exe

setup(console="main.py")

Then, through a batch file or command line, execute both of the commands:

python setup.py install
python setup.py py2exe

Py2exe will create a build and dist directory. The build directory can be discarded, but the dist directory contains everything needed (besides possibly a couple .dlls that the user should have) to run the program. Numerous options exist that allow you to modify the output such as renaming the executable, choosing where to place the dist directory, and several optimization options.

Tagged ,
%d bloggers like this: