Jump to content

  • Log In with Google      Sign In   
  • Create Account

Katie

Member Since 15 Jun 2006
Offline Last Active Yesterday, 12:06 PM

#5255617 Is Python good for 2d - 3d games?

Posted by on 05 October 2015 - 02:37 AM

Python isn't the fastest language around so speed-reliant code is difficult to write.

 

On the other hand, it's certainly fast enough to do the sums involved in moving a few hundred sprite objects around the screen -- one lets the rendering system do all the looping work.

 

The advantage, from a learning point of view, is that much of the boring fiddly work of who owns which bits of memory is done for you so you can focus on the more interesting parts.

 

Many of us grew up writing games in a mix of BASIC and assembly language on 8-bit micros, and the kinds of games which worked well there can be written these days in Python much more easily. M&B is, as Sean says, a bit out of reach, but rogue-likes, 2D puzzlers and platformers, shoot-em-ups and so on are within reach (only with better graphics than the 8-bits!). I wouldn't be surprised to find that with a little extra work, things like Starglider could be done in Python these days.

 

The trick is to design a game that doesn't involve large amounts of data.

 

Large, of course, means something slightly different these days. A z80 instruction to block copy memory[1] costs 21 cycles per byte copied. You only get 50-100 thousand cycles per 50th second TV field on most 8-bit micros. So you can realistically only copy a few kilobytes of memory per frame..  I had a quick naive play with some code and python on its own is capable of copying 400k per frame. So even in plain old python you've got 100 times as much processing power as we had back in the early 80s...

 

 

 

[1] LDIR, for reference.




#5254849 Could this really be that slow?

Posted by on 30 September 2015 - 12:17 PM

Your code is probably a little naive; brute-force approaches to Life aren't particularly machine optimisable -- the compiler's optimisation won't make much of a dent because there's not a huge set of places to go. It's a simple set of operations run a lot of times and the optimiser can't see far enough to improve them.

 

There are much faster solutions, but they are algorithmic optimisations. Eg; using a quad-tree to detect "idle" sections of the plane and skip them. Multiple chasing-pointers which can turn the 8 surrounding cell checks into just a couple. (When you come to look at pixel (x,y) you already know 5 out of the 8 cells. You used them for (x-1, y)...)

 

There are other approaches including run-length encoding the bitmap (reducing the amount of memory accesses needed), sparse grid techniques (Life planes are often sparsely occupied). Dirty rectangle systems, bit-fiddling approaches that can evaluate multiple cells at a time (encode cell neighbour counts in 3 bits and the current state in 1 and now in a 64 bit register you can operate on 16 cells at a time..

 

You can get away without having a grid at all -- Life plane changes have a speed limit; propagation is 1 cell per generation at most. So not only do you know the cells which might die (the ones which were alive last time), you also know all the cells that might possibly become alive (their neighbours). There are optimisations on these techniques which rely on identifying cells which haven't changed state recently (they're part of a static structure).. you can stop looking at them as well until change propagates out to them.

 

If you're going to use OpenGL, REALLY use it. You can count the neighbours by taking the current bitmap and adding it into a blank bitmap shifted a pixel in each of the 8 directions... suddenly you're operating on hundreds of cells at a time on the GPU. The life/death decisions is another pixel shader -- and then you can render the bitmap without needing the CPU to do any work at all.

 

Life is actually a really great way to try out a ton of approaches to optimising :-)




#5254842 How can I make a text parser?

Posted by on 30 September 2015 - 11:57 AM

If this is a part of something bigger, don't reinvent the wheel. Go get a JSON or YAML parser.

 

Why?

 

1. Toolchains: jq lets you pretty-print and query JSON files. Editors have modes to help you work on the files. There are syntax verifiers and so on.

2. Not finding all the bugs and edge-cases again. Someone's already worked out what to do what you try and put a JSON text into a JSON value..




#5254548 use c# instread of lisp and prolog

Posted by on 29 September 2015 - 01:03 AM

Well, certainly as far as prolog goes unless you've got experience of building a theorem engine, you're missing out on several decades of people developing them. Can't honestly point to a lot of use of prolog in games, but it used to get used a lot in expert systems and does have applications in natural language processing systems.

 

