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.


Messages - SupSuper

Pages: 1 ... 117 118 [119] 120 121
1771
Suggestions / Re: Anti-suggestions
« on: June 27, 2010, 06:28:42 pm »
That is a very bad idea:

- Having a program split into pieces like that is just asking for trouble. Sure back in the day you needed to save extra byte of memory you could, but you have to manage information between programs yourself which is bothersome and error-prone, there's no proper way to handle one of the parts failing (when the X-Com Battlescape died, the Geoscape wouldn't notice and just use the last available mission results), and it just restricts the parts needlessly (you couldn't quit or load saves from the Battlescape because the Geoscape had to do that). Who knows if I won't later extend the game to a point that the Geoscape and Battlescape should be tied together.
Engines are separated not for saving memory. Look at Worms, for example. They have separate GUI for options and "battlescape". It just simplifies program.

If Battlescape died it is a bug. Just handle signals properly so it would be impossible to quit by closing the window.
I presume you mean Worms 2, since none of the other games do that, and it's still a minority.

In any case I prefer sticking to what I'm familiar with and avoid any techniques outside my skillset.

Also you have XcomRuleset that is based on Ruleset.  You don't really need more than one ruleset in one game, just create one "Ruleset" class and everyone will be able to modify it if they want to change rules of the game.
Ruleset is probably a bit of a misnomer. In fact I still haven't set in stone what it really does, but there probably won't be many actual "rules" in there since an X-Com engine is an X-Com engine and there probably isn't a whole lot you wanna change without becoming a different game entirely. It probably won't contain gameplay features like whether

For now it's just a nice place to keep all the typically hardcoded numbers like craft stats, facility stats, item stats, weapon stats, research tree, etc. For example, as far as the engine is concerned, a craft is a craft and it has various properties and can contain weapons and soldiers and it can fly around intercepting stuff and going on missions. It's the ruleset that tells it there's a craft type X with acceleration Y and crew capacity Z and so on. Whether you call it a Skyranger or a Triton the engine will treat it just the same.

In any case, the reason there's support for "multiple rulesets" is people will probably wanna play around with these stats a lot, so I need to keep them fairly separate from the engine. The XcomRuleset has all the original game stats, but some people would probably prefer improved tanks and weapons like in XcomUtil. You might only have one ruleset in use by one game at a time, but the player might have a wide selection to choose from when they start a new game (kinda like mods). Hell, maybe they're a picky bunch and decide they want the "improved tanks" but not the "improved weapons", so you need to split the rulesets into bits so the player can pick multiple ones that get combined for them. That is the reason there's an abstract Ruleset, planning for the future.

Aren't these constants stored in X-COM data files? If not, it is possible to load them from your own file format.

If you want the game to be moddable, then these rules should be stored in files. If not, then there should be one hardcoded ruleset. But I don't understand why you want to put multiple hardcoded rulesets inside compiled game.
The constants are hardcoded into the X-COM executables, but since there's various versions with different offsets, it's easier to just "copy-paste" a bunch of numbers than loading them straight from the source.

Plus you're right, eventually the rulesets will go on external files, but for now the focus is to "Don't implement any new features until you fully reimplement original game or at least big part of it such as geoscape." :) so don't take any of the design as final.

1772
Programming / Re: Cleaned up Makefile
« on: June 26, 2010, 08:10:57 pm »
Thanks, I've commited it to SVN. I'm not familiar with Makefile standards so most of it was mish-mashed from tutorials around the web (example) and they seem to happily use a CC variable and such.

As for the "openxcom" vs "OpenXcom" thing, the executables on other platforms are called "OpenXcom" so I figured I'd keep it consistent, but I guess it doesn't really matter.


1773
Suggestions / Re: Anti-suggestions
« on: June 26, 2010, 07:28:30 pm »
Don't implement any new features until you fully reimplement original game or at least big part of it such as geoscape.
That is the plan. Any improvements I introduce in the mean-time are purely because of how simple/handy they are.

Create separate programs for geoscape and battlescape.  Use the same file format as original X-COM.  This will let you replace one of the programs with original program running inside DOSBox.  Share source files between these programs.  Don't create shared libraries, just compile them from overlapping sets of source files.
That is a very bad idea:

- Having a program split into pieces like that is just asking for trouble. Sure back in the day you needed to save extra byte of memory you could, but you have to manage information between programs yourself which is bothersome and error-prone, there's no proper way to handle one of the parts failing (when the X-Com Battlescape died, the Geoscape wouldn't notice and just use the last available mission results), and it just restricts the parts needlessly (you couldn't quit or load saves from the Battlescape because the Geoscape had to do that). Who knows if I won't later extend the game to a point that the Geoscape and Battlescape should be tied together.

- The community still hasn't fully reverse-engineered the game's file formats, so a lot of them still remain a mystery and it'd force me to have to wait around until I could use them. Plus the old file formats also bring a lot of old bugs and limitations with them like the "proximity mine bug", the various engine limits, and in the end it'd just restrict me from extending them and taking full advantage of a new engine.

I get that in a perfect world this would mean that I could write a new Geoscape and you'd plug it in with the old Battlescape and pretty much have a full game in half the time wouldn't that be awesome!!!!!, but I don't even want to imagine the trouble of getting both to cooperate without issue, specially if you mixed platforms. In any case the point of OpenXcom isn't to reverse-engineer the original and replace/patch it (there's already plenty of hacks trying to do that), but to provide a new clean codebase based on the original but relying on modern standards and practices, to not be bogged down on all the old needless restrictions, file formats and so on.

Use less abstractions.

For example, you have "Soldier" class.  Most of it's methods just get and set private fields.  There is only one place in code that modify soldier's names, it can handle everything that is related to renaming so you don't really need "setName" function.  And nothing is calculated when you get name so you don't need "getName" method.  Just make "name" field public.
Well this is mostly me sticking to OOP best practices and keeping the code consistent. Never having classes with public fields, always use get/set methods, etc.

I know this can get kinda painful since inevitably a lot of classes in a game are just gonna be a bunch of numbers. Hell, looking at the Soldier class as is now, why don't I just replace it all with one line like:
Code: [Select]
struct Soldier { int _tu, _stamina, _health, _bravery, _reactions, _firing, _throwing, _strength, _psiStrength, _psiSkill, _melee; }
Now that's a whole lot simpler with virtually the same functionality! Man all the time and lines I could've saved.

But then the code starts getting kinda ugly. You get stuff mixed like "save.funds -= base.getTotalMaintenance()". Then you don't know if some class uses a getNameOrSomething() or do I access the field directly. What if I suddenly decide I wanna append something to the end of soldier's names? Or start validating user input?

I know this is all exaggerating and you're probably right that a name will always be just a name and so on, but I like sticking to these kind of standards as it teaches me to be consistent and not get carried away and be lazy. It's a slippery slope, I'm very prone to being lazy and next thing you know the code is all condensed in a few lines with no comments or anything and you'll have a real adventure trying to modify it.

Also you have XcomRuleset that is based on Ruleset.  You don't really need more than one ruleset in one game, just create one "Ruleset" class and everyone will be able to modify it if they want to change rules of the game.
Ruleset is probably a bit of a misnomer. In fact I still haven't set in stone what it really does, but there probably won't be many actual "rules" in there since an X-Com engine is an X-Com engine and there probably isn't a whole lot you wanna change without becoming a different game entirely. It probably won't contain gameplay features like whether

For now it's just a nice place to keep all the typically hardcoded numbers like craft stats, facility stats, item stats, weapon stats, research tree, etc. For example, as far as the engine is concerned, a craft is a craft and it has various properties and can contain weapons and soldiers and it can fly around intercepting stuff and going on missions. It's the ruleset that tells it there's a craft type X with acceleration Y and crew capacity Z and so on. Whether you call it a Skyranger or a Triton the engine will treat it just the same.

In any case, the reason there's support for "multiple rulesets" is people will probably wanna play around with these stats a lot, so I need to keep them fairly separate from the engine. The XcomRuleset has all the original game stats, but some people would probably prefer improved tanks and weapons like in XcomUtil. You might only have one ruleset in use by one game at a time, but the player might have a wide selection to choose from when they start a new game (kinda like mods). Hell, maybe they're a picky bunch and decide they want the "improved tanks" but not the "improved weapons", so you need to split the rulesets into bits so the player can pick multiple ones that get combined for them. That is the reason there's an abstract Ruleset, planning for the future.

If you want others to be able to modify game engine, don't try to create bulletproof abstractions and don't add scripting engines. Abstractions don't let you fully modify game until you understand code behind them.  Scripting engines are even more limited.

There is already nearly 8k lines of code (and 15k if you count blank lines and comments).  This number can be greatly reduced by removing most of such abstractions.

I am just afraid I would not be able to modify code when you finish implementing bigger part of it.
I don't really see what point you're trying to make. What do you mean by "bulletproof abstractions"? I'm not writing some generic game engine, as you pointed out, but an X-Com engine. There are Crafts, Soldiers, Bases, etc. Obviously if someone wants to use the engine for something else they'll have to rip that stuff apart and it'll be a lot of work, but that's their own fault for not using a proper generic game engine.

There is a whole bunch of stuff that could probably apply to any game, yes, like a state machine, interface, graphics, sounds, etc. And a lot of it could be clustered together, but there's really no need. That's not really trying to abstract away the whole system, but keeping things tidy and organized and in their place. I used to have all the resource loading in the Game class until I decided it was getting kinda bulky and moved it all out to its own class. As you code a lot you find more and more stuff that would fit better elsewhere and makes it easier to work. You can see this in the SVN history, the game grew from a little bunch of clustered files to a ton more cleaner files, and it's much easier to work with this way. You said it yourself, half the code is just commenting, spacing and other stuff to make it more pleasant to read and work on.

But it's still all designed to load X-Com formats, use 8bpp palette graphics, etc, and you'd probably have a hard time getting the engine to do something else.

1774
Interesting. Some kind of mission editor for when I get around to implementing and testing the Battlescape could be useful, although a lot of work.

1775
Suggestions / Re: Couple of (mostly) gameplay related ideas
« on: June 25, 2010, 09:15:11 pm »
Boy there's a lot of ideas going on here! There are a lot of minor suggestions that sound feasible, specially ones already used by similar games like Jagged Alliance 2.

But there's also a lot of major gameplay-changing suggestions that require much more thought. Thanks for the feedback though.

1776
Open Feedback / Re: Game running fine?
« on: June 20, 2010, 09:53:58 pm »
Please read the instructions carefully. :)

Ah yes I see. My mistake  :-\

Anyways good news I got it to work now :P Do you intend to replace all the graphics with something more open source licensed? Or will you require users to have a copy of x-com on their HD?
Once the game supports different graphics and there's enough artists to replace all of them (and there are a lot of them), sure. But for now X-Com is a requirement.

1777
Open Feedback / Re: Game running fine?
« on: June 18, 2010, 05:36:52 pm »
Here I am providing pre-compiled versions to save people the trouble, and here they are compiling it themselves. Horrifying! :P

Anyways, you are quite right:
Quote
And like mentioned in the Downloads section, you will need a DATA subfolder with a copy of X-Com to run the game.
Please read the instructions carefully. :)


