Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Anvilfolk

Pages: [1]
Programming / Nausicaa Engine
« on: July 26, 2013, 01:42:32 PM »
There seem to be some really competent devs around here, so I thought I'd use this as a place to get feedback, bounce ideas and generally talk about game engine development.

I'm currently developing an engine that I hope will be useful for most types of 2d games. I'll be using it for a few proofs of concept games, and for NausicaaRL, a roguelike based on Hayao Miyazaki's masterpiece.

I'm using Python 3.3 and PySFML 1.3, based on SFML2. The github repository is at

The main concepts I am adhering to while programming this are:
- Seperation of logic and rendering
- Event-driven communication
- Entity system implementation
- Process management rather than "update(); render(); input()" loop

To be honest, I have read about so many different concepts that my mix'n'match might not make sense a ton of sense at the moment. Either way, here's some base modules and explanations.
  • contains Entities as aggregation of Components, and Components as data only. Systems are also here, and they track which entities have which components so that they can act on their data. There are two concerns here:
    • Many entity systems contain a RenderableComponent inside an Entity, which I dislike since it means that the game logic is including some visual information. It would be hacky to then make a dedicated server that did not need to have any rendering information whatsoever. Therefore, there will be no renderable components. Rather, whenever a component is created, an Event will be called, and the visual representation of the game, if any, will be responsible for figuring out how to display it.
    • Entity systems are typically used for real-time games. In a roguelike, you essentially have an event-driven system. I am thinking that the engine will have systems that can run in real time (they process all relevant entities every "frame"), and systems that simply work as event listeners to handle different things.
    There is also a World class that will contain the entities, and manage systems, entities, components, etc.
  • Process and ProcessManager. A process is something that needs to execute over several frames, like animations, particle systems, AI, etc. It's fairly simple stuff. It runs, and sometimes it can be aborted, stopped, it ends, starts, pauses, etc.
  • there will be a singleton EventManager for ease of access, but many important classes, like a World, a Game, etc will subclass EventManager to allow local, more efficient communication. Events are currently dispatched according to their class. I am hoping that having lots of more localised EventManagers will make this simple system fast and robust enough, as there won't be lots of listeners that get irrelevant events.
  • manages GameStates. I am currently unsure whether this should be tied to the graphical representation or not. I feel a dedicated server will simply host the game itself, and not other states. This would essentially be a scene manager, for the main menu, game, score menu, etc. As such, I am thinking that the HumanView, the graphical representation of the game, will contain a GameManager, and each GameState will contain a GUIPane on which contents will be rendered.
  • Views are intended to be anything that receives events and presents a view of the game to anything. In this case the HumanView presents it to the user, so it manages the Window, GUI, etc. A RemoteView will likely receive all important events in the game world and send them to remote clients. It does not need to worry about visuals at all.
  • the GUI system, oh god, the GUI System. How much I hate this. It's so annoying to implement. Everything is either a NGUIBase or an NGUIPane (which extends NGUIBase). Panes may have more content. Everything has several properties that can be checked, like whether the mouse is within its bounds (independently of whether there is another element in front), and whether it has mouse focus, i.e. whether the mouse is on top of this, and nothing else "above it" is capturing it". NGUIBasicButtons, and most buttons in general, will also have a "primed" state, where the mouse has been clicked but not released. Upon losing focus, they also lose primeness. Everything is managed through its own EventSystem... I should perhaps integrate it, though right now the system is fairly intuitive. You can add listeners to every GUI component, and if certain methods exist, they will be called when appropriate (onMouseFocus, onMouseDefocus, onMouseDown, onMouseUp, etc).
  • TextManager, ResourceManager, Utility
can be used to load resources such as text, data, fonts and textures to be rendered.

There's lots of tidbits that still need to be tested and implemented all across the board, and in particular in the rendering, GUI and input parts. I feel it's getting closer to be usable as a game system, and I'm hoping to be able to implement a very basic game soon to make sure the engine actually makes things easier to implement.

I am still relatively unclear on how to handle input, both mouse and keyboard, however.  My current system is that whenever a key gets pressed, it is converted into a GameEvent that contains all types of actions it may represent. For instance, pressing "e" can mean either "open equipment screen" or "select item (e)", or lots of other things. The problem is that this interpretation is global, so the GameEvent with the open equipment screen and select item (e) gets propagated everywhere, which doesn't make a lot of sense. I am thinking that each GUI element should have its own way to convert keypresses.

But what about mouse stuff? Do I make every sprite a "button" and add listeners to everything for selection? What about drag'n'drop? What about drag'n'drop between two GUI elements? These things still have me a little baffled.

Anyway, I just hope this will spark some interesting discussion like the one in the rendering question thread :)

In particular, I am not entirely convinced that the entity system for a game as complex as roguelikes will make components as decoupled as they were meant to be... and might actually make things harder, as you try to send off events and counter-events (that might or might not happen depending on what components exist in an entity) and stuff instead of just calling a function! Besides, it seems like we're always going to be explicitly asking whether components exist, which kind of beats the point :\

Incubator / NausicaäRL
« on: July 05, 2013, 06:13:19 PM »
Hi all,

I tried making a 7drl based on Kaze no Tani no Nausicaä, but of course that failed miserably within the timeframe. But I continued, using Python3.3 + PyGame, then had to stop because I emigrated, and SFML2.0+PySFML came out in the meantime, so it's time to revive the game.

The World of Nausicaä

The world of Nausicaä is an amazing post-apocalyptic world where industrial society collapsed and people reverted back to a pre-industrial living. Artifacts of the industrial era, such as flying ships, are extremely rare and impossible to reproduce. There is a massive toxic jungle that humans cannot live in because of the poisonous airs, whose insects (large and small) are taking land from the last of the human kingdoms.

Nausicaä is the princess of the Valley of the Wind, through which, as the name indicates, a constant breeze from the sea flows. The wind helps keep the spores of the toxic jungle at bay, and people there live in relative harmony, health, and peace.

If you do not know this movie/manga, it is the masterpiece of Hayao Miyazaki, of Princess Mononoke, Chihiro, Howl's Moving Castle, etc fame. It is, in my opinion, better than all of those, and I would highly recommend you see it!

The game

I am not entirely sure how I want the game to play out, but have some basic game mechanics I'd like to see in it.
  • Basic village management: how many people to assign to agriculture, to exploiting resources in the toxic jungle, to defense, building new buildings, etc
  • Explore the toxic jungle: this is where the roguelike aspect comes in. You'll get to visit or explore several places of the toxic jungle. This is dangerous, but you may find some important resources for your village, like ohmu shells, fire-demon remains, airplane engines, etc, which can greatly benefit your village. If you die, you will probably be found and taken back to the village.
  • Survival: the more you go into and the more you stay in the toxic jungle, the more the jungle is going to get angry at you. If you are not careful, insects might come to invade the valley, which reduces their rage. With the attack, some spores might be leftover, and this can be a catastrophe as you have to burn your crops. Furthermore, you have to deal with envious other nations.
  • Wind: wind is such a huge element of the movie/manga that it should feature somehow. It might increase/decrease morale according to its strength, drive the windmills that bring the water up, serve as indicator that something is wrong...

There's many more from the movie one can draw. Too much time in the toxic jungle with a basic breathing mask can result in the character becoming ill and have to recuperate. To travel to the toxic jungle perhaps you take mainly chico nuts, which take lots of resources to find, an take manpower away from the rest of the running of the village... etc. Ohmu shells could make better tools and weapons, fire-demon remains could be used to make strobe grenades to stun insects and send them back peacefully, etc.


Language: Python 3.3
Libraries: PySFML1.3

Architecture & design: Model-View-Controller'ish, component-based actors, event-based communication, data-driven (XML)

I hope to build a fairly generic and reusable engine while making this game.

The repository currently contains the PyGame version, which is going to undergo a major rewrite as I port it to component-based actors, event-based communication and PySFML.

What's currently done

There's the "old" engine with PyGame, which is mostly going away. Here's the title screen, and a video of an older version. What you can see is the hero moving around an animated landscape, with the crops growing, and then the hero opening and closing some doors.

In the meantime I implemented the equipment system, which allows creatures to have "parts" (like IVAN) and items can be equipped on some of those "parts", etc, with all this information data-driven. However, these equipped items still do not give anything to the wearer, like armour or the ability to attack.

Again, it's mostly all going away, including the organisation of the XML file, but there might be reusable tidbits. At the very least, there's a record in case anyone wants to continue the PyGame implementation. The code is also relatively commented, so it might be of some interest.


I feel pretty confident I can work on this for a while. I changed my life habits a few months back and where I used to drop most activities after a while, I have been active in lots of things, and actually doing them feels great.

Still, I'd love some collaboration on this project, but would like it to be "proper" collaboration, where we Skype/Hangout once a week or so at a given time and discuss progress, development, code organisation and perhaps just code while hanging out on chat. This makes development tighter, more efficient and less likely to fizz out.

I'd like to try to get the architecture mentioned above working properly, and wouldn't want someone to just go ahead and do it themselves, since I want to learn. I've been browsing Game Coding Complete for ideas on how to organise an engine, and the book has some good advice.

Ideally, not only would we come up with a game, but also a game python engine for roguelikes, and 2d games in general.

Let's see what comes out of this :)

Off-topic (Locked) / MineCraft
« on: June 15, 2009, 01:51:03 PM »
Hey you guys,

I'm not sure if you've heard about MineCraft, but I'm guessing it appeals a fair bit to the Roguelike crowd! It uses Java and is an applet, so the best way for you guys to find out if you like it is to go and try it!

Basically, you're in a block (think 3d matrix) world, where you can remove and add blocks more or less at will. That's it. It has multiplayer, and around a dozen types of blocks, some of which interact with one another. The great thing is the open-endedness of it. You can just go and do whatever you like, castles, ruins, ... well, WHATEVER you like.

You can play for free right now, but as the game evolves and new features are added, they might no longer be available unless you buy it. It's currently at $15 or 10€. For example, if you buy the game you can make custom skins (I have a pirate, harrrrr).

I'd highly recommend you guys give it a twirl, you might just enjoy it!

Other Announcements / getter77
« on: February 12, 2009, 04:02:15 PM »
Hi all!

I'd just like to thank one member of this community in particular, and that is getter77!

Over the past months I've seen him constantly trying out and providing feedback on all sorts of roguelikes. A lot of developers give up due to the lack of interest and players, but getter77 always seems ready to give them a real go and has had a real impact on this community! That always perks up somebody's spirits!

Not only that, but he seems to find completely crazy roguelikes that nobody's ever heard about (not even him!).

All in all, I just wanted to show my appreciation for all that he's been doing for roguelikes in general!

Cheers mate! You carry on! :)

Classic Roguelikes / [CRAWL-TOURNAMENT] Temple of the Roguelike Clan?
« on: July 31, 2008, 02:07:21 AM »
Hey guys, have a look at these links:

So... a tournament, with clans. I've never won crawl, nor think I ever win. I manage to get killed most of the time. But... it might be fun :D

Other Announcements / Dungeon Crawl Stone Soup 0.4 released!
« on: July 17, 2008, 01:23:22 PM »
Check it out, it seems great! It's compiling right now :)

Programming / Unangband AI
« on: April 21, 2008, 09:26:13 AM »
This post was lost to the backup, so here it is again! It went something like:

Hmmmmmmmm, emergent behaviour......

Traditional Roguelikes (Turn-based) / IVAN coolest deaths
« on: December 10, 2007, 10:39:18 PM »
Right, in an attempt to get more people to play and get into IVAN, I started this topic so that we could relate the coolest, most stupid or weird deaths you've suffered in IVAN!

I've had a couple of very nice ones:

Like the one time I was all happy I had found a pickaxe, so I could break down walls instead of going around huge tunnels. There I was, and I decided "yep, this is the spot! I'm gonna break this here wall, and get to the stairs so much quicker!". Wielded the pickaxe, and hit the wall. Turns out there was an oil lamp on the other side. Apparently, bad things happen when a lit oil lamp collapses on the ground along with the wall. Bad things, like, say, explosions. Stuff on my inventory started exploding too and getting burnt, and one of those things was a wand of polymorph. I turned into a "giant magpie", wearing a couple dozen kilos of equipment. Kinda hard to fly. A badger came along and proceeded to munch my head off while I was trying to get rid of a shirt of chainmail.

The other time I was in the second dungeon, whose ground seems to grow mines like grass in Great British soil. So I walked into this room and was exploring when I stepped into a mine (go figure). Usually, they're pretty much insta-kill, but I must've had a cloak or rings of fire resistance... I didn't even dare watch the map, I just looked at the messages. "This exploded, that exploded, your potion of healing heats up and explodes, your leg is blown away, your wand of door creation explodes..., etc, etc". However, there was no: "YOU DIE!" message! I rejoiced!

Then I looked at the map. The wand had created doors all around me. That's ok, I'll just rest (and I did) and then open them. "The door is locked." Hmmmmmm. I'll try the another one. "The door is locked."... "The door is locked."..."The door is locked.""The door is locked.""The door is locked.""The door is locked.". DOH!

Right. I took a potion of something or prayed, and got a leg back. I kicked the door: "Your weak kick has no chance of affecting this door." DOUBLE-DOH!

After surviving a minefield explosion, I starved to death. It must've been one of the most frustrating deaths I've ever had!

Off-topic (Locked) / They Who Are Too Busy
« on: November 28, 2007, 05:08:46 AM »
Possibly AKA They Who Have No Time.