Part of the power about LISP is that code is data and data is code. That's not true in C# (or any of the languages of that family) where code and data are very separate things. LISP has seen commercial use in games (The "Jak and Daxter" series) and the Emacs editor written in it sees widespread use in the UNIX development world.

 

If you're going to be a game AI developer, you should very definitely understand why those languages are used where they are much better -- quite apart from any other reason, academic AI research projects are often implemented in them.




#5254272 Game Development as a Career

Posted by on 27 September 2015 - 04:19 PM

"I'm currently attending a community college in the Virgin Islands and it doesn't benefit me too much. "

 

Yes it does. It's teaching you to stick at things.

 

If you're going to stop going, stop going. Tomorrow. How can you be thinking about maybe not finishing college at some point in the future? Make a bloody decision!! If you're going to quit, quit. Start looking for a job at 9am tomorrow morning.

 

If you're not going to quit, go and ace that VB course -- and I mean, be first in the class. And get working in your spare time as well.

 

"i'll look for a job"

 

What, as a college drop-out? Well, you're certainly reducing the number of exciting opportunities you'll be forced to choose between. Quite apart from not graduating, dropping out of college is a bad way to start a CV. Says you can't stick at things.

 

You don't need online courses to learn languages or games development. Frankly they're just not information dense enough. Why? Because they have to run at the speed of the thickest person in their audience. The thickest person in their audience won't ever get hired as a games developer. If you're going to succeed you need to move faster than that. Get reading textbooks. Get writing software. If you want to be a software developer, act like you're interested in it. Have you written any games? Why not?




#5251133 Generating and initializing content for a text RPG

Posted by on 08 September 2015 - 04:23 AM

SQLite could be quite an interesting solution. It's a single library you link to your C++ binary and lets you run SQL at a database which lives in a single file.

 

You could therefore write an SQL script which sets up the database as part of your build process.

 

The player "starting" the game then means that your app just copies the original master datafile and opens the copy for the player to work with. "Saving" the game consists of closing the SQL connection (to make sure all the changes are committed) and copying the file and reopening the SQL connection and then carrying on.

 

One of the interesting aspects of this is that can manipulate the database "behind the scenes" to help you debug it; because you can just open it in another SQL session and query what happened to those objects when you ran that command.




#5248722 Legal dangers for small indies

Posted by on 25 August 2015 - 03:58 AM

You don't need to worry about this until you have a saleable game product.

 

Artwork can always be swapped out later.

 

Develop complete game-play which people like before worrying about legal structures to sell it.




#5247343 Food for aliens

Posted by on 18 August 2015 - 03:21 AM

"who knows what might happen?"

 

Hehehehe. That was EXACTLY the clip I thought of as well :-)

 

 

Seriously though; there's decent evidence that amino acids (what we need proteins for) and sugars are pretty common chemicals and can even form naturally in chemical clouds in space in quantities we can detect from a thousand ly away. Conway Morris argues in a couple of his books that this would imply alien life a) will exist (because the materials are readily available) and b) will be made of much the same sort of stuff as us, and presumably therefore will have similar basic dietary needs.

 

Note, however, that even on earth many life-forms are incredibly intolerant of even small changes to their diet. Pandas live on particular species of bamboo and won't eat anything else. Sheep can be poisoned by being moved to fields with grass they're not used to... apparently they're very sensitive to trace metals contents.

 

So while it might be possible to synthesise the right foods from materials, the actual food isn't likely to be very portable.




#5246177 Visual Effect: Possible to "Split/Explode a sprite into rows" using a...

Posted by on 13 August 2015 - 05:26 AM

This would seem like an ideal job for a pixel shader. You're (presumably) drawing a rect with some sub-area of a texture mapped onto it. The pixel shader runs for each pixel in the image and can fairly easily detect if this pixel is on a row or column which should be left blank, in which case it simply returns a completely transparent pixel -- essentially instead of scaling the texture patch to fit, it just.. breaks it up.

 