1778
Open Feedback / Re: SVN path
« on: June 18, 2010, 05:19:52 pm »
Works fine for me. Make sure you're accessing https://openxcom.svn.sourceforge.net/svnroot/ and not https://openxcom.svn.sourceforge.net/svnroot with your SVN client (the terminating backslash is important).

In any case, the full correct URL is https:https://openxcom.svn.sourceforge.net/svnroot/openxcom/trunk/

When in doubt, you can always check the Sourceforge page: https://sourceforge.net/scm/?type=svn&group_id=300877

1779
The X-Com game world consists of a flat map with a series of polygons representing the land masses, like so:


(image from Ufopaedia.org)

Every point on the map has a latitude and a longitude, just like the real thing. To turn the map into a pseudo-globe, every point is converted from lat/lon to X/Y, like so:

x = radius * sin(lon) * cos(lat)
y = radius * (sin(lat) * cos(rotLat) + cos(lat) * sin(rotLat) * cos(lon))

(radius = globe radius, lon = longitude, lat = latitude, rotLat = rotation on the latitude, sin = sine, cos = cosine)

Now I need to invert these formulas to reverse the process (turn points on the globe into points on the flat map), so they become something like:

lat = ...
lon = ...

So... anyone have any ideas how to solve this?

1780
The X-Com game world consists of a flat map with a series of polygons representing the land masses, like so:


(image from Ufopaedia.org)

One of the things that needs to be checked when the player tries to place a base, is whether the base is on land. This is done by checking if the clicked point is inside a polygon.

While this is very simple, the problem is that a lot of the polygons "wrap-around". That is, since the flat map is rendered as a globe, a lot of the polygons wrap around from one side to the other like this:


In black is how the polygon should work, while in red is how the polygon will be interpreted. Naturally this poses a problem using standard point-in-polygon algorithms.

So... anyone have any ideas how to solve this? Mathematically, programatically, however you can explain it.

1781
Open Feedback / Re: SVN path
« on: June 18, 2010, 06:30:21 am »
Thanks for that, I never seem to get the bloody thing right. :-[

I've also added a Contact link on the website if you need to email me for little things like this, although the forum is better otherwise.

1782
Suggestions / Re: the simple things...
« on: June 15, 2010, 08:10:45 am »
Thanks for the ideas. I'll be sure to look into the other fan-stuff for ways to improve the game.

Another idea: dual-wielding pistols. see Jagged Alliance 2. Not good for long distances, but ideal for shooting in
close quarters, as the aiming-time is faster than with an autofire-capable rifle - you get 2 shots instead of three.
You can already dual-wield pistols, or do you mean be able to shoot both at once for reduced cost?

1783
Offtopic / Re: X-com Apocalypse
« on: June 13, 2010, 12:59:25 am »
Also I haven't seen anyone try to remake X-Com 2 either so I think fans are just purists. :P

BTW, I loved X-COM 2 a lot better than the first part - it was more balanced (no infinite laser weapons), more polished and the overall atmosphere was a lot more creepy. Thus I really hope that in time OpenXCOM will make it possible to play TFTD as well - the engine should be mostly the same anyway. Well, I keep my fingers crossed  ;)
I already mentioned this elsewhere, but X-COM 1 and 2 are virtually the same so supporting both eventually shouldn't be too hard (also I imagine it'd be a lot more popular without bugs and being able to tweak the extreme difficulty). :)

1784
Offtopic / Re: Xenonauts
« on: June 13, 2010, 12:58:24 am »
Another one? :D

It does look interesting, we'll see how it turns out when it's released.

1785
Suggestions / Re: Scripting access to the engine for modding
« on: June 12, 2010, 08:58:01 pm »
While it will be a while before the game can be easily modded, I am designing it with that in mind. Currently all the static value stuff like crafts, weapons, items, aliens, research tree, base layout, etc, are all kept separate from the engine. So the engine treats all that stuff equally. Whether it's a Skyranger or an Avenger it won't care, it'll just look at the values like "soldier capacity" or "acceleration", so you can easily make your own stuff and later it'll all be loaded from XML or something.

I haven't looked at stuff like Lua and external scripting though. I know it's all the rage but I imagine it's a lot more work than it looks, and I'm not sure of the advantage of softcoding everything and turning it into a generic game engine just for moddability's sake.


Pages: 1 ... 117 118 [119] 120 121