It's 5am, I have to get up at 8am, and I'm still going through stuff for a Distributed Systems test tomorrow. Phase 1 of the project was delivered on Monday. Phase 2 is due in two weeks (it's huge), and I need to do extras if I don't want do aim for a measly 14/20. There's a very small program to submit until Friday. There's an Artificial Intelligence research assignment (neural networks) due on Monday, and there's another two weeks of bayesian networks after that. There's a "desktop" made in flash/actionscript due two weeks from now. And finally, there's the ongoing need to compile a language with functions/procedures (the interpreter and grammar are done), and this week, the final assignment for that class should come out and continue up to 23:59 of the 30th of December.

Oh, and we're lucky because we've had 3 Computer Graphics assignments accepted, and we don't need to do the next one.


So, how about you guys?

Programming / Matrix or single-array abstraction?
« on: July 08, 2007, 05:12:35 PM »
Right, so I've seen that a few people, instead of having a "real" matrix (as in, an array of arrays) use a single array, and when they want to access position (x, y) do something along the lines of array[x + y*width].

Is it really worth it? You're trying to trade two memory accesses for a single one with a little arithmetic on the side, right? Is that speed gain even significant?

Is there something I'm missing?

Classic Roguelikes / ADOM - tips & strategies
« on: June 21, 2007, 04:16:26 PM »
Hey, so even though I'm Crawling a fair bit recently, I thought I'd post a couple of tips that have helped me finish up the quests in Terinyo, at least - with fighter blokes.

A very important thing: whatever class you pick, if you haven't got the healing skill, then choose the Mayor's quest in favour of the Druid's. Go into the Dungeon, and when you find the crazy lumberjack (or whatever he is) down in the last level, instead of killing him, set yourself on Coward tactics and make him follow you all the way to the Healer, about halfway or two-thirds down the dungeon. Let them get next to each other, and the healer'll heal him, and teach you the Healing skill if you ask him to.

The Druid quest is pretty hard because he's immunce to most magic, so I usually just go on that quest if I've got healing AND I'm a fighter.

For the doggie quest, skip the past few levels as fast as you can, especially the cave. It's got a very big monster spawn-rate. Don't forget the doggie will die if you take more than 3 days! You can come back later for more experience.

And finally (and most important, for me), here's the melee combo that's worked best for me: spear + shield.

The polearm skill, if you manage to train it enough, grants you a great DV bonus. Up to 22, if I'm not mistaken. You'll start getting DV at the first or second level of the skill. At the 5th or 6th, that rate increases, I think. If I remember correctly, the only weapon skill that gives you more DV is Staves (quarterstaff), but those are two-handed, and you can't get a shield then.

The shield skill works exactly the same way (increasing lots of DV every skill-level). Plus, if you're a regular fighter, your base class DV should be also getting higher every level. If you manage to survive, you'll easilly get around 40-50 DV after finishing up the quests.

Another good thing is that spears are not that hard to find, and because they're used in traps, you can get some for backup in case of rust or corrosion. Crude spears are orc spears, and they usually have a couple of bonuses, so don't be afraid to switch just because they're "crude".

And finally, if you find an altar with your alignment, you can simply drop stuff on it and it'll let you know whether it's cursed or not. This is extremely useful - so you know which rings you can try out safely, and experiment with weapons/armour to see which has the greatest bonus!

This is what has worked out for me a few times. I currently have severe problems with slugs, which corrode me into nothingness, and the dungeon on the northwest, where the enemies are much, much more experienced. I always die in the first few levels, mostly out of carelessness, I guess. There aren't many healing potions, so it's hard.

Someone else's turn now ;)

Programming / Serialization
« on: May 26, 2007, 06:29:25 PM »
In an attempt to start some development talks here so that more people move to the forums, I have a few questions about serialization.

I don't have a terrible lot of experience in programming (only a 2nd year university CS student), and everyone on usenet has been talking about how important it is to set up a serialization system up front so that you are able to save and don't have to change huge amounts of code later on.

The main reason for this seems to be related to pointers. I've heard someone say that he assigned unique integers to every instanciated object (I believe), and instead of pointers, he kept those integers, which were looked up in (possibly) an array. This would eliminate problems with referencing. I'm guessing he's doing this so that there's a single way to refer to an object throughout the project.

But doesn't that actually already happen with memory pointers? I mean, an object can only be in one memory place at a time AFAIK. Same object pointers will have the same value throughout the project, right? In this case, wouldn't it be possible to code a "Serialization Engine", with serialize functions whose arguments are each possible class/structure ?

While it was serializing, it could keep an up-to-date table with pointers so it knows what has already been serialized and what hasn't. When it de-serializes, what was a pointer before becomes a unique ID anyway.

How wrong am I?

Also, if anyone has any links on serialization, could you please post them? I don't want to know about Java serialization though. That's all I can seem to find right now (not much time anyway). I think I'll cover this stuff in the next semester... but I need to know the basics so I don't make bad decisions right at the start.


Pages: [1]