If you think about it in one dimension to start with (because extending it to two is easy once it's working), you want to skip N-1 pixels when the image is N times larger than the original. And you want to do this in texture coords (because you may already be stretching the image to get (say) a 32p wide image to draw onto a 128p wide screen area. So if you ask for a draw onto a 256p wide area, you want the pixels to be XXXX----XXXX---- not X-X-X-X-...

 

So, all you need to know is the "shatter" scaling (2 in the case of above; and it can be a floating number). Take the fractional (sub-pixel) part of your texture coord. Multiply it by the shatter scaling and if the result is >1.0, this pixel should be transparent. ExReader: use sprite-centred coordinates so that the shatter effect is symmetrical...

 

I'd suggest having a play around with a basic shader to start with though -- say getting your sprites to appear in monochrome or some other simple processing as a learning exercise -- then work up to something that needs a bit more juggling.




#5220883 VAT/Sales Tax, Incorporating, Changing DBA, And More

Posted by on 02 April 2015 - 04:06 AM

Go and write the game. Don't worry about any of this stuff.

 

When your game is complete and ready for sale -- or even just ready enough that you're considering investing in hiring some contractors -- then you can go hire a lawyer for two hours to sort all this out for you.

 

Write a good game, worry about selling it when it works.




#5203065 Game event loop using ncurses library

Posted by on 09 January 2015 - 06:15 AM

You can use "select()" or (preferably) "epoll()" to see if stdin has data on it before calling "getch()" to process it.

 




#5189688 General Programmer Salary

Posted by on 28 October 2014 - 07:36 AM

"No one bothers to hire American web devs for JavaScript / HTML / CSS "

 

Well no. Working at that level is simple. I work in JS, HTML, CSS, Java, Python, C++, SQL and a bunch of other languages. And it's not just coding -- I design and develop the features, test them with our users and build things to solve their problems.

 

And I'm definitely making more than $40k.

 

" the pay listed for most "help wanted" sections was $20 - $40 per page."

 

Then I'd suggest looking somewhere sensible.




#5182050 Fear of replacement

Posted by on 22 September 2014 - 02:39 AM

They're not going to fire you for a couple of small mistakes if you've only got 7 months experience. That's what's expected from a junior dev. Hell, two mistakes is doing pretty well.

 

If they are inclined to fire you, they're assholes and you don't want to work there anyway -- the only thing worse than feeling a bit insecure is when the whole of the rest of the company is jumpy as well because no-one works well when they're on edge and everyone's tempers get frayed.

 

The guy who's shouting in public about your mistakes is already demonstrating assholeness. Just accept that he's an over-reactor. Learn some strategies for coping with the over-reactions[1]. That's not how you train people and bluntly he needs moving somewhere where his personal issues won't damage the company's investment in taking on and training new people. Chances are you'll just have him explode at you every couple of weeks. Sorry about that, that's people. There is a chance it's not actually permanent; he may be under other stresses you can't see which may go away.

 

And yeah, like Erik says, just let it lie. Honestly, if he goes off the wall every other week the rest of the team are probably used to just ignoring the content of the noise anyway; their reaction's not going to be judging you, more gratitude that it's not THEM being yelled at.

 

 

 

[1] Alcohol works, but I'm not sure I'd recommend it. Meditation helps. Lunch-time shoe shopping used to get me through bad times but that's a girl thing. Put up with it for a few years, get some credit on your CV from having been involved in stuff and then leave. If you're feeling brave, you could mention the mutual support within the team not being all you'd hoped for in your exit interview and let HR fill in the blanks.




#5167331 Funniest line of code ever ?

Posted by on 17 July 2014 - 03:06 AM

I was working on a project from an outsourced developer and came across an enum which said "{ Z_UP // Z axis points up from the ground, Z_DOWN // Z axis points down, Z_OTHER }"

 

And no-one had felt the need to comment the third possibility...




#5138661 Computer Science vs Software Engineering

Posted by on 13 March 2014 - 05:32 AM

"Well, they can be."

 

People should probably find out they can't do it as early as possible then. Before they find themselves committed to a career they're out of their depth in.






PARTNERS