[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/agdg/ - Amateur Game Development General

AGDG - The Board

Catalog

Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Oekaki
Show oekaki applet
(replaces files and can be used instead)
Options
dicesidesmodifier
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, swf, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


Welcome to AGDG, have you ever made a game?
See also: /ideaguy/ | /vm/

File: 1456500196846.jpg (84.56 KB, 444x600, 37:50, marco_3b.jpg)

f1033e No.25662

i would like to develop a system where players actions and visibility of game objects are part of the game itself.

simple example

>strategy game where nations can "trade" what they are going to do.

>you attack him in 10 turns, i will never go in that land.

this is simple, but it quickly scale in complexity when you add inputs and shit.

conventional abstraction are not really helpful,

is there any book about this kind of stuff?

a70153 No.25675

So, like a card game maybe? Where your set of possible moves is draw from your deck, but you can trade moves to your opponents?


f4c974 No.25686

Well, a card game has very defined states, you can interact with your cards in play and in hand, and the rules of those cards are player indipendent and can do whatever they want.

This is not particularly hard to manage.

But, for example, in a economy game, if you are caught using speculative founds, you are forbidden to trade in a particular state.

A naive solution is the one to lock the button in the ui, but that does not work well with ia. Another is to code that in the trade function, but what if I want an hidden effect that forces the player to trade even if he can't?

The trade function shouldn't be able to know if the player can or cannot do that action, otherwise everything becomes too complex.

And networking is not even in the picture.

My current solution is done by using 3 classes.

Action, actor and target.

An action has a list of allowed types of targets and actors that can call it.

An actor has a list of allowed action that can execute.

And a target has a list of allowed actions and a list pairs of actions and actors that cannot interact with him.

this solves the problem I was talking about before., if a player is forbidden to trade in America you simply add him, and the trade action to the forbidden pairs in America.

Finally I made a wraparound to this system, where every action, actor and target has an id, so instead of calling actions using their object, you use their id, so you can send those data to the server.

This, as far as I can see, is the best way. But I don't know if other people have better ones


62b878 No.25715

>>25662

>>25686

I don't see how this system is different from most RTS games these days, my initial thought would be to just find out how a similar game is organized and copy that. also a target class seems redundant, I'd image you could just have actors point at other actors with a targetable function.


200aa5 No.25720

I divided those because in a multilayer environment everything that perform an action has to belong to a player, while a target can belong to nobody. And with this structure it becomes easy to easy to define what belongs to who. A target belongs to a player if he is allowed to interact with it.

On the other hand, if a actor rappresent a player there is no reason to interact with him directly, you maybe can interact with his nation, but such nation is implemented as a target.

And yes it's mostly as every rts. Do you know by any chance where to look to read about how they implemented this kind of stuff?


62b878 No.25722

>>25720

still not convinced that a target class is needed, I can't think of a situation where a target would belong to nobody. but I'm also having a hard time following your explanation, have you tried creating creating a UML diagram to map out the thought process?

I'm just getting into game dev literature myself, but I'm sure you can find some with the right google search or asking the right forums. you're bound to be re inventing the wheel a few times if you try to do everything from scratch.


200aa5 No.25723

I have my diagrams on paper, maybe I'll rewrite on a computer later.

Regarding the belong to nobody part.

Let's say the game is about building the babilon tower.

Every player has his team of workers and his side of the town. But the tower belongs to nobody. Everyone can build a piece of it, so it is a target, and it is a target that will never perform an action, since it's just a tower, so it's not an actor.

Finally if we say that actors must belong to a player and everything else is a target, then the server has a automatic way to tell if the an action that a player is performing is legitimate. If the client is the owner of the actor, it can be performed, else someone is cheating.

Maybe in a single player game it is redundant, but in a single player there is no need to define what actions are allowed and what are not


62b878 No.25725

>>25723

so the code for attacking a neutral building is different than the code for attacking an enemy unit? it sounds like you're using objects to store data instead of representing game entities. that's how I'm interpreting your explanation anyways. I'm not at an expert on this stuff but I think your just making this more complicated than it needs to be.


200aa5 No.25735

>>25725

>so the code for attacking a neutral building is different than the code for attacking an enemy unit

nono it's the same.

i forgot to say that enemy attacking does not generate an action. the player issuing the attack generates one. units are target as well.


62b878 No.25739

>>25735

that info just makes me more confused. I'd like give some suggestions but I don't want to make assumptions about what your code looks like.

as for literature, just googling stuff like "programming strategy games" or looking for sample projects for whatever engine you're using should get some decent results. coding games like these can get complicated if you don't have the background for it, especially once you get into AI. you want a simple or proven base to work from if you want to play around with new mechanics.


200aa5 No.25741

>>25739

the code is not bad, as far i can tell.

but i have to admit that english comments are not my strong side.

http://pastebin.com/SPVGR1ET


200aa5 No.25742

File: 1456679436489.png (62.13 KB, 871x583, 871:583, Classdiagram1.png)

>>25739

anyway this was the idea.

without a distinction of target it is less easier to hanlde a network.

while with actors that belongs to someone, it is natural.


57875a No.25766

hmm, well, if you want strange abstraction try some of Emily Short's stuff. She mostly(exclusively?) writes text adventures, but all of them are based around some idea of a novel abstraction for a gameplay mechanic or a way of interpreting the game world.

Counterfeit Monkey is pretty good, and the source is free.

http://emshort.com/counterfeit_monkey/source.html

I would recommend playing the game first, especially if you aren't familiar with Inform


62b878 No.25788

>>25742

Honestly, I can't really figure out if this is any better than a more conventional approach, at least without seeing the rest of the code. Let me know if it works out for you.




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]