Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Who Needs Direction?

This thread is locked; no one can reply to it. rss feed Print
Who Needs Direction?
23yrold3yrold
Member #1,134
March 2001
avatar

My collision detection usually consists of an array of tiles. That's not just image data; the tile structure also contains an index into a collision array. I use an array of bitmasks for most of my tilemaps. In the case of Monday, it can be strictly a binary value.

Depending on how far you want to go, we can also give each tile a speed and direction (for conveyor belts that affect player movement), a number that corresponds to the script it triggers, animation info, the walkable/throwable/shootable properties I mentioned some time ago, whether it's a hole since we already know there will be holes you can fall in, etc ...

Either way, get the tilemap class implemented and working with all the features we want off a few hardcoded maps before worrying about the file format too much. I don't want us to be loading off maps and then realize we need to change the file format to accommodate something we forgot, and end up scrapping all our map files. :P

PS: 600 post get

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

BAF
Member #2,981
December 2002
avatar

Why aren't you using a binary file format?

23yrold3yrold
Member #1,134
March 2001
avatar

Text has been recommended for this for some odd reason. AFAIAC, if you can put data in it and pull data out of it, it's all good. It's not like memory will be a huge concern on this project.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

BAF
Member #2,981
December 2002
avatar

I don't think its very logical, considering you have a tilemap editor, but oh well.

MiquelFire
Member #3,110
January 2003
avatar

Yea, but only he has the editor. How else will the others be able to edit the maps without the editor?

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Trezker
Member #1,739
December 2001
avatar

I just used text because I don't have an editor and didn't feel like writing dummy code to create test data.

For the tileset I think it's quite alright to use text. But when you're making big maps with multiple layers binary is preferable.

How well does std::ifstream work when you switch from text to binary. I feel it should work quite well... But I've had problems fetching values after eachother before... It's like file<<int1<<int2; doesn't put that space between the values so when you do file>>int1>>int2; it doesn't handle it right. But I suck at this...

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

But I suck at this...

Yeah, you can't use the "formatted output" operators on binary files. They write textual strings. The only difference between a binary file and a text file (to an fstream) is the line endings.

You need to use put, which writes one byte. You need to break up longer types yourself. Food for thought.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

relpatseht
Member #5,034
September 2004
avatar

Well, I'm still willing to do something if you ever need more manpower.

23yrold3yrold
Member #1,134
March 2001
avatar

If you want to code, report to Trezker. He'll find you work. ;D Feel free to just comment on the design of any given aspect of the project as well. Right now the tilemap format seems like a bit of a hot topic. If you see a not-yet-implemented function but don't want to commit to more than a few minutes, feel free to fill it out and mail Trezker the code so he can review and add it. Anything is helpful; input in general, code, or even just questions. :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

OnlineCop
Member #7,919
October 2006
avatar

Trezker said:

I feel a bit bad about coding a new map system when OnlineCop had written so much code. But it was too much enterprise...

I have NO problems with you redoing the map system. In fact, I liked 23yrold3yrold's suggestions and ideas for all the structures that the map can use.

Having a good OO design will help if/when we decide to change things like map structure and format, loading/saving, etc.

I like the structure you have already, Trezker. I have been completely out of the loop for a while because of intense classes, so go right ahead...

Trezker said:

Also, I don't think the project can wait for the map much longer, I can't wait for it much longer.

...which is why I'm actually happy that others are working on this. (Who put me in charge of maps, anyway? I don't remember ever volunteering for it... :P)

I can ask my sister if she wants to work on the map editor herself; she's pretty versed in things like that (although with 2.3 kids, I don't know if she even comes on a.cc anymore...).

Lastly, my branch is pretty hack-and-slash. I'm writing everything with a focus on Windows, and I know a lot of you don't use it. What ARE all of you using, anyway? Should I whip out my Mac and start programming on that for a while, or stay on this OS and keep using the editors I'm familiar with?

Trezker: what should I start working on now (hopefully, something not too "we're all waiting and depending on you, OC!")?

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

I can ask my sister if she wants to work on the map editor herself

RAWR!!! >:(

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

bamccaig
Member #7,536
July 2006
avatar

OnlineCop
Member #7,919
October 2006
avatar

Hey, who knows? She may have some experience with this kind of thing. I know I sure don't... At least, not compared to the others here who have single-handedly created entire games. You all are like, Chuck Norris cool compared to me. ;)

23yrold3yrold
Member #1,134
March 2001
avatar

The point has been missed. One of my three current projects is re-writing my tilemap editor in C#, and it's pretty far along. Obviously it will be able to spit out Monday files.

I thought I had been pretty clear about that ....

EDIT: Mapslapper has pretty much everything vital but the animation editing at this point. And the saving, but I need a format for that. :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Trezker
Member #1,739
December 2001
avatar

You mean animation of tiles right? Well you could make that yourself in the tileset class. You could add a timer variable in Tile, which currently resides in the same header, or use the same timer for the whole tileset. Then you'd need to get an Update call in there to update that timer.

OnlineCop... Ok, I see communication has been very poor between us. :)
Perhaps you could play around with making a particle system, I don't think that's something people will be waiting eagerly for.

Anyone disagree? Is particles urgent?

What else is there? Entities, menus, and maps are covered.. Any specifics will be going into scripting...

23yrold3yrold
Member #1,134
March 2001
avatar

I know how to animate the tiles; The Mighty Stoopid had that implemented like 3 years ago. :) I just mean figuring out a good way to handle editing the animations. Time to check out how C# handles drag and drop ... and no, particles is far from urgent.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Matt Smith
Member #783
November 2000

"And the saving, but I need a format for that. "

FMP, otherwise it's your call.

If we devise a new complex format with loading & rendering, it would be easy enough to make an in-game editor from there. All we would need would be the saving func, and some GUI work.

Speaking of GUI, we may have MASkinG working on A5 by the weekend, so I'm not going to implement a new GUI from scratch. One of the MASkinG examples is exactly the kind of generic game menu front ends that I've been making, so I'm gonna learn the MASKinG API, and reimplement the menus I've done.

23yrold3yrold
Member #1,134
March 2001
avatar

I tried to look into FMP; it doesn't seem to have much documentation beyond "here's an open source program that loads it, look in there or something, I dunno". I'll probably look again later. And yes, in-game editors are win, but I was going to make this program anyway. :)

EDIT: I found a straight-C Mappy demo which seems to have the loading files in it pretty plainly. It's not formatted very well and there's no comments, but I'm in the process of documenting it and cleaning it up for my own purposes. I'll probably post it later; I can't be the only one who could use that ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Don Freeman
Member #5,110
October 2004
avatar

How do I get involved? What is left to be assigned?::)

Edit:
Noticed this (don't know if it has been fixed yet)

lua_State* Lua_wrapper::Prepare(std::string function, void* caller)
{
  if(function == "")
    return NULL;

  lua_getglobal(state, function.c_str());
  lua_pushlightuserdata(state, caller);
}

This function is returning without returning a value...I changed it to:

lua_State* Lua_wrapper::Prepare(std::string function, void* caller)
{
  if(function == "")
    return NULL;

  lua_getglobal(state, function.c_str());
  lua_pushlightuserdata(state, caller);
  return state;
}

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

Trezker
Member #1,739
December 2001
avatar

Holy shi! How the hell did we miss that!

Thank you. I very much suspect this is what's been bugging us on windows.

My compiler on Linux must be something spectacular, it includes headers for standard functions on its own and maybe even returned that state for me...

It's pretty troublesome since other compilers don't do this so when I forget to include say stdlib, the windows guys can't compile, and get bugs like these.

Evert
Member #794
November 2000
avatar

Always always always always have warnings turned on when you compile. Assume a warning means an error until you've confirmed it to be otherwise.

Quote:

My compiler on Linux must be something spectacular, it includes headers for standard functions on its own and maybe even returned that state for me...

It probably returns the return value through a register. If you're lucky, the contents you want is already there and not returning a value doesn't break the program.
Still in that case, an unrelated code change somewhere can suddenly break it.

Don Freeman
Member #5,110
October 2004
avatar

I've never used LUA before. I am trying a test program, using the Lua_wrapper functions...I get this error: "attempt to call a string value" whenever I call

lua_setglobal(state, "game");

Any suggestions???!?

Edit: I am using Eclipse on Linux:D
Edit2:
I noticed this when looking for answers...apparently not good to export lightuserdata:

Quote:

As a rule: never export light userdata to Lua scripts!

Use them within your C code and never make them visible outside of
your module. If you do, a Lua script may bomb your system.

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

bamccaig
Member #7,536
July 2006
avatar

Don Freeman said:

I am trying a test program, using the Lua_wrapper functions...I get this error: "attempt to call a string value"...

As you probably know, in Lua, functions themselves are stored in variables as references that can be passed around, the same as tables and userdata. IIRC from the Lua tutorial I did recently, when you attempt to execute a variable as a function (i.e. some_var();) that does not reference a function, you get an appropriate error message returned usually in the form attempt to call a <type> value. I haven't gotten to the C API yet, so I'm not sure what you're attempting to do, but it sounds to me like you're unintentionally attempting to execute a string as a function, which Lua cannot do.

** EDIT **

Actually, while running the interpreter and manually executing statements, the error message is attempt to call global '<identifier>' (a <type> value). :-/ So maybe it's something different.

Trezker
Member #1,739
December 2001
avatar

Yeah I've been worrying about the safety of giving Lua a pointer to an instance and let it call functions in C++ that uses the pointer lua provides...

In a lua script for monday as it is now you can do this.

Entity_set_position(anything, x, y);

This will obviously screw up the execution of the game, if you're lucky it just crashes...

So I've been thinking of adding a check that makes sure the script hasn't sent a bad pointer. This could be costly though, any ideas on how this should be done?
Even if it's costly, we could at least include this check in debug.

Matt Smith
Member #783
November 2000

Don Freeman, don't ask us what help we need, keep telling us :)

Lua crash in Windows confirmed as resolved.

I think rigourous safety checking in gameplay Lua scripts will be essential if this game goes mainstream. They should be passing handles or ID, not pointers. We don't want the modding community to fall victim to Lua viruses :-/

EDIT: and furthermore, it will be useful to segregate gameplay scripts into namespaces so that, for example, a character AI scripts cannot directly deform the map. Instead it could trigger an event which causes the map to deform itself.



Go to: